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

Use GitAlg.findFilesContaining in ScannerAlg #3215

Merged
merged 3 commits into from
Nov 30, 2023

Conversation

fthomas
Copy link
Member

@fthomas fthomas commented Nov 17, 2023

This implements the idea mentioned in #2994 (comment)

ScannerAlg now uses GitAlg.findFilesContaining instead of our own FileAlg.findFiles to find files that contain versions and groupIds. This simplifies findPathsContaining because we do not need the gitignore dependency anymore to skip files that are ignored by Git since git grep, which is used by GitAlg.findFilesContaining, does this automatically for us.

The biggest impact of this change in the code base is in the tests. EditAlgTest and RewriteTest now need to actually execute git grep to find files that should be edited. For this, the execCommands flag is used (#3005) and Git repositories are created for these tests. One advantage of this change is that we mock less and the MockState traces are closer to what Steward is actually doing in production.

Copy link

codecov bot commented Nov 17, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1a9c3c1) 91.12% compared to head (5bfe93a) 91.06%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3215      +/-   ##
==========================================
- Coverage   91.12%   91.06%   -0.07%     
==========================================
  Files         163      163              
  Lines        3404     3391      -13     
  Branches      311      308       -3     
==========================================
- Hits         3102     3088      -14     
- Misses        302      303       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This implements the idea mentioned in
#2994 (comment)

`ScannerAlg` now uses `GitAlg.findFilesContaining` instead of our own
`FileAlg.findFiles` to find files that contain versions and groupIds.
This simplifies `findPathsContaining` because we do not need the gitignore
dependency anymore to skip files that are ignored by Git since `git grep`,
which is used by `GitAlg.findFilesContaining`, does this automatically
for us.

The biggest impact of this change in the code base is in the tests.
`EditAlgTest` and `RewriteTest` now need to actually execute `git grep`
to find files that should be edited. For this, the `execCommands`
flag is used (#3005) and Git repositories are created for these tests.
One advantage of this change is that we mock less and the `MockState`
traces are closer to what Steward is actually doing in production.
@fthomas fthomas force-pushed the topic/use-git-grep-in-scanner branch from 5386042 to c5589ff Compare November 17, 2023 08:50
@@ -67,6 +67,10 @@ jobs:
- name: Check that workflows are up to date
run: sbt githubWorkflowCheck

- uses: coursier/setup-action@v1
with:
apps: scalafmt
Copy link
Member Author

@fthomas fthomas Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed since RewriteTest."applyUpdate with scalafmt update" now actually executes scalafmt.

@fthomas fthomas added this to the 0.28.0 milestone Nov 30, 2023
@fthomas fthomas merged commit 57f91b2 into main Nov 30, 2023
9 of 10 checks passed
@fthomas fthomas deleted the topic/use-git-grep-in-scanner branch November 30, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant