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

Adds baseline and write_baseline config file options #5552

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mildm8nnered
Copy link
Collaborator

@mildm8nnered mildm8nnered commented May 1, 2024

So baselines can be used by people who can't pass command line arguments (e.g. plugin users).

baseline and write_baseline - these behave exactly the same way as their command line equivalents. The command line will take preference if there is a conflict, but there is not way to "unset" the config file entries from the command line - if there is a baseline config file entry, you can override it to be a different value, but there is no way to tell SwiftLint "don't read a baseline at all".

This is very similar to the PR from a while ago adding a strict config option - #5226

@SwiftLintBot
Copy link

SwiftLintBot commented May 1, 2024

17 Messages
📖 Linting Aerial with this PR took 0.81s vs 0.82s on main (1% faster)
📖 Linting Alamofire with this PR took 1.14s vs 1.17s on main (2% faster)
📖 Linting Brave with this PR took 6.63s vs 6.46s on main (2% slower)
📖 Linting DuckDuckGo with this PR took 3.47s vs 3.45s on main (0% slower)
📖 Linting Firefox with this PR took 9.33s vs 9.19s on main (1% slower)
📖 Linting Kickstarter with this PR took 8.05s vs 8.1s on main (0% faster)
📖 Linting Moya with this PR took 0.48s vs 0.48s on main (0% slower)
📖 Linting NetNewsWire with this PR took 2.41s vs 2.4s on main (0% slower)
📖 Linting Nimble with this PR took 0.68s vs 0.69s on main (1% faster)
📖 Linting PocketCasts with this PR took 6.83s vs 6.86s on main (0% faster)
📖 Linting Quick with this PR took 0.33s vs 0.33s on main (0% slower)
📖 Linting Realm with this PR took 4.06s vs 3.98s on main (2% slower)
📖 Linting Sourcery with this PR took 2.05s vs 2.06s on main (0% faster)
📖 Linting Swift with this PR took 3.94s vs 3.96s on main (0% faster)
📖 Linting VLC with this PR took 1.1s vs 1.09s on main (0% slower)
📖 Linting Wire with this PR took 14.31s vs 14.21s on main (0% slower)
📖 Linting WordPress with this PR took 9.65s vs 9.65s on main (0% slower)

Generated by 🚫 Danger

@mildm8nnered mildm8nnered marked this pull request as ready for review May 1, 2024 17:39
@mildm8nnered mildm8nnered force-pushed the mildm8nnered-baseline-config2 branch from 1342498 to 01cc6fd Compare May 3, 2024 21:35
Copy link
Collaborator

@SimplyDanny SimplyDanny left a comment

Choose a reason for hiding this comment

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

Is write_baseline really useful to have in the configuration? That would mean every new violation is directly added to the baseline. But new appearing violations should rather be fixed.

Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift Outdated Show resolved Hide resolved
@mildm8nnered
Copy link
Collaborator Author

Is write_baseline really useful to have in the configuration? That would mean every new violation is directly added to the baseline. But new appearing violations should rather be fixed.

So I don't expect it to get that much use, but I could see a few possible use cases.

If you want to generate the Baselines in your CI environment, and can't pass command line options, then this would let you do so without having to reconstruct that environment locally. I could imagine people having a monthly or even yearly job for this.

If you wanted to track whether existing violations were getting fixed, you could write out a baseline for the build, and then use swiftlint baseline compare against the main baseline to detect fixed violations.

@mildm8nnered mildm8nnered force-pushed the mildm8nnered-baseline-config2 branch from 13ebf0c to 1217db3 Compare May 4, 2024 16:53
@mildm8nnered mildm8nnered force-pushed the mildm8nnered-baseline-config2 branch from 1217db3 to f97a825 Compare May 11, 2024 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants