You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using --path option ignores the root folder config file #105
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 in Example/Storyboards path.
excluded:
- Example/Storyboards
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
iblinter --config $(pwd)/.iblinter.yml --path Example
and all my custom rules / exclude paths defined in the config will still apply
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.
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)
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 ;)
Activity
phimage commentedon May 30, 2019
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!
mgrebenets commentedon May 30, 2019
I agree with the points, there's no such thing as root folder.
I personally like
rubocopbehavior more, where exclude paths are relative to the location of the config file, and not to the location specified by--pathoption.Regardless, it would be nice to have
--configoption that behaves same way the SwiftLint's--configoption behaves.I've changed the title to make this a feature request rather than issue with
--path.phimage commentedon Jun 3, 2019
--configis now merged, but not released (need to fix the bug about watchkit before)phimage commentedon Jun 3, 2019
@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
and not
I think the best is to do like swiftlint...
phimage commentedon Jun 3, 2019
I make some test with swiftlint on this project which defined
- SourcesSo he look files according to "--path" option, the working directory (so Sources/Sources and find nothing)
mgrebenets commentedon Jun 4, 2019
What I get with the tests is this:
The storyboard I want to ignore is
Apps/MyApp/WatchKitApp/Shared/Base.lproj/Interface.storyboardSo I put this in my
.iblinter.yml:When running from the location of the config:
The file gets ignored as expected.
When running like so:
iblinter --config $(pwd)/.iblinter.yml --path Apps/MyApp/WatchKitApp/Sharedthe 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 (#104). Now when there is no crash, it becomes less critical.
phimage commentedon Jun 4, 2019
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 ;)