-
-
Notifications
You must be signed in to change notification settings - Fork 158
Autofix #228
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
Autofix #228
Conversation
|
@evgeniy-r Thank you for your contribution! 🚀 This PR has a lot of changes. I guess I need more time to review this feature. |
I'd like to minimize the changes in this PR, so I suppose to transfer this item to another PR. |
I'm agree, I will do it in a couple of days. |
|
@DDtKey, thank you for feedback!
Important question. Yes, I experimented a bit and I'm sure that it will be possible to implement all existing checks based on this approach.
Sometimes (in several checks) we will work with the entire line entry collection and will use warnings only for indication (
I’ll think it over, but it seems to me that in terms of performance, checking first and then fixing is not a problem. On the other hand, we clearly link checks and fixes now.
For some checks, this is true, for others - not. |
|
I apologize, I deleted the question before I received the answer, because I answered myself to some extent 😞 I will return it to leave a story:
@evgeniy-r Thanks for the detailed answer, I agree that the approach justifies itself. |
|
I have splitted this PR into two (#234). |
|
@evgeniy-r The PR #234 has been merged. Please, update this PR. |
|
I have updated PR. |
|
I changed the output format and there is no need in |
|
Also there is some problem with tests on Windows platform - I will look in more detail. |
I have fixed tests, everything is OK. |
Codecov Report
@@ Coverage Diff @@
## master #228 +/- ##
==========================================
- Coverage 97.35% 97.14% -0.21%
==========================================
Files 16 18 +2
Lines 1510 1679 +169
==========================================
+ Hits 1470 1631 +161
- Misses 40 48 +8
Continue to review full report at Codecov.
|
|
I seem to have answered all the comments. |
|
I think, we should use something like that: This solves the problem of unique names and concurrency. |
👍 It is an excellent finding! |
|
I added |
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.
Thanks for this improvement (tempdir)!
I have only one comment left
Co-authored-by: Grachev Mikhail <work@mgrachev.com>
Co-authored-by: Grachev Mikhail <work@mgrachev.com>
OK, I will take a look. |
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.
LGTM 👍
|
@evgeniy-r Thanks a lot! 🙏 You've done a great job! 🔥 |
|
You are welcome! |
I have implemented automatic correction of the contents of files based on the results of the check.
When displaying, all warnings are marked as Fixed or Unfixed.
If all warnings are fixed, exit code is 0.
Just one kind of checks is fixable for now (LowercaseKey), but I have create the scaffold for implementing all kinds of checks.
The CLI key for the autofix mode is
-f/--fix.A few comments about the design:
The separate trait
Fixwas made for fixes (I tried to keep some symmetry withchecks), but it is possible to expand the traitCheckitself with this functions too.There are two groups of fixes: some can be implemented by working only with the line that caused warning, for others you need to work with the entire line collection.
The
Fixtrait allows you to work with both groups of fixes due to default function implementations.✔ Checklist: