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

[RFE] Implement transform (--write) functionality for applicable rules #3634

Closed
9 of 25 tasks
ganeshrn opened this issue Jul 27, 2023 · 7 comments
Closed
9 of 25 tasks
Labels
AAP Ansible Automation Platform critical enhancement

Comments

@ganeshrn ganeshrn added new Triage required bug enhancement and removed bug labels Jul 27, 2023
@bendem
Copy link
Contributor

bendem commented Jul 28, 2023

Maybe it would be best to stabilise the --write behaviour before implementing more of it? Currently, --write with no rules enabled will reformat every single file parsed based on the non-configurable rueaml parsers. Since the first lint rule is yamllint which has different default and is actually configurable, running ansible-lint with --write produces useless changes, breaks the rules defined in further linting and often times results in broken yaml.

See #3603, #3583, #3226, #2941, #2112.

Rule transforms should make the minimal amount of changes to the file that fixes the problem. Loading the whole file in memory and writing it back means all the formatting is lost which is (at least in my opinion) really problematic.

@cognifloyd
Copy link
Contributor

I have implementations for a variety of rules, but I held off putting them in until I could the the Jinja formatter. Sadly, work priorities have kept me away from this project for awhile but I hope to return to it. I just don't have a precise timeline.

@ganeshrn
Copy link
Member Author

ganeshrn commented Aug 2, 2023

@bendem Thanks for linking the related issues. We are looking into fixing those issues.

@cognifloyd A big thank you for contributing the transform feature. Can you please do a draft PR for rules that you have implemented the transform functionality? We can look into missing rules to implement the transform functionality.

@cidrblock
Copy link
Contributor

#3624

This is releated, we might want to take care of this prior to too many additions.

@audgirka audgirka removed the new Triage required label Aug 2, 2023
@justjais
Copy link

justjais commented Aug 7, 2023

@cognifloyd Thanks so much for your effort in implementing the transform features from Ansible Lint. As we're currently focusing on implementing transform capabilities for one's that's mentioned in the issue description, it'd be great if you can comment ASAP with the transform capabilities that you've already worked on, as that'd help us in not duplicating the work and the effort.

@trishnaguha trishnaguha added AAP Ansible Automation Platform critical labels Aug 8, 2023
@shatakshiiii
Copy link
Contributor

Some related bugs: #3670, #3662

@ssbarnea
Copy link
Member

I am going to close this as done as all the MUST have were implemented. This does not mean that we will not want to do the others, but we should consider this epic done for now.

Many of the ones that were not implemented were for good reasons: there is no safe way to do it programetely, a human needing to tune the result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AAP Ansible Automation Platform critical enhancement
Projects
Status: Backlog
Archived in project
Development

No branches or pull requests

9 participants