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

Allow parent config as an argument #5421

Open
2 tasks done
tahirmt opened this issue Jan 16, 2024 · 4 comments
Open
2 tasks done

Allow parent config as an argument #5421

tahirmt opened this issue Jan 16, 2024 · 4 comments

Comments

@tahirmt
Copy link

tahirmt commented Jan 16, 2024

New Issue Checklist

Feature Request

I would like to add --parent-config argument to the lint command. That way we don't have to specify the parent-config: inside of the config file. The use case for this is that the parent config path is not known ahead of time and I need to pass it in from a temporary directory where it is pulled and I don't control the path of the directory.

This is how it would look

swiftlint lint --parent-config "path/to/config" 

It would add the parent config to the .swiftlint config file it reads during execution.

@SimplyDanny
Copy link
Collaborator

You can also pass multiple configurations to the command in which case the first configuration is treated as a parent and the second one as a child. Is this already sufficient for your use case?

@tahirmt
Copy link
Author

tahirmt commented Jan 16, 2024

@SimplyDanny I didn't know about this. This might work. Do you know if in this case any further children would still be able to override any rules if they want. e.g for this directory structure

  • .swiftlint.yml
  • ChildFolder
    - .swiftlint.yml
  • OtherChild
    - .swiftlint.yml

So in this case if I run swiftlint lint --config "some/parent/config" --config ".swiftlint.yml" would it allow the child folders to override rules? In any case I am going to try it out and if it works I'll close this ticket and comment here

@tahirmt
Copy link
Author

tahirmt commented Jan 16, 2024

I don't think it works. There is also this comment there

So if you want to use nested configurations, you can't use the --config parameter.

@tahirmt
Copy link
Author

tahirmt commented Jan 16, 2024

I noticed another issue.. If I pass in the path to lint then the .swiftlint.yml config files are not read at all and it only runs the default rules and since I can't use nested configs when using --config argument that completely breaks it.

swiftlint lint sources/path will ignore the config defined at sources/path/.swiftlint.yml and instead just use the default rules.

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

No branches or pull requests

3 participants
@tahirmt @SimplyDanny and others