Skip to content

Added Sorting & Filtering

Choose a tag to compare

@floriankraemer floriankraemer released this 08 Sep 19:35
· 32 commits to master since this release
0f04916

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