Skip to content

Provide Summaries for the Counts of Checks Across All Matched FilesΒ #8

@gkapfham

Description

@gkapfham

When the chasten tool is run on a program with multiple files, it will produce output like this:

πŸŽ‰ Performing 12 check(s):

  βœ“ id: 'CLS001', name: 'class-definition', pattern: './/ClassDef', min=None, max=None
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/lazytracker.py - 1 matches
  βœ“ id: 'FUNC001', name: 'all-function-definition', pattern: '//FunctionDef/body/Expr[value/Constant]/following-sibling::*[1] |
//FunctionDef/body[not(Expr/value/Constant)]/*[1]', min=None, max=None
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/tests/test_lazytracker.py - 6 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/tests/test_tracked.py - 2 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/lazytracker.py - 6 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/tracked.py - 3 matches
  βœ“ id: 'FUNC002', name: 'all-function-definition-with-docstring', pattern: '//FunctionDef/body/Expr[value/Constant]/following-sibling::*[1]',
min=None, max=None
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/lazytracker.py - 6 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/tracked.py - 1 matches
  βœ“ id: 'FUNC003', name: 'all-function-definition-with-no-docstring', pattern: '//FunctionDef/body[not(Expr/value/Constant)]/*[1]', min=None,
max=None
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/tests/test_lazytracker.py - 6 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/tests/test_tracked.py - 2 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/tracked.py - 2 matches
  βœ“ id: 'FUNC004', name: 'all-non-test-function-definition', pattern: '//FunctionDef[not(contains(@name,
"test_"))]/body/Expr[value/Constant]/following-sibling::*[1] | //FunctionDef[not(contains(@name, "test_"))]/body[not(Expr/value/Constant)]/*[1]',
min=None, max=None
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/tests/test_lazytracker.py - 2 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/lazytracker.py - 6 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/tracked.py - 3 matches
  βœ— id: 'FUNC004', name: 'all-test-function-definition', pattern: '//FunctionDef[starts-with(@name,
"test_")]/body/Expr[value/Constant]/following-sibling::*[1] | //AsyncFunctionDef[starts-with(@name,
"test_")]/body/Expr[value/Constant]/following-sibling::*[1] | //FunctionDef[starts-with(@name, "test_")]/body[not(Expr/value/Constant)]/*[1] |
//AsyncFunctionDef[starts-with(@name, "test_")]/body[not(Expr/value/Constant)]/*[1]', min=7, max=22
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/tests/test_lazytracker.py - 4 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/tests/test_tracked.py - 2 matches
  βœ“ id: 'CTRL001', name: 'single-nested-if-in-function', pattern: './/FunctionDef/body//If', min=None, max=None
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/lazytracker.py - 1 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/tracked.py - 7 matches
  βœ“ id: 'CTRL002', name: 'single-nested-if-anywhere-in-module', pattern: './/If', min=None, max=None
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/lazytracker.py - 1 matches
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/tracked.py - 7 matches
  βœ“ id: 'CTRL003', name: 'double-nested-if-in-function', pattern: './/FunctionDef/body//If[ancestor::If and not(parent::orelse)]', min=None,
max=None
  βœ“ id: 'CTRL004', name: 'double-nested-if-anywhere-in-module', pattern: './/If[ancestor::If and not(parent::orelse)]', min=None, max=None
  βœ“ id: 'CTRL005', name: 'single-nested-for-target', pattern: './/For/target/Name', min=None, max=None
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/lazytracker.py - 3 matches
  βœ“ id: 'CTRL006', name: 'single-nested-for-target-no-count', pattern: './/For/target/Name', min=None, max=None
    β€’ /home/gkapfham/working/source/astute-subjects/subject-forks/lazytracker/lazytracker/lazytracker.py - 3 matches

✨ Saved the file 'chasten-results-lazytracker-20230823214805-7c28a9801c25437f981cb7e2a51926f0.json'

πŸ˜“ At least one check did not pass.

This example is small enough that it is easy to tell that, for instance,
single-nested-for-target-no-count has a total of 6 matches. However, it would
be useful if the tool's command-line output has sub-totals for the number of matches for a specific check.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions