Contributing to Code Metrics
May 20, 2026 ยท View on GitHub
We welcome contributions to the Code Metrics VS Code extension! This document provides guidelines for contributing to the project.
๐ Getting Started
Prerequisites
- Node.js 22.x
- npm 10.9.x or higher
- Visual Studio Code
- Git
Development Setup
-
Fork and Clone
git clone https://github.com/YOUR_USERNAME/code-complexity.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
GitHub Codespaces
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
๐ ๏ธ Development Workflow
Making Changes
-
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 - Test your changes with sample files in the
samples/directory
- Press
Code Standards
- 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
Commit Guidelines
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
๐งช Testing
Running Tests
# Run all tests
npm test
# Compile and lint before testing
npm run pretest
# Run VS Code integration tests explicitly
npm run test:vscode
Writing Tests
- 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
Test Coverage
Focus testing on:
- Core complexity analysis logic
- Configuration management
- Language-specific analyzers
- Edge cases and error conditions
๐ Documentation
README Updates
When adding features, update:
- Feature descriptions
- Configuration options
- Usage examples
- Requirements
Code Documentation
- Add JSDoc comments for public APIs
- Document complex algorithms
- Include examples in comments where helpful
๐ Bug Reports
Before Reporting
- Check existing issues
- Verify the issue with the latest version
- Test with minimal reproduction steps
What to Include
- VS Code version
- Extension version
- Operating system
- Sample code that reproduces the issue
- Expected vs actual behavior
- Error messages or console output
๐ก Feature Requests
Before Requesting
- Check existing issues and discussions
- Consider if the feature fits the extension's scope
- Think about implementation challenges
What to Include
- Clear description of the proposed feature
- Use cases and benefits
- Potential implementation approach
- Examples or mockups if applicable
๐ Code Review Process
- 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
๐ Project Structure
โโโ 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
๐ท๏ธ Release Process
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
๐ Getting Help
- 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
๐ค Code of Conduct
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.