-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Baseline #2580
Baseline #2580
Conversation
Thanks for the PR @polszacki-tooploox! It's a very interesting idea and one that I hadn't considered in exactly this way before. This is related to the concepts of I'd be happy to discuss this further after you get all the unit tests to pass again. |
A few thoughts:
|
@jpsim thanks for the comments!
I'll look into the |
Looks like there's a test failure on SwiftPM with Xcode 10.0 https://dev.azure.com/jpsim/SwiftLint/_build/results?buildId=164 |
This idea sounds very interesting, but I have a few questions:
I feel like this feature interferes with the disabling commands and could actually replace them. But for this to happen, we would need to be able to explicitly specify which issues should be placed into the baseline. What about this: The Sorry if this doesn't sound like the initial intention, but I kinda feel like this overlaps with the disable commands. Feel free to correct me and specify the use cases for this more clearly. |
I have an iOS project that is already released at v1.0. We'd like to be able to use |
Generated by 🚫 Danger |
@Dschee
The baseline mechanism is not replacing |
@polszacki-tooploox Thanks for answering my questions, I'm convinced, what you describe makes sense. I think the use case should be very well documented though to prevent misunderstanding. Specifically the documentation should make sure that:
Other than that, I'm happy to review this feature. Thank you for bringing it up and for the PR! |
@polszacki-tooploox I have a question about how this is used in practice: how do people usually go back and fix the warnings added to the baseline? Do they delete the file? Do they open the file to read the warnings? |
@marcelofabri As I understand it, if you run the normal Or are you asking about how to update the baseline when some of the issues in there are fixed? |
Yep, I think that answers my question :)
This is a good question, would people need to delete the file manually? |
In my opinion, it would be best if any issues that are fixed are automatically removed from the baseline. That's also why I'm not a big fan of the word |
We just had a discussion with @fredpi about adding a Also it introduces the question if the baseline file should include the violations or rather the violated rules. When using this temporarily for a rule with false positives, then also new violations should be ignored. At the same time, there needs to be an option alongside the existing |
Really hoping this gets finished and merged in someday. We have an existing project with thousands of swiftlint warnings that cant be easily cleaned up without significant time investment in code and testing. Having a baseline feature (I've used several tools with a similar feature) means as the code gets refactored over time it slowly gets improved and cleaned up. @polszacki-tooploox Do you have any plans to keep tryiong to push this through? |
@bpollman Yes, I still see the baseline feature as something worth doing. I used this fork in one of the biggest projects I worked on and it was really helpful and basically the only way we could start using strict SwiftLint rules without having to fix 20k+ errors in a one go. The question is what should I do with this PR to get approvals (besides resolving conflicts). @Jeehut I have to think about the naming thing. I thought that |
child_config: baseline.yml
opt_in_rules:
- abc
- dfg
# Temporary Adjustments
disabled_rules:
- dfg |
I just noticed that the baseline feature disables specific violations instead of violated rules, so I was talking about something different. Please ignore my other comments... |
@polszacki-tooploox hi there! I am trying to use your baseline branch locally to test out how it might work and the impact it would have on my project. Since it is not merged to the master branch yet, I figured it would be best to build this locally using your branch and run However, when I try to use the compiled
(I read that this error is frequent in cases where the user is on an older version of macOS and/or doesn't have the latest Xcode versions installed, but I'm on macOS Mojave 10.14.16, and I have Xcode 11.2.1 installed.) Building locally and running this command using the master branch works, however... any ideas? |
I have seem the term But I personally find Regardless, I have a pretty effective swiftlint-diff script that does the job 99% of the time but it feels rather hacky and would much prefer using a native Let's get this merged! (how can I help?) |
Yeah, I think baseline is fine as for it's name. Let's not overthink it too much. My bad. 😅 |
Just following up on this. Is there anything holding this back from getting merged? |
I would love to see this added to the fastlane action as well. use-baseline: bool |
I'm supportive of this kind of feature, I think it can be really useful. I know it's hard to constantly rebase a large PR like this in the hope that a maintainer will get to review your work, and I can't commit to having time to review again, but if you do get a chance to rebase this PR I might be able to review it if I find the time. Or maybe another maintainer will have availability to review when that's done. |
This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions! |
Sad to see this is getting stale-botted before reviewed. |
Please see my latest comments here: #3421 Let's close this and hopefully continue there. |
Adding a baseline mechanism similar to the one implemented for Android Lint described here: https://developer.android.com/studio/write/lint#snapshot
To use the mechanism add
--use-baseline
flag when using thelint
command. If there is no baseline file it will create.swiftlint_baseline
file that's going to contain all violations reported bylint
command. Callinglint
with--use-baseline
flag next time will only report new violations that are not present in the.swiftlint_baseline
file.