Skip to content

Init config command added to create a default config#70

Merged
floriankraemer merged 4 commits into
masterfrom
init-config
May 23, 2026
Merged

Init config command added to create a default config#70
floriankraemer merged 4 commits into
masterfrom
init-config

Conversation

@floriankraemer
Copy link
Copy Markdown
Contributor

@floriankraemer floriankraemer commented May 23, 2026

  • Adds bin/phpcca init to scaffold a project-local cca.yaml with schema-valid defaults, supporting interactive prompts, --silent, --path, and --force.
  • Introduces automatic config discovery: analyse and churn load ./cca.yaml from the working directory when present; explicit --config still takes precedence.
  • Updates CI to test PHP 8.5 and streamlines the PHP 8.3 Docker image build.

- Added `InitCommand` to create a default `cca.yaml` configuration file with options for silent and interactive modes.
- Introduced `ConfigFileResolver` to handle automatic discovery of configuration files in the working directory.
- Updated `ChurnCommandContext` and `CognitiveMetricsCommandContext` to utilize the new configuration file management.
- Enhanced documentation in `README.md` and `Configuration.md` to reflect the new configuration setup process.
- Added unit tests for the new configuration functionalities and command behaviors.
- Consolidated apt-get commands to reduce image size by cleaning up package lists.
- Updated xdebug configuration commands to a single RUN instruction for efficiency.
- Changed git configuration to system-wide for better accessibility.
- Enhanced user creation command to ensure home directory and permissions are set correctly.
- Set the working directory to /app for improved container organization.
- Changed variable name from `$io` to `$style` for clarity and consistency.
- Updated all references to the SymfonyStyle instance within the `InitCommand` class.
- Improved readability of the code by maintaining a uniform naming convention.
@floriankraemer floriankraemer changed the title Init config Init config command added to create a default config May 23, 2026
@floriankraemer floriankraemer merged commit 7fd0b66 into master May 23, 2026
5 checks passed
@floriankraemer floriankraemer deleted the init-config branch May 24, 2026 12:23
floriankraemer added a commit that referenced this pull request May 25, 2026
* Add Understandability Metrics and Reporting (#70)

This commit introduces a new set of metrics focused on understandability, enhancing the cognitive analysis capabilities. Key changes include:

- Added `UnderstandabilityMetrics` and `UnderstandabilityCalculator` for calculating and summarizing understandability metrics.
- Integrated understandability metrics into the existing cognitive metrics framework.
- Updated configuration options to enable the display of understandability metrics in reports.
- Enhanced the reporting system to include understandability in the output format.
- Added tests to ensure the correctness of the new understandability features.

These changes aim to provide deeper insights into code complexity and maintainability, aligning with modern coding standards.

* Enhance understandability metrics handling and improve type validation

- Added new methods in `UnderstandabilityMetrics` for resolving risk levels and count values, improving data handling and robustness.
- Updated `Parser` class to include understandability metrics in the analysis process.
- Enhanced `CombinedMetricsVisitor` with type annotations for the `getMethodUnderstandability` method.
- Added suppression warnings in `UnderstandabilityVisitor` for excessive complexity and method count, promoting cleaner code practices.

* Add Understandability documentation for Sonar Cognitive Complexity

- Introduced a new document, Understandability.md, detailing the Sonar Cognitive Complexity metric.
- Explained the calculation method, risk levels, and configuration options for enabling understandability metrics.
- Provided references to relevant literature and resources for further reading on cognitive complexity.

* Refactor understandability calculations and visitor logic for improved clarity

- Updated `UnderstandabilityCalculator` to skip low complexity methods, enhancing risk categorization.
- Refined `UnderstandabilityVisitor` logic to return early for ignored classes and non-relevant nodes, improving code readability and maintainability.
- Adjusted nesting and logical operator handling to streamline flow and reduce unnecessary checks.

* Update cache versioning in CognitiveMetricsCollector and enhance understandability output

- Introduced a new constant `CACHE_VERSION` in `CognitiveMetricsCollector` to manage cache versioning effectively.
- Updated cache item versioning to use the new constant, ensuring stale entries are ignored when the analysis result shape changes.
- Enhanced the understandability output in various test files by updating complexity ratings, improving clarity in metrics reporting.
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.

1 participant