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

Can't disable custom rule in nested config file #2441

Closed
jpsim opened this Issue Oct 16, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@jpsim
Copy link
Collaborator

jpsim commented Oct 16, 2018

New Issue Checklist

Describe the bug

When attempting to disable a custom rule defined in a parent configuration from a nested configuration, SwiftLint can't find that rule and prints the message configuration error: 'my_custom_rule' is not a valid rule identifier.

Complete output when running SwiftLint, including the stack trace and command used
$ tree -a
.
├── .swiftlint.yml
├── dir1
│   ├── .swiftlint.yml
│   └── file2.swift
└── file1.swift

1 directory, 4 files
$ cat .swiftlint.yml
custom_rules:
  no_abc:
    name: "Don't use abc"
    regex: 'abc'

$ cat file1.swift
// abc
$ cat dir1/.swiftlint.yml
disabled_rules:
  - no_abc
$ cat dir1/file2.swift
// abc
$ swiftlint
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths ...
configuration error: 'no_abc' is not a valid rule identifier
Valid rule identifiers:
anyobject_protocol
...
yoda_condition
Linting 'file1.swift' (1/2)
Linting 'file2.swift' (2/2)
/path/to/dir/file1.swift:1:4: warning: Don't use abc Violation: Regex matched. (no_abc)
/path/to/dir/dir1/file2.swift:1:4: warning: Don't use abc Violation: Regex matched. (no_abc)
Done linting! Found 2 violations, 0 serious in 2 files.

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.27.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew
  • Which Xcode version are you using (check xcode-select -p)? /Applications/Xcode-10.app/Contents/Developer

@jpsim jpsim added the bug label Oct 16, 2018

@realm-probot realm-probot bot added the O:User label Oct 16, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 25, 2018

realm#2441 - Pass custom rules identifiers to the enableRules functio…
…n to consider custom rules of a parent of a nested configuration

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 25, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 25, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 25, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 25, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 25, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 26, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 26, 2018

realm#2441 - Pass custom rules identifiers to the enableRules functio…
…n to consider custom rules of a parent of a nested configuration

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 26, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 26, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 26, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 26, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 26, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Dec 26, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Jan 9, 2019

realm#2441 - Pass custom rules identifiers to the enableRules functio…
…n to consider custom rules of a parent of a nested configuration

biboran added a commit to biboran/SwiftLint that referenced this issue Jan 9, 2019

biboran added a commit to biboran/SwiftLint that referenced this issue Jan 9, 2019

biboran added a commit to biboran/SwiftLint that referenced this issue Jan 9, 2019

biboran added a commit to biboran/SwiftLint that referenced this issue Jan 9, 2019

biboran added a commit to biboran/SwiftLint that referenced this issue Jan 9, 2019

biboran added a commit to biboran/SwiftLint that referenced this issue Jan 9, 2019

jpsim added a commit that referenced this issue Jan 13, 2019

#2441 - Fix inaccessible custom rules in nested configurations (#2556)
* #2441 - Pass custom rules identifiers to the enableRules function to consider custom rules of a parent of a nested configuration

* #2441 - Add custom rules merge

* #2441 - Fix line length violation

* #2441 - Add nested configutaion mocks with custom rules

* #2441 - Add nested configurations tests for custom rules

* #2441 - Disable function body length check

* #2441 - Update changelog

* Move changelog to appropriate position

* Split up and refactor Configuration.init to avoid being too long

* Add tests to LinuxMain.swift

* Remove redundant protocol conformances

Hashable implies Equatable

* Fix typo in changelog entry and add another fixed issue URL
@jpsim

This comment has been minimized.

Copy link
Collaborator Author

jpsim commented Jan 13, 2019

Fixed in #2556.

@jpsim jpsim closed this Jan 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment