Skip to content

Releases: Phauthentic/cognitive-code-analysis

Release 1.11.1

24 May 13:11
36a2acd

Choose a tag to compare

1.11.1 - GitHub Action, CI Docs & Configuration Refinements

What's Changed

✨ New Features

  • GitHub Action for Pull Request Analysis by @floriankraemer in #72

    • Added a composite GitHub Action in a dedicated repository: cognitive-code-analysis-github-action
    • Install via PHAR download or existing Composer binary (install-mode: phar | composer)
    • Analyses changed .php files on pull requests (comma-separated path support)
    • Configurable PR comments, workflow annotations, artifacts, SARIF upload, and optional threshold failure
    • Example workflow added to this repository: .github/workflows/cognitive-code-analysis.yaml
    • Use Phauthentic/cognitive-code-analysis-github-action@v1 in consumer projects
  • Runtime Configuration Feedback by @floriankraemer in #72

    • analyse and churn now print the active config source and cache status at startup
    • Example console output:
      Config: ./phpcca.yaml
      Cache: enabled
      
    • New RuntimeStatusRenderer class used by both Cognitive and Churn configuration pipeline stages
    • Relative paths are shown when the config file is inside the working directory
  • CI Integration Guide by @floriankraemer in #72

    • New docs/CI-Integration.md with end-to-end CI setup documentation
    • GitHub Actions workflow examples (Markdown PR comments, SARIF upload, artifacts)
    • GitLab CI workflow examples (merge request notes, Code Quality widget)
    • Correct comma-separated path usage for analysing multiple changed files in one invocation
    • Linked from readme.md

🔧 Configuration Enhancements

  • Standardized Config Filename: phpcca.yaml by @floriankraemer in #72

    • Renamed bundled project config from config.yml to phpcca.yaml
    • bin/phpcca init now creates phpcca.yaml in the current directory (was cca.yaml in 1.11.0)
    • Auto-discovery updated: analyse and churn load ./phpcca.yaml when present
    • Explicit --config always takes precedence over auto-discovery
    • PHAR bundle (box.json.dist), ConfigService, and ConfigInitializer updated to reference phpcca.yaml
  • Focused Default Output by @floriankraemer in #72

    • Bundled phpcca.yaml sets showOnlyMethodsExceedingThreshold: true by default
    • Console and Markdown output focus on methods exceeding scoreThreshold
    • Reduces noise in local runs and CI reports when using the default configuration

🏗️ Architecture Improvements

  • Configuration Pipeline Refactoring by @floriankraemer in #72

    • Simplified ConfigurationStage in both Cognitive and Churn pipelines
    • Centralized runtime status rendering via RuntimeStatusRenderer
    • Clearer error handling when configuration loading fails

🧪 Testing & Quality Assurance

  • Updated Golden-File Tests by @floriankraemer in #72

    • Console output fixtures updated to include Config: and Cache: status lines
    • CognitiveMetricsCommandCoverageTest uses an explicit test config to avoid coupling to bundled defaults
    • Added RuntimeStatusRendererTest for built-in config, relative path, and absolute path formatting
    • Updated InitCommandTest and ConfigInitializerTest for phpcca.yaml naming

📚 Documentation

  • Configuration & README Updates by @floriankraemer in #72

    • docs/Configuration.md updated for phpcca.yaml naming and auto-discovery
    • readme.md updated with init workflow and phpcca.yaml references
    • docs/CI-Integration.md documents GitHub Action usage alongside manual workflow snippets

Changes

Full Changelog: 1.11.0...1.11.1

Key Highlights

  • One-Line CI Setup: The new GitHub Action lets teams add cognitive complexity checks to pull requests without writing shell scripts
  • Clearer Runtime Feedback: Config source and cache status are visible at the start of every analyse and churn run
  • Consistent Config Naming: phpcca.yaml is now the single recommended filename for project configuration, init output, and auto-discovery
  • Less Noisy Defaults: Threshold filtering is enabled in the bundled config so reports highlight methods that actually need attention
  • CI Documentation: A dedicated integration guide covers GitHub Actions, GitLab CI, report formats, and changed-file analysis

Migration Guide

