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

jinja[spacing] suggested change that will break the code #4330

Open
rpelisse opened this issue Sep 12, 2024 · 0 comments
Open

jinja[spacing] suggested change that will break the code #4330

rpelisse opened this issue Sep 12, 2024 · 0 comments
Labels

Comments

@rpelisse
Copy link

rpelisse commented Sep 12, 2024

Summary

In the following report, jinja[space] suggest to remove an extra backslash to fix the spacing, which would result in a change of behavior in the code.

roles/wildfly_utils/tasks/apply_cp.yml:60: jinja[spacing]: Jinja2 spacing could be improved: {{ rhn_products.results | map(attribute='file_path') | select('match', '^[^/]*/jboss-eap-.*[0-9]*[.][0-9]*[.][0-9]*.*$') | map('regex_replace','[^/]*/jboss-eap-([0-9]*[.][0-9]*[.][0-9]*)-.*','\1' ) | list | unique }} -> {{ rhn_products.results | map(attribute='file_path') | select('match', '^[^/]*/jboss-eap-.*[0-9]*[.][0-9]*[.][0-9]*.*$') | map('regex_replace', '[^/]*/jboss-eap-([0-9]*[.][0-9]*[.][0-9]*)-.*', '\1') | list | unique }} (warning)

Note the backlash in question is NOT shown above, but you see it in the code below:

    - name: Determine patch versions list
      ansible.builtin.set_fact:
        filtered_versions: "{{ rhn_products.results | map(attribute='file_path') | select('match', '^[^/]*/jboss-eap-.*[0-9]*[.][0-9]*[.][0-9]*.*$') | map('regex_replace','[^/]*/jboss-eap-([0-9]*[.][0-9]*[.][0-9]*)-.*','\\1' ) | list | unique }}"

The invalid suggestion is a bit problematic, but also, because of the bug causing, there is no way to get ride of the warning (without breaking the code or rewriting it differently to workaround the issue).

Issue Type
  • Bug Report
OS / ENVIRONMENT
(2.16) [root@79c4779411aa work]# cat /etc/redhat-release 
Fedora release 40 (Forty)
(2.16) [root@79c4779411aa work]# python --version
Python 3.12.5
(2.16) [root@79c4779411aa work]# ansible-lint --version
ansible-lint 24.9.0 using ansible-core:2.16.0 ansible-compat:24.9.0 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
STEPS TO REPRODUCE
$ git clone https://github.com/ansible-middleware/wildfly/ wildfly.git
$ cd wildfly.git/
$ git checkout -b lint-issue 396036f8bde3d1f75389ab98f9e98f98f015970f
$ ansible-lint # look for the warning on file roles/wildfly_install/tasks/prereqs.yml, line 71
Desired Behavior

This is false+ as I don't think there is any issue with the spacing, so the desired outcome would be that no warning is being filed against the line.

Actual Behavior

See description above.

@rpelisse rpelisse added bug new Triage required labels Sep 12, 2024
@alisonlhart alisonlhart removed the new Triage required label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Roadmap
Development

No branches or pull requests

2 participants