Open mgrebenets opened 5 years ago
there is no "project root" there si current path, or paths given by options
so yes adding --config is a good feature but the path in "excluded" must relative to this config file parent folder or the --path, that is the question!
I agree with the points, there's no such thing as root folder.
I personally like rubocop
behavior more, where exclude paths are relative to the location of the config file, and not to the location specified by --path
option.
Regardless, it would be nice to have --config
option that behaves same way the SwiftLint's --config
option behaves.
I've changed the title to make this a feature request rather than issue with --path
.
--config
is now merged, but not released (need to fix the bug about watchkit before)
@mgrebenets could you test new option --config if you know how to compile (we use SPM)
I am wondering how rules path must be managed, according to "--path" so the files must contains
excluded:
- Storyboards
and not
Example/Storyboards
I think the best is to do like swiftlint...
I make some test with swiftlint on this project which defined - Sources
$ swiftlint --path Sources/ --config $(pwd)/.swiftlint.yml
Loading configuration from '/Users/phimage/Dev/GitHub/IBLinter/.swiftlint.yml'
Linting Swift files at paths Sources/
No lintable files found at paths: 'Sources/'
So he look files according to "--path" option, the working directory (so Sources/Sources and find nothing)
What I get with the tests is this:
The storyboard I want to ignore is Apps/MyApp/WatchKitApp/Shared/Base.lproj/Interface.storyboard
So I put this in my .iblinter.yml
:
excluded:
- Apps/MyApp/WatchKitApp/Shared
When running from the location of the config:
# From location of .iblinter.yml
iblinter --config $(pwd)/.iblinter.yml
# or
iblinter
The file gets ignored as expected.
When running like so:
iblinter --config $(pwd)/.iblinter.yml --path Apps/MyApp/WatchKitApp/Shared
the file is linted.
I think this is how SwiftLint is behaving.
Overall, the main reason I wanted to ignore storyboard is because it was crashing (https://github.com/IBDecodable/IBLinter/issues/104). Now when there is no crash, it becomes less critical.
So we could do better than swiftlint by making an other option in command or in configuration file, to specify that file path are relative to configuration file, and not working directory But I have no time for this, if someone want to do it ;)
Hi there
So I'm facing the issue which is actually very common for all other linters and formatters, such as SwiftLint and SwiftFormat.
I've created a file called
.iblinter.yml
in my project root folder, and I choose to ignore all storyboards inExample/Storyboards
path.This all works as expected if I just run
iblinter
in the root folder.But, if I use
--path
option, e.g.iblinter --path Example
, then IBLinter ignores my config file even if I run this command from the project root.As I said, this is not something specific for IBLinter, SwiftFormat and SwiftLint have same behavior. While I must say
rubocop
is different and respects config files from the project root.With SwiftLint and SwiftFormat I was able to use
-c / --config
option and tell the tools that doesn't matter which paths I want to check, they still should use specific config file.IBLinter is missing the
-c / --config
option though.Could this option be added?
Then I would be able to run
and all my custom rules / exclude paths defined in the config will still apply