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

Mildm8nnered skip unit tests in magic numbers rule #4897

Conversation

mildm8nnered
Copy link
Collaborator

@mildm8nnered mildm8nnered commented Apr 15, 2023

WIP

Fixes #4896

Adds a test_parent_classes to the Magic Number Rule.

Violations within a class that inherits directly from one of the specified parent classes (by default XCTestCase and QuickSpec) will be ignored.

This includes violations within inner classes of a class that inherits directly from one of the specified parent classes.

If users wish to detect violations of the rule within unit tests, they can simply set test_parent_classes to [].

I also "aligned" some of the labels in other classes that also use a similar configuration (actually the same configuration, but typealiased). In some places we were referring to testClasses, which is actually testParentClasses.

@SwiftLintBot
Copy link

SwiftLintBot commented Apr 15, 2023

1 Warning
⚠️ This PR may need tests.
6633 Messages
📖 Linting Aerial with this PR took 1.06s vs 1.06s on main (0% slower)
📖 Linting Alamofire with this PR took 1.39s vs 1.39s on main (0% slower)
📖 Linting Brave with this PR took 7.36s vs 7.37s on main (0% faster)
📖 Linting DuckDuckGo with this PR took 3.55s vs 3.55s on main (0% slower)
📖 Linting Firefox with this PR took 9.74s vs 9.64s on main (1% slower)
📖 Linting Kickstarter with this PR took 10.44s vs 10.34s on main (0% slower)
📖 Linting Moya with this PR took 0.55s vs 0.55s on main (0% slower)
📖 Linting NetNewsWire with this PR took 3.1s vs 3.07s on main (0% slower)
📖 Linting Nimble with this PR took 0.63s vs 0.63s on main (0% slower)
📖 Linting PocketCasts with this PR took 7.34s vs 7.36s on main (0% faster)
📖 Linting Quick with this PR took 0.24s vs 0.23s on main (4% slower)
📖 Linting Realm with this PR took 11.55s vs 11.56s on main (0% faster)
📖 Linting SourceKitten with this PR took 0.44s vs 0.44s on main (0% slower)
📖 Linting Sourcery with this PR took 2.23s vs 2.22s on main (0% slower)
📖 Linting Swift with this PR took 4.68s vs 4.66s on main (0% slower)
📖 Linting VLC with this PR took 1.38s vs 1.38s on main (0% slower)
📖 Linting Wire with this PR took 8.4s vs 8.39s on main (0% slower)
📖 Linting WordPress with this PR took 11.47s vs 11.5s on main (0% faster)
📖 This PR fixed a violation in Alamofire: /Tests/LeaksTests.swift:58:22: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Sources/DataTestsUtils/CoreDataTestCase.swift:54:48: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/CardGeneratorTests.swift:220:39: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/CardGeneratorTests.swift:250:23: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/CardGeneratorTests.swift:250:93: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/CardGeneratorTests.swift:251:23: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/CardGeneratorTests.swift:251:92: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/CardGeneratorTests.swift:252:23: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/CardGeneratorTests.swift:252:92: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/CardGeneratorTests.swift:253:23: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/CardGeneratorTests.swift:253:93: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/CardGeneratorTests.swift:34:63: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:105:34: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:110:47: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:113:27: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:117:12: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:119:31: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:119:80: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:133:57: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:24:34: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:35:34: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:38:32: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:64:34: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:69:47: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:71:27: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:75:12: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:77:31: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:77:80: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:93:32: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:95:32: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/FeedFillStrategyTests.swift:99:33: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveNewsTests/OPMLParsingTests.swift:20:41: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificatePinningTest.swift:175:38: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificatePinningTest.swift:211:38: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificatePinningTest.swift:248:38: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificatePinningTest.swift:284:38: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:109:35: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:116:64: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:117:63: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:126:55: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:127:55: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:128:54: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:173:35: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:180:64: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:181:63: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:190:55: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:191:55: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:192:54: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:193:50: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:26:15: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:26:27: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:29:21: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:29:27: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:29:33: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:29:39: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:29:45: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:30:21: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:30:27: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:30:33: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:30:39: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:30:45: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:34:22: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:34:28: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:34:34: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:34:40: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:34:46: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:34:52: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:36:33: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:36:39: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:36:45: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:36:51: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:36:57: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:36:63: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:36:69: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:36:75: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:36:93: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:37:31: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:37:37: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:37:43: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:37:49: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:37:55: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:37:61: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:37:67: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:37:73: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:37:79: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:37:85: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:38:29: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:38:35: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:38:41: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:38:47: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:38:53: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:38:59: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:38:65: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:38:71: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:39:31: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:39:37: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:39:43: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:39:49: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:39:55: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:39:61: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:39:67: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:39:73: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:39:85: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:55:14: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:55:20: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:55:26: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:55:32: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:55:38: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:55:8: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:56:20: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:56:8: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:57:14: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:57:20: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:57:26: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:57:32: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:57:8: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:58:14: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:58:20: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:58:26: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:58:32: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:58:8: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:59:14: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:59:20: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:59:26: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:59:32: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:59:8: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:60:14: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:60:20: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:60:26: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:60:32: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:60:38: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
📖 This PR fixed a violation in Brave: /Tests/BraveSharedTests/CertificateUtilsTest.swift:60:8: warning: No Magic Numbers Violation: Magic numbers should be replaced by named constants (no_magic_numbers)
⚠️ Danger found 6633 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 150.

Generated by 🚫 Danger

@mildm8nnered mildm8nnered marked this pull request as ready for review April 15, 2023 17:03
@mildm8nnered
Copy link
Collaborator Author

Should be resolved by #4897

}

private extension ClassDeclSyntax {
func isTestClass(testParentClasses: Set<String>) -> Bool {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The isXCTestCase already exists on ClassDeclSyntax objects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I should have remembered that :-)

"""),
Example("""
class FooTests: XCTestCase {
class Bar {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nested classes are discussable if they are not themselves test classes. But I agree that this rule should be disabled in test code generally. So ignoring them as well is fine.

CHANGELOG.md Outdated
@@ -31,6 +31,11 @@
[Martin Redington](https://github.com/mildm8nnered)
[#4819](https://github.com/realm/SwiftLint/issues/4819)

* Adds `test_parent_classes` option to the `magic_numbers` rule.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Adds `test_parent_classes` option to the `magic_numbers` rule.
* Adds `test_parent_classes` option to the `no_magic_numbers` rule.

@mildm8nnered
Copy link
Collaborator Author

CR comments addressed

@SimplyDanny SimplyDanny merged commit 97fd216 into realm:main Apr 16, 2023
@SimplyDanny
Copy link
Collaborator

Thank you for the fast implementation!

@mildm8nnered mildm8nnered deleted the mildm8nnered-skip-unit-tests-in-magic-numbers-rule branch April 17, 2023 23:29
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.

no_magic_numbers should not trigger in test code
3 participants