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

Rule name[casing] conflicts with COP 3.1.16 #2690

Closed
alice-rc opened this issue Nov 16, 2022 · 3 comments · Fixed by #2740
Closed

Rule name[casing] conflicts with COP 3.1.16 #2690

alice-rc opened this issue Nov 16, 2022 · 3 comments · Fixed by #2740
Assignees
Labels

Comments

@alice-rc
Copy link

alice-rc commented Nov 16, 2022

Summary

The current rule name[casing]: All names should start with an uppercase letter directly conflicts with
COP reference 3.1.16 Prefix names in sub-tasks files of roles with the subtask's filename (Example: subtask filename | subtask description)

Issue Type
  • Bug Report
Ansible and Ansible Lint details
ansible --version
ansible [core 2.13.4]
  config file = /home/USER/venv/ee-rcstandard-rhel8-183/meta/ansible.cfg
  configured module search path = ['/home/USER/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/USER/venv/ee-rcstandard-rhel8-183/lib64/python3.9/site-packages/ansible
  ansible collection location = /home/USER/venv/ee-rcstandard-rhel8-183/collections
  executable location = /home/USER/venv/ee-rcstandard-rhel8-183/bin/ansible
  python version = 3.9.7 (default, Apr 11 2022, 06:30:15) [GCC 8.5.0 20210514 (Red Hat 8.5.0-10.0.1)]
  jinja version = 3.1.2
  libyaml = True

ansible-lint --version
ansible-lint 6.8.6 using ansible 2.13.4
  • ansible installation method: pip
  • ansible-lint installation method: pip
OS / ENVIRONMENT

Not relevant, but Oracle Linux 8

STEPS TO REPRODUCE

Line in the ansible subtask file:

- name: type_server | Setting facts from CMDB info

Output from ansible-lint:

roles/cmdb/tasks/type_server.yml:1: name[casing]: All names should start with an uppercase letter.
Desired Behavior

The rule should NOT apply to the subtask portion of the task name, just the part that falls after the "|"

Actual Behavior

The correctly implemented COP 3.1.16 name is triggering the ansible-lint name[casing] rule

@alice-rc alice-rc added bug new Triage required labels Nov 16, 2022
@ssbarnea
Copy link
Member

@cidrblock WDYT about this, should we update the rule to document and support that? I looks a little bit weird to name a task foo | Do something but I do also understand why they wanted to add it.

@ssbarnea ssbarnea self-assigned this Nov 18, 2022
@alice-rc
Copy link
Author

alice-rc commented Nov 18, 2022

I found it extremely useful to put the the task file name in the task for large roles with a lot of includes. Even before I knew that rule 8.3 "Break complex task files down into discrete parts" existed I was doing something similar by putting the file name at the end of the task name.
eg.

- name: Doing something to something [task_file_name]

In fact you have already discussed how to go about limiting the number of tasks in a file (#2172). And the more modularity you build in, the more important this naming requirement becomes.

@cidrblock
Copy link
Contributor

I think we should allow for this, if the filename is correct. We can suggest it as an alternative and ref the COP repo.

If, over time, a different, more preferred pattern emerges, we can adapt to it.

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

Successfully merging a pull request may close this issue.

4 participants