-
Notifications
You must be signed in to change notification settings - Fork 292
improve get_extended_config_file with expansions #767
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
base: master
Are you sure you want to change the base?
Conversation
Now I also improved code coverage a bit. You're welcome. |
Hello, Thanks for proposing this contribution! I'm not favorable to it, because:
I understand that your goal is to store custom linting rules in a separate repository. Have you tried letting your shell do the substitution, e.g. something like this? yamllint -d "extends: $HOME/repos/github.com/freehck/linting-rules/.yamllint" .
Thank you 😄 |
Okay, I understand your point: as variables are considered to be redundant due to the fact users can have But what's about
This won't help me a lot. What I tried to achieve is the ability to define the default profile for my company that can be used in different repos. This implies that different repos can use the same basis (default profile) but also provide repository-specific additions. F.e. in my ansible repo I have the following:
So rules, as you can see, are common and taken from Another example. I've put this into my terraform repo:
This specific additional rule is necessary because this repo has a bunch of yaml files that are already deployed to the production environment, and it'd redundant to enforce helm charts redeployment just because yaml files don't have So the situation is the same: common rules are taken from Therefore my proposal is the following: What would you think if I removed variables expansion but leaved tilde expansion? |
To clarify: I understand that Probably it'd be a better solution if we provide |
Like I think I understood your 2 real-life examples, although to be honest I'm not 100% sure. Anyway, if your goal is to extend different yamllint configurations depending on which user is running it, why do you need the $ su userA
$ pwd
/home/userA
$ yamllint -d "{extends: repos/…/main.yaml, ignore: […]}"
# yamllint should extend config from /home/userA/repos/…/main.yaml
# and compute ignore files from /home/userA $ su userB
$ pwd
/home/userB
$ yamllint -d "{extends: repos/…/main.yaml, ignore: […]}"
# yamllint should extend config from /home/userB/repos/…/main.yaml
# and compute ignore files from /home/userB |
Because it's inconvenient. In most cases we expect that a simple run of
Well okay, I got your point. So the suggested changes are considered as shell expansions and as my PR modifies this default behaviour it can harm users who have But I need it. Probably there're users who need it too. So I come with a new proposal. What if I add a new yamllint option, smth like Then we'll keep the default behaviour and allow users to activate shell expansion if they want. How do you feel about it? |
This PR improves get_extended_config_file function providing it with
the ability to expand variables and tilde so you can use more complex
values in
extends:
.Example 1:
Example 2:
Example 3:
This is useful to store company's linting rules in a separate
repository.