Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] add tracing information to ast-grep CLI #905

Open
HerringtonDarkholme opened this issue Feb 2, 2024 Discussed in #904 · 1 comment
Open

[feature] add tracing information to ast-grep CLI #905

HerringtonDarkholme opened this issue Feb 2, 2024 Discussed in #904 · 1 comment
Labels
enhancement New feature or request

Comments

@HerringtonDarkholme
Copy link
Member

Discussed in #904

Originally posted by zephraph February 1, 2024
When I run sg scan I really have no idea what's happening. I don't know if the rules I want to run are actually being run or what files or actually being checked. It'd be nice to add some default logging to give a little more visibility into what's happen. (I do know about the interactive mode which is incredibly helpful when your rules are actually working 😅)

As an external example, when you run deno fmt in a project and it makes no changes it'll print (as an example) Checked 32 files. If a file is modified, it'll print the path to each file changed before printing the number of checked files.

It would be nice if sg scan printed something like Scanned 32 files for 3 rules. It would be further helpful if there was a verbose or debug flag that printed the rules being ran and the files it was scanning for each. This could even be helpful in the single file scan mode.

@HerringtonDarkholme
Copy link
Member Author

HerringtonDarkholme commented Sep 29, 2024

We will need several different level of verbosity to help users understanding what is happening with ast-grep.
My initial thinking will include these levels:

  • Summary level: show how many files are scanned, how many matches and etc for one CLI run. Included stats
    • number of rules used in this scan and skipped rules (due to severity: off)
    • number file scanned
    • number file matched
  • Entity level: show how a file/rule is scanned
    • file
      • reasons if skipped (file too large, does not have fixed string in pattern, no matching rule, etc)
      • number of rules applied
      • rules skipped (dues to ignore/files)
    • Rule level: show how a rule scans files
      • number of files applied
  • Detail level: show how a rule runs on a file

As an MVP, only summary level will be supported.

HerringtonDarkholme added a commit that referenced this issue Sep 30, 2024
HerringtonDarkholme added a commit that referenced this issue Sep 30, 2024
HerringtonDarkholme added a commit that referenced this issue Oct 5, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 5, 2024
HerringtonDarkholme added a commit that referenced this issue Oct 5, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 5, 2024
@HerringtonDarkholme HerringtonDarkholme changed the title [feature] Verbose logging or some way to see what's happening [feature] add tracing information to ast-grep CLI Oct 6, 2024
@github-project-automation github-project-automation bot moved this to Not Started in ast-grep's roadmap Nov 3, 2024
@HerringtonDarkholme HerringtonDarkholme moved this from Not Started to Todo in ast-grep's roadmap Nov 3, 2024
@HerringtonDarkholme HerringtonDarkholme added the enhancement New feature or request label Nov 3, 2024
HerringtonDarkholme added a commit that referenced this issue Nov 4, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant