-
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
Implement baseline functionality #3421
Conversation
Here's an example of your CHANGELOG entry: * Implement baseline functionality.
[PaulTaykalo](https://github.com/PaulTaykalo)
[#issue_number](https://github.com/realm/SwiftLint/issues/issue_number) note: There are two invisible spaces after the entry's text. Generated by 🚫 Danger |
@@ -0,0 +1,58 @@ | |||
import Foundation |
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.
This file doesn’t appear to use Foundation
@@ -0,0 +1,58 @@ | |||
import Foundation | |||
|
|||
public class Baseline { |
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.
The jazzy CI job is failing because these public declarations are undocumented.
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! |
I'd like to prevent this issue from being closed. |
I have been hoping for this branch/feature to make it into the main release for a very long time. I'd be happy to help. What are the chances for this to get reviewed and have a chance at getting merged. |
Looking at this again for the first time in a while, there's a few things I'd like the author(s) to think through before we can consider something like this, which I think overall the concept is a good idea.
|
As I was reviewing this, I was making some edits, which I always find helpful in understand code, they may or may not be helpful to anyone who's interested in continuing this work: https://github.com/realm/SwiftLint/commits/jp-baseline |
+1 for that feature |
1 similar comment
+1 for that feature |
} | ||
|
||
public func saveBaseline(violations: [StyleViolation]) { | ||
let fileContent = violations.map(generateForSingleViolation).joined(separator: "\n") |
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.
would \n work on all platform ? trying point out things . like when files gets modified in git or in other os
do we have this baseline implementation in pipeline . I dont see the any urgency in merging this pr. Let us know what is stopping may be we can help |
This is obviously needed as mentioned by a good number of people including myself. Is there a plan on how to proceed with this @jpsim ? |
Please a lot of people are waiting for that. |
I'm interested in picking this up. Not sure when I'll have time, or if I'll start from here, or from scratch right now.
I think so. My use case is that I will almost always want the baseline to be derived from my main branch. So I think something like
I think so, but I would implement this (in CI) with separate baseline files.
So I was thinking something like, if the file has the same violations, in the same order, ignore the violations regardless of line number. Not sure how to handle existing violations if say one new violation appearing in a file - whether to report all the violations in the file, or to try to detect which one is "new". For example, if my baseline violations are
and my new violations are
which is the new one Possibly ignore them if the line numbers match exactly, but otherwise report them all.
I think if we supported
I would definitely take a look at that.
|
very eager to have this feature !!! |
So I have a very basic implementation at #5475 Seems to work for my basic test case, but will try to work on it and to add some more docs next week. |
Closing as #5475 has superseded this PR. With that being merged, we now have a baseline functionality experimentally available in SwiftLint. |
This is the rebased version of #2580