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

Rules under disabled_rules in .swiftlint.yml are still applied #543

Closed
mnespor opened this issue Feb 16, 2016 · 6 comments
Closed

Rules under disabled_rules in .swiftlint.yml are still applied #543

mnespor opened this issue Feb 16, 2016 · 6 comments
Labels
bug Unexpected and reproducible misbehavior.

Comments

@mnespor
Copy link

mnespor commented Feb 16, 2016

Here's an example under swiftlint 0.9.0:

hamilton:swiftlint-disabled-rules mnespor$ cat .swiftlint.yml 
disabled_rules:
  - force_cast

hamilton:swiftlint-disabled-rules mnespor$ cat foo.swift 
struct Foo {
    let foo = 1 as! Int
}

hamilton:swiftlint-disabled-rules mnespor$ swiftlint rules
Loading configuration from '.swiftlint.yml'
+-----------------------------+--------+-------------+------------------------+--------------------------------------------------+
| identifier                  | opt-in | correctable | enabled in your config | configuration                                    |
+-----------------------------+--------+-------------+------------------------+--------------------------------------------------+
| closing_brace               | no     | yes         | yes                    | warning                                          |
...
| file_length                 | no     | no          | yes                    | warning: 400, error: 1000                        |
| force_cast                  | no     | no          | no                     | error                                            |
| force_try                   | no     | no          | yes                    | error                                            |
...
| variable_name               | no     | no          | yes                    | (min_length) w/e: 3/2, (max_length) w/e: 40/60   |
+-----------------------------+--------+-------------+------------------------+--------------------------------------------------+
hamilton:swiftlint-disabled-rules mnespor$ swiftlint lint
Loading configuration from '.swiftlint.yml'
Linting Swift files in current working directory
Linting 'foo.swift' (1/1)
/Users/mnespor/Documents/sandbox/swiftlint-disabled-rules/foo.swift:2:17: error: Force Cast Violation: Force casts should be avoided. (force_cast)
Done linting! Found 1 violation, 1 serious in 1 file.
()

@jpsim
Copy link
Collaborator

jpsim commented Feb 16, 2016

That's odd, I can't reproduce that:

$ swiftlint version
0.9.0
$ cat .swiftlint.yml 
disabled_rules:
  - force_cast
$ cat foo.swift 
struct Foo {
    let foo = 1 as! Int
}
$ swiftlint rules
Loading configuration from '.swiftlint.yml'
+-----------------------------+--------+-------------+------------------------+--------------------------------------------------+
| identifier                  | opt-in | correctable | enabled in your config | configuration                                    |
+-----------------------------+--------+-------------+------------------------+--------------------------------------------------+
| closing_brace               | no     | yes         | yes                    | warning                                          |
...
| file_length                 | no     | no          | yes                    | warning: 400, error: 1000                        |
| force_cast                  | no     | no          | no                     | error                                            |
| force_try                   | no     | no          | yes                    | error                                            |
...
| variable_name               | no     | no          | yes                    | (min_length) w/e: 3/2, (max_length) w/e: 40/60   |
+-----------------------------+--------+-------------+------------------------+--------------------------------------------------+
$ swiftlint lint
Loading configuration from '.swiftlint.yml'
Linting Swift files in current working directory
Linting 'foo.swift' (1/1)
Done linting! Found 0 violations, 0 serious in 1 file.

@jpsim jpsim added the question Question or doubts that needs discussion and clarification. Can become a bug or proposal. label Feb 16, 2016
@mnespor
Copy link
Author

mnespor commented Feb 16, 2016

Hmm. I took a closer look—it seems it's already fixed in master. 0.9.0 doesn't pick up the disabled rules for me, but f9fc51b and newer do.

@jpsim
Copy link
Collaborator

jpsim commented Feb 16, 2016

Ah, then is it possible that there are other configuration files in the directory tree? In other words, in any of the directories involved in this path? /Users/mnespor/Documents/sandbox/swiftlint-disabled-rules

@mnespor
Copy link
Author

mnespor commented Feb 16, 2016

There are configuration files in other branches of /Users/mnespor/Documents (there's one at /Users/mnespor/Documents/some-other-project/.swiftlint.yml) but none on the same branch as swiftlint-disabled-rules.

@jpsim
Copy link
Collaborator

jpsim commented Feb 16, 2016

Well, in any case, I'll close this since you've confirmed this to be fixed on master. Thanks for your help tracking this down!

@jpsim jpsim closed this as completed Feb 16, 2016
@jpsim jpsim added bug Unexpected and reproducible misbehavior. and removed question Question or doubts that needs discussion and clarification. Can become a bug or proposal. labels Feb 16, 2016
@mnespor
Copy link
Author

mnespor commented Feb 16, 2016

Thank you!

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

2 participants