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

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

Closed
2 tasks done
jpsim opened this issue Oct 16, 2018 · 1 comment
Closed
2 tasks done

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

jpsim opened this issue Oct 16, 2018 · 1 comment
Labels
bug Unexpected and reproducible misbehavior.

Comments

@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 Unexpected and reproducible misbehavior. label Oct 16, 2018
@realm-probot realm-probot bot added the O:User label Oct 16, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 25, 2018
…n to consider custom rules of a parent of a nested configuration
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 25, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 25, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 25, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 25, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 25, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 26, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 26, 2018
…n to consider custom rules of a parent of a nested configuration
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 26, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 26, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 26, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 26, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 26, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Dec 26, 2018
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Jan 9, 2019
…n to consider custom rules of a parent of a nested configuration
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Jan 9, 2019
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Jan 9, 2019
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Jan 9, 2019
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Jan 9, 2019
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Jan 9, 2019
abdulowork added a commit to abdulowork/SwiftLint that referenced this issue Jan 9, 2019
jpsim added a commit that referenced this issue Jan 13, 2019
* #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
Copy link
Collaborator Author

jpsim commented Jan 13, 2019

Fixed in #2556.

@jpsim jpsim closed this as completed Jan 13, 2019
sjavora pushed a commit to sjavora/SwiftLint that referenced this issue Mar 9, 2019
…ealm#2556)

* realm#2441 - Pass custom rules identifiers to the enableRules function to consider custom rules of a parent of a nested configuration

* realm#2441 - Add custom rules merge

* realm#2441 - Fix line length violation

* realm#2441 - Add nested configutaion mocks with custom rules

* realm#2441 - Add nested configurations tests for custom rules

* realm#2441 - Disable function body length check

* realm#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

No branches or pull requests

1 participant