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

RFP: standardize in-repo custom rules locations #755

Closed
ssbarnea opened this issue May 1, 2020 · 4 comments
Closed

RFP: standardize in-repo custom rules locations #755

ssbarnea opened this issue May 1, 2020 · 4 comments

Comments

@ssbarnea
Copy link
Member

ssbarnea commented May 1, 2020

Summary

In order to make it easier for people to write custom rules inside their repositories, I would like to propose including a new folder in the default search path of the linter: {REPO}/.config/ansiblelint/rules. For backwards compatibility we would keep the existing default, the new path being added after it.

This is following the XDG config use-pattern and we can even use HOME when a repository is not detected. It avoids cluttering the repo root folder and is easy to expand in the future.

Issue Type
  • Feature Idea
Additional Information

For example I already implemented a similar feature in molecule which loads configuration from {REPO|HOME}/.config/molecule/config.yml. That pattern make it easy for users to understand that a repo-config takes precedence over a user-config.

Reference: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

@ssbarnea ssbarnea added priority/medium new Triage required labels May 1, 2020
@webknjaz
Copy link
Member

webknjaz commented May 1, 2020

Dunno about repo-local it might be a good idea. Inviting @cans, he may be interested in discussing this too.

This is following the XDG config use-pattern and we can even use HOME when a repository is not detected. It avoids cluttering the repo root folder and is easy to expand in the future.

The reason Ansible itself doesn't do this is security considerations. So I'd say no relying on XDG env vars.

@ericsysmin
Copy link

Following for sure, because this would simplify my repository layout much better than a bunch of .lint_config files

@ssbarnea
Copy link
Member Author

ssbarnea commented May 4, 2020

@ericsysmin I raised this because I seen other tool authors doing the same move, mainly people complained about getting too many config files inside the root of the repository.

ssato added a commit to ssato/ansible-lint that referenced this issue Jul 23, 2020
Make ansible-lint to find custom rules in rules/custom/*/ automatically
by default. Found custom rules will have higher priority than the
default rules.

This is an alternative way to accomplish the issue ansible#755.
@ssbarnea ssbarnea removed priority/medium new Triage required labels Jul 24, 2020
ssato added a commit to ssato/ansible-lint that referenced this issue Jul 28, 2020
Make ansible-lint to find custom rules in rules/custom/*/ automatically
by default. Found custom rules will have higher priority than the
default rules.

This is an alternative way to accomplish the issue ansible#755.
@ssbarnea
Copy link
Member Author

Closing as not being a priority but a pull request will be welcomed.

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

No branches or pull requests

3 participants