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

Stop triggering no_magic_numbers rule on literals used in ranges #5431

Merged
merged 1 commit into from
Jan 20, 2024

Conversation

SimplyDanny
Copy link
Collaborator

Fixes #5430.

@SwiftLintBot
Copy link

SwiftLintBot commented Jan 19, 2024

1 Warning
⚠️ This PR may need tests.
29 Messages
📖 Linting Aerial with this PR took 0.18s vs 0.17s on main (5% slower)
📖 Linting Alamofire with this PR took 0.15s vs 0.13s on main (15% slower)
📖 Linting Brave with this PR took 0.75s vs 0.57s on main (31% slower)
📖 Linting DuckDuckGo with this PR took 0.5s vs 0.43s on main (16% slower)
📖 Linting Firefox with this PR took 0.81s vs 0.64s on main (26% slower)
📖 Linting Kickstarter with this PR took 0.78s vs 0.6s on main (30% slower)
📖 Linting Moya with this PR took 0.15s vs 0.14s on main (7% slower)
📖 Linting NetNewsWire with this PR took 0.31s vs 0.23s on main (34% slower)
📖 Linting Nimble with this PR took 0.15s vs 0.13s on main (15% slower)
📖 Linting PocketCasts with this PR took 0.78s vs 0.56s on main (39% slower)
📖 Linting Quick with this PR took 0.09s vs 0.09s on main (0% slower)
📖 Linting Realm with this PR took 0.51s vs 0.45s on main (13% slower)
📖 Linting Sourcery with this PR took 0.3s vs 0.26s on main (15% slower)
📖 Linting Swift with this PR took 0.42s vs 0.29s on main (44% slower)
📖 Linting VLC with this PR took 0.22s vs 0.16s on main (37% slower)
📖 Linting Wire with this PR took 1.58s vs 1.16s on main (36% slower)
📖 Linting WordPress with this PR took 1.14s vs 0.81s on main (40% slower)
📖 This PR fixed a violation in PocketCasts: /podcasts/End of Year/Stories/IntroStory.swift:106:47: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Realm: /RealmSwift/Tests/ListTests.swift:860:46: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Realm: /RealmSwift/Tests/ListTests.swift:867:40: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Realm: /RealmSwift/Tests/ListTests.swift:874:42: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Realm: /RealmSwift/Tests/ListTests.swift:874:46: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Realm: /RealmSwift/Tests/ListTests.swift:882:36: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Realm: /RealmSwift/Tests/ListTests.swift:882:40: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Wire: /wire-ios-data-model/Tests/Source/Model/ZMManagedObjectGroupingTests.swift:119:25: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Wire: /wire-ios-data-model/Tests/Source/Model/ZMManagedObjectGroupingTests.swift:139:25: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Wire: /wire-ios-data-model/Tests/Source/Model/ZMManagedObjectGroupingTests.swift:97:25: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Wire: /wire-ios-sync-engine/Tests/Source/UserSession/ZMUserSessionTests.swift:464:60: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Wire: /wire-ios/Wire-iOS/Sources/UserInterface/Calling/CallQualityController/CallQualityController.swift:49:43: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)

Generated by 🚫 Danger

@SimplyDanny SimplyDanny force-pushed the magic-numbers-in-ranges branch 2 times, most recently from 3d00b16 to 17fab3f Compare January 20, 2024 09:54
@SimplyDanny SimplyDanny force-pushed the magic-numbers-in-ranges branch from 17fab3f to 5cdbaa6 Compare January 20, 2024 10:18
@SimplyDanny
Copy link
Collaborator Author

All OSS findings are valid.

The performance drop is due to expression folding. As folded trees are cached, this is only a one-time cost. The more rules in a configuration require folded expressions the more the effort spent for folding becomes neglectable.

@SimplyDanny SimplyDanny merged commit 7f960d3 into realm:main Jan 20, 2024
12 checks passed
@SimplyDanny SimplyDanny deleted the magic-numbers-in-ranges branch January 23, 2024 21:04
u-abyss pushed a commit to u-abyss/SwiftLint that referenced this pull request Feb 11, 2024
kohtenko pushed a commit to kohtenko/SwiftLint that referenced this pull request Mar 8, 2024
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.

Range literal constant mistakenly flagged as magic number
2 participants