IBDecodable / IBLinter

A linter tool for Interface Builder
MIT License
950 stars 40 forks source link

Add reuse_identifier rule and test. #137

Closed r-plus closed 4 years ago

r-plus commented 4 years ago

Hi

I just try to implement reuse_identifierrule, how about this rule? If acceptable, I'll continue to add xib support and docs for it.

Closes #136

r-plus commented 4 years ago

@kateinoigakukun @phimage okey, i finish up implementation for reuse_identifier rule and test. Could you review this?

NOTE: I added some mess commits for this PR, so please squash merge to clean up git history when you merge or I'll rebase before or after review if you want.

looks like CI is not running, this is test result in my local.

`swift test` result ``` [332/332] Linking IBLinterPackageTests Test Suite 'All tests' started at 2020-01-21 12:48:45.209 Test Suite 'IBLinterPackageTests.xctest' started at 2020-01-21 12:48:45.209 Test Suite 'AmbiguousViewRuleTests' started at 2020-01-21 12:48:45.209 Test Case '-[IBLinterKitTest.AmbiguousViewRuleTests testAmbiguous]' started. Test Case '-[IBLinterKitTest.AmbiguousViewRuleTests testAmbiguous]' passed (0.173 seconds). Test Suite 'AmbiguousViewRuleTests' passed at 2020-01-21 12:48:45.382. Executed 1 test, with 0 failures (0 unexpected) in 0.173 (0.173) seconds Test Suite 'AssetsCatalogTest' started at 2020-01-21 12:48:45.382 Test Case '-[IBLinterKitTest.AssetsCatalogTest testImageAssets]' started. Test Case '-[IBLinterKitTest.AssetsCatalogTest testImageAssets]' passed (0.004 seconds). Test Suite 'AssetsCatalogTest' passed at 2020-01-21 12:48:45.387. Executed 1 test, with 0 failures (0 unexpected) in 0.004 (0.004) seconds Test Suite 'ConfigTest' started at 2020-01-21 12:48:45.387 Test Case '-[IBLinterKitTest.ConfigTest testConfigFile]' started. Test Case '-[IBLinterKitTest.ConfigTest testConfigFile]' passed (0.004 seconds). Test Case '-[IBLinterKitTest.ConfigTest testNullableConfigFile]' started. Test Case '-[IBLinterKitTest.ConfigTest testNullableConfigFile]' passed (0.001 seconds). Test Case '-[IBLinterKitTest.ConfigTest testViewAsDeviceConfigFile]' started. Test Case '-[IBLinterKitTest.ConfigTest testViewAsDeviceConfigFile]' passed (0.001 seconds). Test Suite 'ConfigTest' passed at 2020-01-21 12:48:45.393. Executed 3 tests, with 0 failures (0 unexpected) in 0.006 (0.006) seconds Test Suite 'CustomClassNameRuleTests' started at 2020-01-21 12:48:45.393 Test Case '-[IBLinterKitTest.CustomClassNameRuleTests testCustomClassName]' started. Test Case '-[IBLinterKitTest.CustomClassNameRuleTests testCustomClassName]' passed (0.004 seconds). Test Suite 'CustomClassNameRuleTests' passed at 2020-01-21 12:48:45.397. Executed 1 test, with 0 failures (0 unexpected) in 0.004 (0.004) seconds Test Suite 'CustomModuleRuleTests' started at 2020-01-21 12:48:45.397 Test Case '-[IBLinterKitTest.CustomModuleRuleTests testCustomModule]' started. Test Case '-[IBLinterKitTest.CustomModuleRuleTests testCustomModule]' passed (0.051 seconds). Test Case '-[IBLinterKitTest.CustomModuleRuleTests testCustomModuleWithRelativePath]' started. Test Case '-[IBLinterKitTest.CustomModuleRuleTests testCustomModuleWithRelativePath]' passed (0.006 seconds). Test Case '-[IBLinterKitTest.CustomModuleRuleTests testSameNameClass]' started. Test Case '-[IBLinterKitTest.CustomModuleRuleTests testSameNameClass]' passed (0.005 seconds). Test Suite 'CustomModuleRuleTests' passed at 2020-01-21 12:48:45.459. Executed 3 tests, with 0 failures (0 unexpected) in 0.062 (0.062) seconds Test Suite 'DuplicateConstraintRuleTests' started at 2020-01-21 12:48:45.459 Test Case '-[IBLinterKitTest.DuplicateConstraintRuleTests testDuplicateConstraint]' started. Test Case '-[IBLinterKitTest.DuplicateConstraintRuleTests testDuplicateConstraint]' passed (0.002 seconds). Test Suite 'DuplicateConstraintRuleTests' passed at 2020-01-21 12:48:45.461. Executed 1 test, with 0 failures (0 unexpected) in 0.002 (0.003) seconds Test Suite 'DuplicateIDRuleTests' started at 2020-01-21 12:48:45.461 Test Case '-[IBLinterKitTest.DuplicateIDRuleTests testDuplicateId]' started. Test Case '-[IBLinterKitTest.DuplicateIDRuleTests testDuplicateId]' passed (0.009 seconds). Test Suite 'DuplicateIDRuleTests' passed at 2020-01-21 12:48:45.470. Executed 1 test, with 0 failures (0 unexpected) in 0.009 (0.009) seconds Test Suite 'GlobTests' started at 2020-01-21 12:48:45.470 Test Case '-[IBLinterKitTest.GlobTests testExpandGlobstar]' started. Test Case '-[IBLinterKitTest.GlobTests testExpandGlobstar]' passed (0.001 seconds). Test Case '-[IBLinterKitTest.GlobTests testMultiRecursivePaths]' started. Test Case '-[IBLinterKitTest.GlobTests testMultiRecursivePaths]' passed (0.001 seconds). Test Case '-[IBLinterKitTest.GlobTests testMultiRecursiveSubPaths]' started. Test Case '-[IBLinterKitTest.GlobTests testMultiRecursiveSubPaths]' passed (0.001 seconds). Test Case '-[IBLinterKitTest.GlobTests testRecursiveSubPaths]' started. Test Case '-[IBLinterKitTest.GlobTests testRecursiveSubPaths]' passed (0.000 seconds). Test Case '-[IBLinterKitTest.GlobTests testSimpleFile]' started. Test Case '-[IBLinterKitTest.GlobTests testSimpleFile]' passed (0.000 seconds). Test Case '-[IBLinterKitTest.GlobTests testSimplePath]' started. Test Case '-[IBLinterKitTest.GlobTests testSimplePath]' passed (0.000 seconds). Test Case '-[IBLinterKitTest.GlobTests testSubPaths]' started. Test Case '-[IBLinterKitTest.GlobTests testSubPaths]' passed (0.000 seconds). Test Suite 'GlobTests' passed at 2020-01-21 12:48:45.474. Executed 7 tests, with 0 failures (0 unexpected) in 0.004 (0.004) seconds Test Suite 'ImageResourcesRuleTests' started at 2020-01-21 12:48:45.474 Test Case '-[IBLinterKitTest.ImageResourcesRuleTests testImageResources]' started. Test Case '-[IBLinterKitTest.ImageResourcesRuleTests testImageResources]' passed (0.036 seconds). Test Suite 'ImageResourcesRuleTests' passed at 2020-01-21 12:48:45.510. Executed 1 test, with 0 failures (0 unexpected) in 0.036 (0.036) seconds Test Suite 'LintCacheTests' started at 2020-01-21 12:48:45.510 Test Case '-[IBLinterKitTest.LintCacheTests testLoadDiskCache]' started. Test Case '-[IBLinterKitTest.LintCacheTests testLoadDiskCache]' passed (0.003 seconds). Test Suite 'LintCacheTests' passed at 2020-01-21 12:48:45.513. Executed 1 test, with 0 failures (0 unexpected) in 0.003 (0.003) seconds Test Suite 'LintablePathsTests' started at 2020-01-21 12:48:45.513 Test Case '-[IBLinterKitTest.LintablePathsTests testExcluded]' started. Test Case '-[IBLinterKitTest.LintablePathsTests testExcluded]' passed (0.000 seconds). Test Case '-[IBLinterKitTest.LintablePathsTests testIncluded]' started. Test Case '-[IBLinterKitTest.LintablePathsTests testIncluded]' passed (0.001 seconds). Test Case '-[IBLinterKitTest.LintablePathsTests testIncludedAndExcluded]' started. Test Case '-[IBLinterKitTest.LintablePathsTests testIncludedAndExcluded]' passed (0.000 seconds). Test Suite 'LintablePathsTests' passed at 2020-01-21 12:48:45.515. Executed 3 tests, with 0 failures (0 unexpected) in 0.001 (0.002) seconds Test Suite 'RelativeToMarginRuleTests' started at 2020-01-21 12:48:45.515 Test Case '-[IBLinterKitTest.RelativeToMarginRuleTests testRelativeToMargin]' started. Test Case '-[IBLinterKitTest.RelativeToMarginRuleTests testRelativeToMargin]' passed (0.002 seconds). Test Suite 'RelativeToMarginRuleTests' passed at 2020-01-21 12:48:45.517. Executed 1 test, with 0 failures (0 unexpected) in 0.002 (0.002) seconds Test Suite 'ReportersTest' started at 2020-01-21 12:48:45.517 Test Case '-[IBLinterKitTest.ReportersTest testJSONReporter]' started. Test Case '-[IBLinterKitTest.ReportersTest testJSONReporter]' passed (0.000 seconds). Test Suite 'ReportersTest' passed at 2020-01-21 12:48:45.518. Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds Test Suite 'ReuseIdentifierRuleTests' started at 2020-01-21 12:48:45.518 Test Case '-[IBLinterKitTest.ReuseIdentifierRuleTests testReuseIdentifierStoryboard]' started. Test Case '-[IBLinterKitTest.ReuseIdentifierRuleTests testReuseIdentifierStoryboard]' passed (0.005 seconds). Test Case '-[IBLinterKitTest.ReuseIdentifierRuleTests testReuseIdentifierXib]' started. Test Case '-[IBLinterKitTest.ReuseIdentifierRuleTests testReuseIdentifierXib]' passed (0.002 seconds). Test Suite 'ReuseIdentifierRuleTests' passed at 2020-01-21 12:48:45.525. Executed 2 tests, with 0 failures (0 unexpected) in 0.007 (0.007) seconds Test Suite 'RuleTests' started at 2020-01-21 12:48:45.525 Test Case '-[IBLinterKitTest.RuleTests testDefaultEnabledRules]' started. Test Case '-[IBLinterKitTest.RuleTests testDefaultEnabledRules]' passed (0.000 seconds). Test Case '-[IBLinterKitTest.RuleTests testDisableDefaultEnabledRules]' started. Test Case '-[IBLinterKitTest.RuleTests testDisableDefaultEnabledRules]' passed (0.000 seconds). Test Case '-[IBLinterKitTest.RuleTests testDuplicatedEnabledRules]' started. Test Case '-[IBLinterKitTest.RuleTests testDuplicatedEnabledRules]' passed (0.000 seconds). Test Suite 'RuleTests' passed at 2020-01-21 12:48:45.526. Executed 3 tests, with 0 failures (0 unexpected) in 0.001 (0.001) seconds Test Suite 'UseBaseClassRuleTests' started at 2020-01-21 12:48:45.526 Test Case '-[IBLinterKitTest.UseBaseClassRuleTests testUseBaseClass]' started. Test Case '-[IBLinterKitTest.UseBaseClassRuleTests testUseBaseClass]' passed (0.002 seconds). Test Suite 'UseBaseClassRuleTests' passed at 2020-01-21 12:48:45.528. Executed 1 test, with 0 failures (0 unexpected) in 0.002 (0.002) seconds Test Suite 'VaridatorTest' started at 2020-01-21 12:48:45.528 Test Case '-[IBLinterKitTest.VaridatorTest testValidateStoryboard]' started. Test Case '-[IBLinterKitTest.VaridatorTest testValidateStoryboard]' passed (0.008 seconds). Test Case '-[IBLinterKitTest.VaridatorTest testValidateXib]' started. Test Case '-[IBLinterKitTest.VaridatorTest testValidateXib]' passed (0.003 seconds). Test Suite 'VaridatorTest' passed at 2020-01-21 12:48:45.538. Executed 2 tests, with 0 failures (0 unexpected) in 0.010 (0.011) seconds Test Suite 'ViewAsDeviceRuleTests' started at 2020-01-21 12:48:45.538 Test Case '-[IBLinterKitTest.ViewAsDeviceRuleTests testViewAsDeviceWithConfig]' started. Test Case '-[IBLinterKitTest.ViewAsDeviceRuleTests testViewAsDeviceWithConfig]' passed (0.001 seconds). Test Case '-[IBLinterKitTest.ViewAsDeviceRuleTests testViewAsDeviceWithNoConfig]' started. Test Case '-[IBLinterKitTest.ViewAsDeviceRuleTests testViewAsDeviceWithNoConfig]' passed (0.001 seconds). Test Suite 'ViewAsDeviceRuleTests' passed at 2020-01-21 12:48:45.541. Executed 2 tests, with 0 failures (0 unexpected) in 0.003 (0.003) seconds Test Suite 'IBLinterPackageTests.xctest' passed at 2020-01-21 12:48:45.541. Executed 35 tests, with 0 failures (0 unexpected) in 0.329 (0.332) seconds Test Suite 'All tests' passed at 2020-01-21 12:48:45.541. Executed 35 tests, with 0 failures (0 unexpected) in 0.329 (0.332) seconds ```
kateinoigakukun commented 4 years ago

Great thanks! LGTM

r-plus commented 4 years ago

thanks a lot!