We welcome contributions to the Code Metrics VS Code extension! This document provides guidelines for contributing to the project.
- Node.js 22.x
- npm 10.9.x or higher
- Visual Studio Code
- Git
-
Fork and Clone
git clone https://github.com/YOUR_USERNAME/code-metrics.git cd code-metrics -
Install Dependencies
npm install
-
Build the Project
npm run compile
-
Run Tests
npm run lint npm test # Optional: force VS Code integration tests (requires network if VS Code is not cached) npm run test:vscode
For a quick start, you can use GitHub Codespaces:
- Click "Code" → "Codespaces" → "Create codespace on main"
- The environment will be automatically configured with all dependencies
-
Create a Branch
git checkout -b feature/your-feature-name # or git checkout -b fix/issue-description -
Make Your Changes
- Write code following the existing patterns
- Add tests for new functionality
- Update documentation as needed
-
Test Your Changes
npm run compile npm run lint npm test # Optional: force VS Code integration tests (requires network if VS Code is not cached) npm run test:vscode
-
Debug the Extension
- Press
F5in VS Code to launch Extension Development Host - On VS Code 1.139.x the default
Run Extensionconfiguration fails with "Extension host did not start in 10 seconds" because of a bug in the built-in JavaScript debugger (microsoft/vscode-js-debug#2416, fixed in VS Code 1.140). Select theRun Extension (IPv4 attach)configuration instead; ignore the "Could not connect to debug target at http://localhost:9333" notification it shows after ~10 seconds — the debugger is attached and working. - Test your changes with sample files in the
samples/directory
- Press
- TypeScript: All source code is in TypeScript
- ESLint: Follow the project's ESLint configuration
- Naming: Use descriptive names following TypeScript conventions
- Comments: Add JSDoc comments for public APIs
This project follows semantic commit conventions. PR titles must include one of these prefixes:
feat:A new featurefix:A bug fixdocs:Documentation only changesstyle:Code style changes (formatting, etc.)refactor:Code refactoring without feature changesperf:Performance improvementstest:Adding or updating testsbuild:Build system changesci:CI configuration changeschore:Other changes that don't modify src or test files
Example: feat: add support for JavaScript complexity analysis
# Run all tests
npm test
# Compile and lint before testing
npm run pretest
# Run VS Code integration tests explicitly
npm run test:vscode- Place tests in
src/test/following the existing structure - Use the VS Code test framework and Mocha
- Test files should end with
.test.ts - Add test utilities to
src/test/testUtils.ts
Focus testing on:
- Core complexity analysis logic
- Configuration management
- Language-specific analyzers
- Edge cases and error conditions
When adding features, update:
- Feature descriptions
- Configuration options
- Usage examples
- Requirements
- Add JSDoc comments for public APIs
- Document complex algorithms
- Include examples in comments where helpful
- Check existing issues
- Verify the issue with the latest version
- Test with minimal reproduction steps
- VS Code version
- Extension version
- Operating system
- Sample code that reproduces the issue
- Expected vs actual behavior
- Error messages or console output
- Check existing issues and discussions
- Consider if the feature fits the extension's scope
- Think about implementation challenges
- Clear description of the proposed feature
- Use cases and benefits
- Potential implementation approach
- Examples or mockups if applicable
- Automated Checks: PRs must pass CI checks (build, lint, tests)
- Manual Review: Maintainers review code quality, design, and documentation
- Testing: New features should include appropriate tests
- Breaking Changes: Require discussion and careful consideration
Agent-assisted reviews follow the repo-local code-review skill, which encodes the checks above plus this project's specific ones (Cognitive Complexity scoring fidelity, cross-analyzer parity, c8-gated unit tests, setting/README/package.json sync).
├── src/
│ ├── extension.ts # Main extension entry point
│ ├── configuration.ts # Configuration management
│ ├── complexityAnalyzer/ # Core analysis engine
│ │ ├── complexityAnalyzerFactory.ts
│ │ └── languages/ # Language-specific analyzers
│ ├── providers/ # VS Code integrations
│ └── test/ # Test files
├── samples/ # Sample files for testing
├── .github/ # GitHub workflows and config
└── .devcontainer/ # Codespaces configuration
Releases are automated using semantic versioning:
- PRs are merged to
main - Release Please creates release PRs with version bumps
- Merging release PRs triggers automated publishing
- Issues: Use GitHub Issues for bugs and feature requests
- Discussions: Use GitHub Discussions for questions and ideas
- Code: Review existing code and tests for examples
Please be respectful and constructive in all interactions. We aim to create a welcoming environment for contributors of all skill levels.
Thank you for contributing to Code Complexity! Your help makes this extension better for the entire VS Code community.