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

Fix opening_brace correction #5620

Merged
merged 7 commits into from
Jul 20, 2024

Conversation

swiftty
Copy link
Contributor

@swiftty swiftty commented Jun 11, 2024

@SwiftLintBot
Copy link

SwiftLintBot commented Jun 23, 2024

17 Messages
📖 Linting Aerial with this PR took 1.0s vs 1.01s on main (0% faster)
📖 Linting Alamofire with this PR took 1.4s vs 1.39s on main (0% slower)
📖 Linting Brave with this PR took 8.2s vs 8.21s on main (0% faster)
📖 Linting DuckDuckGo with this PR took 4.68s vs 4.69s on main (0% faster)
📖 Linting Firefox with this PR took 11.62s vs 11.62s on main (0% slower)
📖 Linting Kickstarter with this PR took 10.24s vs 10.26s on main (0% faster)
📖 Linting Moya with this PR took 0.57s vs 0.57s on main (0% slower)
📖 Linting NetNewsWire with this PR took 2.8s vs 2.79s on main (0% slower)
📖 Linting Nimble with this PR took 0.82s vs 0.83s on main (1% faster)
📖 Linting PocketCasts with this PR took 8.98s vs 8.99s on main (0% faster)
📖 Linting Quick with this PR took 0.47s vs 0.47s on main (0% slower)
📖 Linting Realm with this PR took 5.14s vs 5.15s on main (0% faster)
📖 Linting Sourcery with this PR took 2.59s vs 2.57s on main (0% slower)
📖 Linting Swift with this PR took 5.03s vs 5.01s on main (0% slower)
📖 Linting VLC with this PR took 1.36s vs 1.36s on main (0% slower)
📖 Linting Wire with this PR took 19.59s vs 19.57s on main (0% slower)
📖 Linting WordPress with this PR took 13.24s vs 13.16s on main (0% slower)

Generated by 🚫 Danger

@swiftty swiftty force-pushed the fix/opening_brace-correction branch from b6737c7 to 700c674 Compare June 23, 2024 04:04
@swiftty swiftty marked this pull request as ready for review June 23, 2024 07:59
Copy link

@Naveen-C-Ramachandrappa Naveen-C-Ramachandrappa left a comment

Choose a reason for hiding this comment

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

Looks good.

Tests/SwiftLintTestHelpers/TestHelpers.swift Outdated Show resolved Hide resolved
@@ -273,6 +273,7 @@ extension SwiftLintFile {
return violatingRanges.filter { range in
let region = fileRegions.first {
$0.contains(Location(file: self, characterOffset: range.location))
|| $0.contains(Location(file: self, characterOffset: range.location + range.length - 1))
Copy link
Collaborator

Choose a reason for hiding this comment

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

While this seems like a reasonable change, it has the potential of changing other corrections of rules as well (which we don't see in the OSS report). I'd rather like to avoid that. This will anyway become a thing if the past once these rules are converted to SwiftSyntax rules.

Actually, the decision if a rule is enabled or not should be the same for violations and corrections. In your example, a violations is reported, but no fix is applied. That's inconsistent. So we have to make sure that the "Is rule enabled?" check is implemented in the same way or at least can rely on the same positions in the "reporting" and "fix" cases, probably by extending ViolationCorrection with a violationPosition. Later, ReasonedRuleViolation and ViolationCorrection can even be merged.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This has been addressed by #5680 and #5682.

@SimplyDanny
Copy link
Collaborator

SimplyDanny commented Jul 20, 2024

@swiftty, sorry for being too late with my review here. Parts of your PR had already been fixed by other measures or required more extensive refactoring. Thank you nevertheless for the valuable contribution! Please keep up the good work. 😊

I rebased the branch, so that everything should be good to go in a while.

@SimplyDanny SimplyDanny enabled auto-merge (squash) July 20, 2024 15:18
@SimplyDanny SimplyDanny merged commit cb0f5ab into realm:main Jul 20, 2024
12 checks passed
@swiftty swiftty deleted the fix/opening_brace-correction branch July 21, 2024 02:05
@swiftty
Copy link
Contributor Author

swiftty commented Jul 21, 2024

@SimplyDanny, I appreciate your courteous response in fixing the code and merging the PR.

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.

opening_brace fix is broken
4 participants