Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

Adds statistics mode for analyzing rule usefulness across large codebases. Addresses #28.

Changes

  • Add --output-summary-stats-only flag to resyntax analyze command
  • When no --refactoring-rule filter: prints matches grouped by rule
  • When --refactoring-rule filter given: prints matches grouped by file

Example

# Matches per rule
$ resyntax analyze --directory src --output-summary-stats-only
resyntax: --- summary statistics (matches per rule) ---

  nested-and-to-flat-and: 42 matches
  nested-or-to-flat-or: 17 matches

  Total: 59 matches across 2 rules

# Matches per file (with rule filter)
$ resyntax analyze --directory src --refactoring-rule nested-and-to-flat-and --output-summary-stats-only
resyntax: --- summary statistics (matches per file) ---

  src/foo.rkt: 25 matches
  src/bar.rkt: 17 matches

  Total: 42 matches
Original prompt

This section details on the original issue you should resolve

<issue_title>Statistics mode</issue_title>
<issue_description>It's hard to tell whether a rule will actually be useful. It should be possible to run rules over a large corpus of existing code and gather statistics about how many times they'd be applied, possibly with a sample of application sites. Ideally this would be easy for people other than me to use, in order to help others come up with good rules. Possible corpus candidates include:

  • Racket itself. Already installed, so no need to download anything (assuming the source code is still around for macro expansion purposes).
  • Scribble. It's big, old, it's a single package (scribble-lib), and it hasn't seen much maintenance love over the years.
  • The entire package catalog.</issue_description>

Comments on the Issue (you are @copilot in this section)

@jackfirth Now that the `--refactoring-rule` option is implemented to filter the refactoring suite down to a specific rule, this would be even more useful. This should be implemented with a `--output-summary-stats-only` CLI option for `resyntax analyze` which should print out the total number of matches per rule, if no `--refactoring-rule` filter is given. If that filter _is_ given, then it should print out the number of matches of that rule _per file_.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 28, 2025 17:12
Co-authored-by: jackfirth <8175575+jackfirth@users.noreply.github.com>
Co-authored-by: jackfirth <8175575+jackfirth@users.noreply.github.com>
Copilot AI changed the title [WIP] Add statistics mode for rule application analysis Add --output-summary-stats-only option to resyntax analyze Nov 28, 2025
Copilot AI requested a review from jackfirth November 28, 2025 17:16
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.

Statistics mode

2 participants