If you're upgrading from 1.11.0, please note:

  1. Rename Your Config File: If you use cca.yaml or config.yml, rename it to phpcca.yaml (or keep your filename and pass --config explicitly)
  2. Init Output Changed: bin/phpcca init now creates phpcca.yaml instead of cca.yaml
  3. Auto-Discovery Updated: analyse and churn look for ./phpcca.yaml in the working directory when --config is omitted
  4. Default Filtering: The bundled config enables showOnlyMethodsExceedingThreshold: true — set it to false in your phpcca.yaml if you want all methods listed
  5. GitHub Action Available: For PR workflows, consider cognitive-code-analysis-github-action@v1 instead of maintaining a custom workflow
  6. No Breaking CLI Changes: All existing commands, report types, and --config behaviour remain compatible

Example Usage

Project Setup

bin/phpcca init                  # interactive setup → creates phpcca.yaml
bin/phpcca init --silent         # non-interactive, all defaults
bin/phpcca init --path=./phpcca.yaml

Analyse with Auto-Discovered Config

bin/phpcca analyse src/          # auto-loads ./phpcca.yaml when present
bin/phpcca analyse src/ --config=custom.yaml  # explicit config overrides auto-discovery

GitHub Action (New)

# .github/workflows/cognitive-code-analysis.yaml
name: Cognitive Code Analysis

on:
  pull_request:
    paths:
      - '**/*.php'

permissions:
  pull-requests: write
  contents: read

jobs:
  analyse:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - uses: Phauthentic/cognitive-code-analysis-github-action@v1
        with:
          install-mode: phar
          post-comment: true
          upload-artifact: true
          emit-annotations: true

Analyse Multiple Changed Files in CI

CHANGED_FILES=$(git diff --name-only --diff-filter=ACMR $BASE_SHA...$HEAD_SHA | grep '\.php$' | tr '\n' ' ')
ANALYSE_PATH=$(echo "$CHANGED_FILES" | tr ' ' ',')
bin/phpcca analyse "$ANALYSE_PATH" --report-type=markdown --report-file=cca-report.md

See docs/CI-Integration.md and docs/Configuration.md for complete documentation.

Contributors

Release 1.11.0

23 May 15:31

Choose a tag to compare

1.11.0 - CI Integration, Project Setup & Baseline Tracking

What's Changed

✨ New Features

  • Init Command & cca.yaml Auto-Discovery by @floriankraemer in #70
    • Added bin/phpcca init to scaffold a project configuration file
    • Interactive mode prompts for key settings with explanatory text before each question
    • --silent flag skips prompts and uses schema defaults
    • --path / -p to specify the target file (default: ./cca.yaml in the current directory)
    • --force / -f to overwrite an existing config file
    • Automatic config discovery: analyse and churn load ./cca.yaml when present
    • Explicit --config always takes precedence over auto-discovery
    • New InitCommand, ConfigInitializer, and ConfigFileResolver classes
  • CI Report Formats by @floriankraemer in #68
    • Added Checkstyle XML report for Jenkins, Maven Checkstyle Plugin, and IDEs
    • Added JUnit XML report for Jenkins JUnit plugin and Maven Surefire
    • Added SARIF 2.1.0 report for GitHub Code Scanning
    • Added GitLab Code Quality report (CodeClimate-style JSON) for GitLab merge request widgets
    • Added GitHub Actions report with ::warning / ::error workflow commands for inline PR annotations
    • Methods exceeding scoreThreshold are reported as violations or failures
  • Baseline Tracking Overhaul by @floriankraemer in #66
    • Introduced baseline format v2.0 with metadata (version, createdAt, configHash, metrics)
    • Auto-detection of the latest baseline file in ./.phpcca/baseline/baseline-*.json
    • Auto-generation of timestamped baseline files via --generate-baseline / -g
    • JSON Schema validation against schemas/baseline.json (Draft 7)
    • Config hash validation with warnings when metric weights differ from the baseline
    • Expanded metric coverage in baseline files (counts, weights, and score per method)
    • Backward-compatible support for legacy baseline JSON format
    • Comprehensive documentation in docs/Baseline-Analysis.md
  • Optional Result Cache by @floriankraemer in #56
    • Added PSR-6 file-based cache to speed up consecutive analysis runs
    • Caches per-file metric results in ./.phpcca.cache (configurable)
    • Enabled by default in bundled config.yml; set cache.enabled: false to disable
    • New FileCache, CacheItem, and CacheConfig classes
    • Added psr/cache as a direct dependency
  • Single-Table HTML and Markdown Reports by @floriankraemer in #69
    • HTML and Markdown reports now honour groupByClass: false
    • HTML renders one table with a Class column when grouping is disabled
    • Markdown renders a flat "All Methods" table with class included per row
    • Aligns report output with console behaviour introduced in 1.4.0

🏗️ Architecture Improvements

  • Command Pipeline Pattern by @floriankraemer in #66, #69, #70
    • Replaced handler-based command flow with explicit pipeline stages
    • Cognitive analyse pipeline: Validation → Configuration → Coverage → Metrics Collection → Baseline → Sorting → Baseline Generation → Report Generation → Output
    • Churn pipeline: Validation → Configuration → Coverage → Calculation → Report Generation → Output
    • New CommandPipeline, ChurnPipeline, ExecutionContext, and PipelineStage abstractions
    • Stage timing and statistics available in debug mode (--debug)
    • Removed legacy handler classes (BaselineHandler, ConfigurationLoadHandler, SortingHandler, etc.)
  • Streaming Report Generation by @floriankraemer in #66, #69
    • Introduced StreamableReportInterface with startReport(), writeMetricBatch(), and finalizeReport()
    • Implemented by CSV, JSON, and Markdown reporters for incremental writes on large codebases
    • Configurable flush interval via performance.batchSize (default: 100)
  • Baseline Domain Model Refactoring by @floriankraemer in #66
    • Extracted Baseline, BaselineFile, and BaselineSchemaValidator from monolithic baseline logic
    • Added FilenameNormalizer utility for consistent reporter filenames
    • Improved type safety and separation of concerns across baseline operations

🧪 Testing & Quality Assurance

  • Comprehensive Test Coverage by @floriankraemer in #56, #66, #68, #69, #70
    • Added InitCommandTest for silent, interactive, force, and validation scenarios
    • Added ConfigFileResolverTest and ConfigInitializerTest for config scaffolding
    • Added ConfigAutoDiscoveryTest for automatic cca.yaml loading in analyse and churn
    • Added reporter tests for all five CI formats:
      • CheckstyleReporterTest
      • JUnitReporterTest
      • SarifReporterTest
      • GitHubActionsReporterTest
      • GitLabCodeQualityReporterTest
    • Added cache tests: FileCacheTest, CacheItemTest, CacheExceptionTest
    • Updated HTML and Markdown approval tests for single-table output
    • Updated BaselineServiceTest for baseline v2.0 format

📚 Documentation

  • Baseline Analysis Guide by @floriankraemer in #66
    • New docs/Baseline-Analysis.md with comprehensive baseline usage documentation
    • Covers auto-detection, auto-generation, schema validation, and config hash warnings
    • Documents baseline v2.0 format and legacy compatibility
  • Configuration & Setup Guide by @floriankraemer in #70
    • Updated docs/Configuration.md with init command and cca.yaml auto-discovery
    • Updated readme.md with setup workflow, new report types, and cross-language links
    • Added links to C# and Java versions

🔧 Configuration Enhancements

  • Cache Configuration by @floriankraemer in #56
    • Added cache section to config.yml:
      • enabled (default: true)
      • directory (default: ./.phpcca.cache)
    • Added .phpcca.cache/ to .gitignore
  • Performance Configuration by @floriankraemer in #66, #69
    • Added performance.batchSize option for streaming report flush interval (default: 100)
  • Project Config via init by @floriankraemer in #70
    • cca.yaml replaces manual config file setup as the recommended project config filename
    • Interactive init prompts for: scoreThreshold, showOnlyMethodsExceedingThreshold, showHalsteadComplexity, showCyclomaticComplexity, showDetailedCognitiveMetrics, and groupByClass

Changes

Full Changelog: 1.10.0...1.11.0

Key Highlights

  • Guided Project Setup: The new init command and cca.yaml auto-discovery make it easy to configure and run analysis without manually writing config files
  • CI/CD Ready: Five new report formats integrate directly with Jenkins, GitHub Actions, GitHub Code Scanning, and GitLab Code Quality
  • Baseline Tracking: Redesigned baseline system with schema validation, metadata, auto-detection, and expanded metric coverage
  • Faster Repeated Runs: Optional PSR-6 file cache skips unchanged files on subsequent analysis runs
  • Pipeline Architecture: Handler classes replaced by explicit, extensible command pipeline stages with debug timing
  • Consistent Report Layout: HTML and Markdown exports now support single-table output via groupByClass: false

Migration Guide

If you're upgrading from 1.10.0, please note:

  1. No Breaking Changes: All existing functionality remains compatible — commands, config options, and custom reporters continue to work unchanged
  2. Recommended Setup: Run bin/phpcca init once per project to create a cca.yaml instead of maintaining a hand-written config file
  3. Auto-Discovery: When cca.yaml exists in the working directory, --config is no longer required for analyse and churn
  4. Cache Enabled by Default: Review cache.enabled in your config; add .phpcca.cache/ to .gitignore if not already present
  5. Regenerate Baselines: Run --generate-baseline to create v2.0 baseline files with metadata and schema validation
  6. CI Integration: New report types (checkstyle, junit, sarif, gitlab-codequality, github-actions) are optional — existing JSON/CSV/HTML/Markdown workflows are unchanged

Example Usage

Project Setup (New)

bin/phpcca init                  # interactive setup → creates cca.yaml
bin/phpcca init --silent         # non-interactive, all defaults
bin/phpcca init --path=./cca.yaml

Analyse with Auto-Discovered Config

bin/phpcca analyse src/          # auto-loads ./cca.yaml when present
bin/phpcca analyse src/ --config=custom.yaml  # explicit config overrides auto-discovery

CI Report Formats (New)

bin/phpcca analyse src/ --report-type checkstyle --report-file checkstyle.xml
bin/phpcca analyse src/ --report-type junit --report-file junit.xml
bin/phpcca analyse src/ --report-type sarif --report-file results.sarif
bin/phpcca analyse src/ --report-type gitlab-codequality --report-file gl-code-quality.json
bin/phpcca analyse src/ --report-type github-actions --report-file -

Baseline Tracking (Enhanced)

# Generate a timestamped baseline
bin/phpcca analyse src/ --generate-baseline

# Compare against a specific baseline
bin/phpcca analyse src/ --baseline=./.phpcca/baseline/baseline-2025-01-18_14-30-45.json

# Auto-detect latest baseline in ./.phpcca/baseline/
bin/phpcca analyse src/

Single-Table Report...

Read more

1.10.0 - Custom Reporters & Architecture Improvements

14 Oct 20:13
ff4f2c5

Choose a tag to compare

What's Changed

✨ New Features

  • Custom Reporters Support by @floriankraemer in #61
    • Added comprehensive extensibility framework for creating custom reporters
    • Support for both cognitive metrics and churn metrics reporters
    • New ReporterRegistry class for managing and loading custom reporters
    • Configuration support via config.yml for registering custom reporters
    • Automatic detection of constructor requirements (with or without CognitiveConfig)
    • Support for both autoloaded classes and file-based reporters
    • Comprehensive documentation in docs/Creating-Custom-Reporters.md

🏗️ Architecture Improvements

  • Terminology Refactoring: Exporters → Reports by @floriankraemer in #61

    • Renamed all "Exporter" classes to "Report" for better semantic clarity
    • Migrated Business/Churn/Exporter/Business/Churn/Report/
    • Migrated Business/Cognitive/Exporter/Business/Cognitive/Report/
    • Updated interface names: DataExporterInterfaceReportGeneratorInterface
    • Improved naming consistency across the codebase
  • Enhanced Factory Pattern Implementation by @floriankraemer in #61

    • Introduced ChurnReportFactory and ChurnReportFactoryInterface
    • Introduced CognitiveReportFactory and CognitiveReportFactoryInterface
    • Removed legacy ChurnExporterFactory and CognitiveExporterFactory
    • Better separation of concerns with dedicated factory interfaces
    • Support for dynamic reporter registration and instantiation
  • Specification Pattern for Command Validation by @floriankraemer in #61

    • Implemented comprehensive validation using Specification Pattern
    • New command context classes: ChurnCommandContext, CognitiveMetricsCommandContext
    • Composite specifications for complex validation logic:
      • CompositeChurnSpecification
      • CompositeCognitiveMetricsValidationSpecification
    • Individual specification classes for focused validation:
      • CoverageFileExists
      • CoverageFormatSupported
      • CoverageFormatExclusivity
      • CustomExporterValidation
      • SortFieldValid
      • SortOrderValid
      • ReportOptionsComplete
    • Validation specification factories for both commands
    • Improved error messages and validation feedback
  • Command Handler Refactoring by @floriankraemer in #61

    • Introduced dedicated handler classes for better separation of concerns
    • New handlers for cognitive analysis:
      • BaselineHandler - Handles baseline comparison logic
      • ConfigurationLoadHandler - Manages configuration loading
      • CoverageLoadHandler - Handles coverage data loading
      • SortingHandler - Manages metrics sorting
    • Enhanced ChurnReportHandler and CognitiveMetricsReportHandler
    • Simplified command classes by delegating to specialized handlers
  • Enhanced Data Models by @floriankraemer in #61

    • Introduced ChurnMetrics class for better data encapsulation
    • Introduced ChurnMetricsCollection for collection management
    • New OperationResult class for standardized command results
    • Improved type safety and data structure consistency
  • Code Organization Improvements by @floriankraemer in #61

    • Moved DirectoryScanner to Business/Utility/ namespace
    • Moved CoverageDataDetector to Business/Utility/ namespace
    • Better logical grouping of utility classes
    • Improved namespace structure

🧪 Testing & Quality Assurance

  • Comprehensive Test Coverage by @floriankraemer in #61
    • Added 1,000+ lines of new test coverage
    • New test fixtures for custom reporters:
      • ConfigAwareChurnTextReporter
      • ConfigAwareTextReporter
      • CustomChurnTextReporter
      • CustomTextReporter
    • Comprehensive tests for specification pattern:
      • ChurnSpecificationPatternTest
      • CognitiveMetricsSpecificationPatternTest
    • Factory pattern tests:
      • ChurnReporterFactoryCustomTest
      • CognitiveReporterFactoryCustomTest
    • Configuration tests:
      • CustomExportersConfigTest
    • Command tests:
      • Enhanced ChurnCommandTest
      • Enhanced CognitiveMetricsCommandTest
    • Reporter registry tests:
      • ExporterRegistryTest
    • Custom reporter integration tests:
      • MetricsFacadeCustomExportersTest

📚 Documentation

  • Creating Custom Reporters Guide by @floriankraemer in #61
    • Comprehensive 287-line documentation for custom reporter development
    • Detailed examples for both cognitive and churn reporters
    • Configuration guidelines and best practices
    • Constructor pattern explanations
    • Troubleshooting section
    • Built-in reporter reference

🔧 Configuration Enhancements

  • Custom Reporters Configuration by @floriankraemer in #61
    • Added customReporters section to config.yml
    • Support for cognitive and churn reporter registration
    • Flexible configuration with optional file paths
    • Example configuration in default config file

Changes

Full Changelog: 1.9.0...1.10.0

Key Highlights

  • Major Extensibility Enhancement: The custom reporters feature allows developers to create their own output formats without modifying the core codebase
  • Improved Architecture: Comprehensive refactoring with better separation of concerns, specification pattern validation, and enhanced factory patterns
  • Better Code Organization: Terminology improvements (Exporters → Reports) and logical namespace restructuring
  • Robust Testing: Over 1,000 lines of new test coverage ensuring reliability of the new features
  • Developer-Friendly: Comprehensive documentation and examples make it easy to create custom reporters

Migration Guide

If you're upgrading from 1.9.0, please note:

  1. No Breaking Changes: All existing functionality remains compatible
  2. Optional Feature: Custom reporters are entirely optional - existing workflows continue to work unchanged
  3. Configuration: If you want to use custom reporters, add the customReporters section to your config.yml (see documentation)
  4. Internal API Changes: If you've extended the codebase, note that "Exporter" classes have been renamed to "Report" classes

Example Usage

Using Built-in Reports (Unchanged)

# Cognitive metrics
bin/phpcca analyse ./src --format=json --output=report.json

# Churn metrics
bin/phpcca churn ./src --format=html --output=churn.html

Using Custom Reporters (New)

# config.yml
cognitive:
  customReporters:
    cognitive:
      pdf:
        class: 'My\Custom\PdfReporter'
        file: '/path/to/PdfReporter.php'
bin/phpcca analyse ./src --format=pdf --output=report.pdf

See docs/Creating-Custom-Reporters.md for complete documentation.

1.9.0 - Code Coverage Integration & Architecture Improvements

13 Oct 21:00
28d0dea

Choose a tag to compare

What's Changed

✨ New Features

  • Code Coverage Support for CognitiveMetrics Command by @floriankraemer in #57
    • Added comprehensive code coverage integration to the cognitive metrics analysis
    • Support for both Clover XML and Cobertura XML coverage formats
    • Enhanced metrics display with coverage information
    • New command-line options: --coverage-cobertura and --coverage-clover
    • Improved risk assessment by factoring in test coverage data

🏗️ Architecture Improvements

  • Refactoring Cyclomatic Complexity Calculation by @floriankraemer in #64

    • Extracted cyclomatic complexity logic into dedicated CyclomaticComplexityCalculator class
    • Improved separation of concerns and code maintainability
    • Enhanced testability with dedicated calculator interface
    • Better encapsulation of complexity calculation algorithms
  • Extracting Halstead Calculations from the Visitor by @floriankraemer in #63

    • Created dedicated HalsteadMetricsCalculator class for cleaner architecture
    • Separated calculation logic from AST visitor pattern
    • Improved code organization and reusability
    • Enhanced test coverage for Halstead metrics calculations

🔧 Code Quality & Standards

  • Adding PHPCS Slevomat Coding Standard Rules by @floriankraemer in #62
    • Integrated Slevomat Coding Standard for enhanced code quality
    • Added comprehensive PHPCS rules including:
      • Unused imports detection
      • Useless variable detection
      • Early exit enforcement
      • Yoda comparison disallowance
      • Useless documentation detection
    • Improved code consistency across the project

📚 Documentation & Community

  • Github contribution and issue configuration by @floriankraemer in #59
    • Added comprehensive CONTRIBUTING.md with detailed contribution guidelines
    • Created structured issue templates for better bug reporting
    • Enhanced project documentation and community guidelines
    • Improved developer onboarding experience

Changes

Full Changelog: 1.8.0...1.9.0

Release 1.8.0 - Markdown Export & Enhanced Reporting

06 Oct 11:08
72b54e8

Choose a tag to compare

What's Changed

✨ New Features

  • Markdown Export for Cognitive Metrics by @floriankraemer in #50

    • Added comprehensive Markdown export functionality for cognitive complexity analysis
    • Support for multiple configuration scenarios (all metrics, cyclomatic only, halstead only, minimal, threshold-based)
    • Enhanced report generation with detailed formatting and table structures
    • Comprehensive test coverage with approval tests for various output scenarios
  • Markdown Export for Churn Metrics by @floriankraemer in #52

    • Added Markdown export functionality for churn analysis reports
    • Support for both standard and coverage-weighted churn metrics
    • Enhanced report formatting with detailed tables and metrics breakdown
    • Integration with existing churn analysis workflow
  • Line Number Tracking Enhancement by @floriankraemer in #51

    • Added line number tracking to CognitiveMetrics for better code location identification
    • Enhanced AST visitor to capture and store line number information
    • Improved debugging and code navigation capabilities

🐛 Bug Fixes

  • Fix Exclude Files via Config by @floriankraemer in #54
    • Fixed exclusion pattern merging in source file scanning

Changes

Full Changelog: 1.7.0...1.8.0

Release 1.7.0 - Optional Code Coverage as Factor in Churn Analysis

02 Oct 11:30
5194050

Choose a tag to compare

What's Changed

Code Coverage Integration for Churn Analysis

🎯 Enhanced Churn Analysis

  • Risk-weighted churn calculation that factors in test coverage
  • Support for multiple coverage formats: Clover XML and Cobertura XML
  • Churn risk assessment based on coverage data
  • New command-line options for coverage integration:
    • --coverage-cobertura: Path to Cobertura XML coverage file
    • --coverage-clover: Path to Clover XML coverage file

📊 Advanced Churn Metrics

  • Standard Churn: churn = timesChanged × cognitiveScore
  • Risk Churn: riskChurn = timesChanged × cognitiveScore × (1 - coverage)
  • Coverage-weighted risk levels for better prioritization

📚 Documentation & Configuration

  • Updated churn documentation with coverage integration examples
  • Enhanced configuration options for coverage analysis
  • Improved command-line help with coverage-specific options

Full Changelog: 1.6.0...1.7.0

Release 1.6.0 - Multi-Path Analysis Support

30 Sep 20:08
63384f5

Choose a tag to compare

What's Changed

✨ New Features

  • Support for multiple file and folder paths by @floriankraemer in #48
    • Added ability to pass comma-separated list of paths to analyze specific files and folders
    • Enhanced command-line interface to accept multiple paths for targeted analysis
    • Improved efficiency by allowing analysis of only changed files or specific directories
    • Added comprehensive test coverage for various path combinations (files, directories, mixed)

🔧 Code Quality & Refactoring

  • Refactor metrics collection architecture for multi-path support
    • Introduced collectFromPaths() method in CognitiveMetricsCollector for handling multiple paths
    • Added getCognitiveMetricsFromPaths() method in MetricsFacade for streamlined multi-path processing
    • Enhanced path parsing logic with robust trimming and filtering of empty paths
    • Improved code maintainability with better separation of concerns

🧪 Testing & Quality Assurance

  • Comprehensive test coverage for multi-path functionality
    • Added unit tests for collectFromPaths() method with various path combinations
    • Implemented data provider tests for command-line interface with multiple paths
    • Added test scenarios for mixed file and directory paths
    • Enhanced test coverage for edge cases including spaces and empty paths

Full Changelog: 1.5.0...1.6.0

1.5.0 - Performance Improvements & more!

24 Sep 20:46
11597c3

Choose a tag to compare

What's Changed

🐛 Bug Fixes

  • Fix analysis breaking for anonymous classes by @floriankraemer in #44
    • Improved error handling for anonymous classes during AST parsing
    • Added comprehensive test coverage for anonymous class scenarios

🎨 User Experience Improvements

  • Hide cognitive metric details in console output by @floriankraemer in #43
    • Added showDetailedCognitiveMetrics configuration option to control detailed metric display
    • Improved console output readability by making detailed metrics optional

⚡ Performance Enhancements

  • Significantly increase analysis performance by @floriankraemer in #46
    • Introduced CombinedMetricsVisitor to process all metrics in a single AST traversal
    • Eliminated multiple AST parsing passes, reducing analysis time substantially
    • Optimized visitor pattern implementation across all metric collectors

🧪 Testing & Quality Assurance

  • Add comprehensive approval tests for console output by @floriankraemer in #47

    • Implemented approval testing framework to detect unintended changes in console output
    • Added test fixtures for various configuration scenarios
    • Improved file collection and sorting consistency across platforms
  • Add PHPBench performance benchmarking by @floriankraemer in #45

    • Integrated PHPBench for continuous performance monitoring
    • Added comprehensive benchmarks for different code complexity scenarios
    • Established baseline performance metrics for future optimization

🔧 Code Quality & Refactoring

  • Refactor cognitive metrics handling and parser architecture
    • Simplified cyclomatic complexity instantiation and data handling
    • Enhanced type safety with improved type hints
    • Removed unused methods and improved code maintainability
    • Better separation of concerns in metrics collection

Full Changelog: 1.4.0...1.5.0


Key Highlights

  • Major performance improvement through single-pass AST traversal
  • Enhanced configurability with new output display options
  • Robust testing with approval tests and performance benchmarks
  • Better error handling for edge cases like anonymous classes
  • Improved code quality through refactoring and type safety enhancements

This release represents a significant step forward in both performance and reliability, making the tool more efficient and easier to configure for different use cases.

Added Sorting & Filtering

08 Sep 19:35
0f04916

Choose a tag to compare

What's Changed

New Features Added

  • Sorting functionality with command-line options --sort-by and --sort-order
  • 13 sortable fields: score, halstead, cyclomatic, class, method, lineCount, argCount, returnCount, variableCount, propertyCallCount, ifCount, ifNestingLevel, elseCount
  • Sort orders: ascending (asc) and descending (desc) with asc as default
  • Grouping by class via new groupByClass configuration option (default: true)
  • Enhanced filtering with better handling of ignored items and method filtering

Configuration Changes

  • Added groupByClass: true option to config.yml
  • Updated ConfigFactory and ConfigLoader to support the new option
    Enhanced CognitiveConfig class with groupByClass property

Documentation Updates

Full Changelog: 1.3.0...1.4.0

Example

To generate the output below these settings were used in the config.yaml and this command executed bin/phpcca analyse ./src --sort-by=score --sort-order=desc

cognitive:
  showOnlyMethodsExceedingThreshold: true
  groupByClass: false
image

1.3.0

17 Jul 18:19
14efd09

Choose a tag to compare

What's Changed

Full Changelog: 1.2.4...1.3.0