ansible / ansible-lint

ansible-lint checks playbooks for practices and behavior that could potentially be improved and can fix some of the most common ones for you
https://ansible.readthedocs.io/projects/lint/
GNU General Public License v3.0
3.47k stars 655 forks source link

role-name in a skip_list not loading #2664

Closed y0rune closed 1 year ago

y0rune commented 1 year ago
Summary

After added the file .ansible-lint, the file has been loaded to the settings but still I got the error with it. Error:

...
As an alternative, you can add 'role-name' to either skip_list or warn_list.

As you can see below (from -vv) the skip list and all settings has been loaded/

Issue Type
Ansible and Ansible Lint details
$ ansible --version
ansible [core 2.14.0]
  config file = None
  configured module search path = ['/home/yorune/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/yorune/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/yorune/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/yorune/.local/bin/ansible
  python version = 3.10.4 (main, Mar 31 2022, 13:15:24) [GCC 9.3.0] (/usr/lib/python-exec/python3.10/python3)
  jinja version = 3.1.2
  libyaml = True

$ ansible-lint --version
ansible-lint 6.8.6 using ansible 2.14.0
OS / ENVIRONMENT

OS: Gentoo

yorune@Gentoo-d9yc132 ~ master $ emerge --info                                                                                                                                                                                                                  

Portage 3.0.30 (python 3.9.12-final-0, default/linux/amd64/17.1, gcc-10.3.0, glibc-2.35-r7, 5.4.66-gentoo-x86_64 x86_64)                                                                                                                                        

=================================================================                                                                                                                                                                                               

System uname: Linux-5.4.66-gentoo-x86_64-x86_64-Intel-R-_Core-TM-_i7-4790_CPU_@_3.60GHz-with-glibc2.35                                                                                                                                                          

KiB Mem:    16303496 total,   1488888 free                                                                                                                                                                                                                      

KiB Swap:          0 total,         0 free                                                                                                                                                                                                                      

Timestamp of repository gentoo: Wed, 19 Oct 2022 12:02:06 +0000 
Behaviour
$ ansible-lint --force-color -vv
DEBUG    Logging initialized to level 10
DEBUG    Options: Namespace(cache_dir='/home/yorune/.cache/ansible-compat/178b82', colored=True, configured=True, cwd=PosixPath('/home/yorune/repo/certificate-to-cacerts'), display_relative_path=True, exclude_paths=['.cache', '.git', '.hg', '.svn', '.tox'], format='rich', lintables=[], listrules=False, listtags=False, write_list=[], parseable=False, quiet=False, rulesdirs=['/home/yorune/.local/lib/python3.10/site-packages/ansiblelint/rules'], skip_list=['role-name'], tags=[], verbosity=2, warn_list=['avoid-implicit', 'experimental', 'fqcn[action]', 'fqcn[redirect]', 'jinja[spacing]', 'name[casing]', 'name[play]', 'role-name', 'warning[empty-playbook]', 'role-name[path]'], kinds=[{'jinja2': '**/*.j2'}, {'jinja2': '**/*.j2.*'}, {'yaml': '.github/**/*.{yaml,yml}'}, {'text': '**/templates/**/*.*'}, {'execution-environment': '**/execution-environment.yml'}, {'ansible-lint-config': '**/.ansible-lint'}, {'ansible-lint-config': '**/.config/ansible-lint.yml'}, {'ansible-navigator-config': '**/ansible-navigator.{yaml,yml}'}, {'inventory': '**/inventory/**.{yaml,yml}'}, {'requirements': '**/meta/requirements.{yaml,yml}'}, {'galaxy': '**/galaxy.yml'}, {'reno': '**/releasenotes/*/*.{yaml,yml}'}, {'tasks': '**/tasks/**/*.{yaml,yml}'}, {'playbook': '**/playbooks/*.{yml,yaml}'}, {'playbook': '**/*playbook*.{yml,yaml}'}, {'role': '**/roles/*/'}, {'handlers': '**/handlers/*.{yaml,yml}'}, {'vars': '**/{host_vars,group_vars,vars,defaults}/**/*.{yaml,yml}'}, {'test-meta': '**/tests/integration/targets/*/meta/main.{yaml,yml}'}, {'meta': '**/meta/main.{yaml,yml}'}, {'meta-runtime': '**/meta/runtime.{yaml,yml}'}, {'arg_specs': '**/meta/argument_specs.{yaml,yml}'}, {'yaml': '.config/molecule/config.{yaml,yml}'}, {'requirements': '**/molecule/*/{collections,requirements}.{yaml,yml}'}, {'yaml': '**/molecule/*/{base,molecule}.{yaml,yml}'}, {'requirements': '**/requirements.{yaml,yml}'}, {'playbook': '**/molecule/*/*.{yaml,yml}'}, {'yaml': '**/{.ansible-lint,.yamllint}'}, {'yaml': '**/*.{yaml,yml}'}, {'yaml': '**/.*.{yaml,yml}'}], mock_filters=[], mock_modules=[], mock_roles=[], loop_var_prefix=None, var_naming_pattern=None, offline=False, project_dir='.', extra_vars=None, enable_list=[], skip_action_validation=True, strict=False, rules={}, profile=None, progressive=False, rulesdir=[], use_default_rules=False, config_file='/home/yorune/repo/certificate-to-cacerts/.ansible-lint', version=False, cache_dir_lock=<filelock._unix.UnixFileLock object at 0x7fe417737d00>)
DEBUG    /home/yorune/repo/certificate-to-cacerts
DEBUG    Effective yamllint rules used: {'braces': {'level': 'error', 'forbid': False, 'min-spaces-inside': 0, 'max-spaces-inside': 1, 'min-spaces-inside-empty': -1, 'max-spaces-inside-empty': -1}, 'brackets': {'level': 'error', 'forbid': False, 'min-spaces-inside': 0, 'max-spaces-inside': 0, 'min-spaces-inside-empty': -1, 'max-spaces-inside-empty': -1}, 'colons': {'level': 'error', 'max-spaces-before': 0, 'max-spaces-after': 1}, 'commas': {'level': 'error', 'max-spaces-before': 0, 'min-spaces-after': 1, 'max-spaces-after': 1}, 'comments': {'level': 'warning', 'require-starting-space': True, 'ignore-shebangs': True, 'min-spaces-from-content': 1}, 'comments-indentation': False, 'document-end': False, 'document-start': False, 'empty-lines': {'level': 'error', 'max': 2, 'max-start': 0, 'max-end': 0}, 'empty-values': False, 'float-values': False, 'hyphens': {'level': 'error', 'max-spaces-after': 1}, 'indentation': {'level': 'error', 'spaces': 'consistent', 'indent-sequences': True, 'check-multi-line-strings': False}, 'key-duplicates': {'level': 'error'}, 'key-ordering': False, 'line-length': {'level': 'error', 'max': 160, 'allow-non-breakable-words': True, 'allow-non-breakable-inline-mappings': False}, 'new-line-at-end-of-file': {'level': 'error'}, 'new-lines': {'level': 'error', 'type': 'unix'}, 'octal-values': False, 'quoted-strings': False, 'trailing-spaces': {'level': 'error'}, 'truthy': {'level': 'warning', 'allowed-values': ['true', 'false'], 'check-keys': True}}
INFO     Set ANSIBLE_LIBRARY=/home/yorune/.cache/ansible-compat/178b82/modules:/home/yorune/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/home/yorune/.cache/ansible-compat/178b82/collections:/home/yorune/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/home/yorune/.cache/ansible-compat/178b82/roles:/home/yorune/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
ERROR    Computed fully qualified role name of certificate-to-cacerts does not follow current galaxy requirements.
Please edit meta/main.yml and assure we can correctly determine full role name:

galaxy_info:
role_name: my_name  # if absent directory name hosting role is used instead
namespace: my_galaxy_namespace  # if absent, author is used instead

Namespace: https://galaxy.ansible.com/docs/contributing/namespaces.html#galaxy-namespace-limitations
Role: https://galaxy.ansible.com/docs/contributing/creating_role.html#role-names

As an alternative, you can add 'role-name' to either skip_list or warn_list.

Computed fully qualified role name of certificate-to-cacerts does not follow current galaxy requirements.
Please edit meta/main.yml and assure we can correctly determine full role name:

galaxy_info:
role_name: my_name  # if absent directory name hosting role is used instead
namespace: my_galaxy_namespace  # if absent, author is used instead

Namespace: https://galaxy.ansible.com/docs/contributing/namespaces.html#galaxy-namespace-limitations
Role: https://galaxy.ansible.com/docs/contributing/creating_role.html#role-names

As an alternative, you can add 'role-name' to either skip_list or warn_list.
Expected Behavior

That skip list should be skipped.

rekup commented 1 year ago

We recently ran into the same issue and I made an attempt to fix this in https://github.com/ansible/ansible-lint/pull/2706. A review/feedback would be highly appreciated since I'm not really familiar with the ansible-lint codebase.