-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
Improve csharpier performance by changing cli_lint_mode to list_of_files #2198
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2198 +/- ##
==========================================
+ Coverage 82.97% 82.99% +0.02%
==========================================
Files 170 170
Lines 4469 4469
==========================================
+ Hits 3708 3709 +1
+ Misses 761 760 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
u can ignoe the trivy error ^^ |
Trivy fixed in #2200 |
If it can't take a list of files, it's probably better to run it on the whole root folder, using project cli_lint_mode, for better performances (else, calling it file by file sould be awful in big projects) Originally posted by @nvuillam in #2185 (comment) The documentation is a little vague, but it seemed to suggest that it can be passed multiple files. So, I just made a quick test with the Dapper codebase.
All of these work fine. I added the --check option for it to not change any files, and limited myself to two files, that had changes that would've been fixed. So @bdovaz, you are free to use csharpier in any cli_lint_mode, (or implement them all so a user could tune its config). Also, in the example I wrote I showed how to use the dotnet-csharpier as I think there was some kind of argument difficulties when calling it a couple days ago. Creating and maintaining a class might not have been necessary after all. When a dotnet tool is installed globally, and the tool name is prefixed with |
@nvuillam @echoix to make it clear to me:
In fact my doubt arises, "cli_lint_mode" should not be an array and add the modes supported (apart from another "cli_lint_mode_default" or similar)? cli_lint_mode:
- file
- list_of_files
- project
cli_lint_mode_default: list_of_files Because otherwise how can someone who wants to use a particular linter know? In this example you can see that it names the 3 but it doesn't mean that you can use all 3, no? If you put one that is not supported by that linter, what happens? Is there any logic to check this? https://megalinter.io/latest/descriptors/java_pmd/
cli_lint_extra_args_after:
- "." And in a new CsharpierLinter.py do something like this, no? Note: depending on how some of the questions in my message evolve, I will create other issues or PRs. |
You can use |
@nvuillam but if I put it as "list_of_files" as you say it will no longer work in "project" mode. In fact, I have to remove "cli_lint_extra_args_after" because otherwise it concatenates a "." (dotnet csharpier --check myfile.cs .) at the end and it's something I only want in "project" mode. What we want with this PR is to support all 3 modes, no? Since it is possible through the CLI it makes sense to implement it, no? About generated docs improvements I have created an issue so that it will not be forgotten: #2202 |
if |
@nvuillam But in that case isn't it better that I create a class (like JavaPmdLinter) and handle that internally? It's weird that someone has to know that he has to add an extra argument (linter specific), isn't it? It forces you to have to look at the specific documentation for that linter. By doing what I say, you could directly change the variable "CSHARP_CSHARPIER_CLI_LINT_MODE: project" and it would work without doing anything else. |
If |
@nvuillam ready for you to review and merge! |
@bdovaz plz can you add a good_2 and a bad_2 test file ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plz check comment :)
@nvuillam I have already added a second file to each test, is there anything left? |
my post was before you added the 2 files , if CI is ok you're all good :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR as usual :)
No description provided.