Skip to content

feat: Add configuration parameters#14

Merged
askpt merged 2 commits into
mainfrom
askpt/add-configuration
Sep 15, 2025
Merged

feat: Add configuration parameters#14
askpt merged 2 commits into
mainfrom
askpt/add-configuration

Conversation

@askpt
Copy link
Copy Markdown
Owner

@askpt askpt commented Sep 15, 2025

This pull request introduces a centralized and type-safe configuration management system for the cognitive complexity extension, replacing scattered configuration access with a dedicated ConfigurationManager. It updates the code lens provider to use this manager for all settings, adds comprehensive unit tests for configuration logic, and exposes new extension settings in package.json. These changes make configuration handling more robust, maintainable, and testable.

Configuration Management Enhancements:

  • Added a new ConfigurationManager class in src/configuration.ts that centralizes access to all extension settings, provides type safety, default values, validation, and change watching.
  • Updated package.json to formally declare all cognitive complexity settings (enable/disable, CodeLens toggle, warning/error thresholds, exclusion patterns) for user configurability in VS Code.

Provider Refactoring:

  • Refactored ComplexityCodeLensProvider in src/providers/codeLensProvider.ts to use ConfigurationManager for all configuration access, including thresholds and exclusion patterns, and to determine status icons/text. [1] [2] [3] [4] [5]

Testing Improvements:

  • Added a new test suite in src/test/configuration.test.ts with comprehensive unit tests for configuration loading, validation, status calculation, and change watching.
  • Enhanced provider tests in src/test/providers/codeLensProvider.test.ts to mock and verify configuration handling via the new manager. [1] [2]

…sion

Signed-off-by: GitHub <noreply@github.com>
…guration

Signed-off-by: GitHub <noreply@github.com>
Copilot AI review requested due to automatic review settings September 15, 2025 11:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a centralized configuration management system for the cognitive complexity extension, improving type safety, maintainability, and testability of configuration handling.

  • Adds ConfigurationManager class with type-safe access to extension settings and validation
  • Refactors ComplexityCodeLensProvider to use centralized configuration management
  • Expands package.json with formal extension configuration schema for VS Code settings UI

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/configuration.ts New configuration manager with type-safe access, validation, and change watching
src/providers/codeLensProvider.ts Refactored to use ConfigurationManager instead of direct workspace configuration access
src/test/configuration.test.ts Comprehensive test suite for configuration management functionality
src/test/providers/codeLensProvider.test.ts Updated provider tests to mock ConfigurationManager
package.json Added formal configuration schema for VS Code settings UI

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/test/providers/codeLensProvider.test.ts
Comment thread src/test/providers/codeLensProvider.test.ts
@askpt askpt merged commit 35cffaf into main Sep 15, 2025
4 checks passed
@askpt askpt deleted the askpt/add-configuration branch September 15, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants