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

Make all rule identifiers text based #1306

Merged
merged 1 commit into from Feb 6, 2021
Merged

Make all rule identifiers text based #1306

merged 1 commit into from Feb 6, 2021

Conversation

ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented Feb 4, 2021

As we v5 is already a major version, we also take the opportunity to replace all numeric rule ids with text one, like pylint has.

The main reason for this is that the numeric ones were cryptic, while the new ones should be self-documented, at least for most cases.

While this rule changes the output due to new codes being printed it is backwards compatible as old codes are recognized, so users are not forced to update their skip lists when they upgrade. This should ease upgrades.

Checklist

  • gather feedback from users regarding proposed new ids
  • verify that generated documentation (RTD job output on github) for rules and command line listing via -L produce better results than in the past
  • review listing of tags (categories) -T and assure that we do not have incorrect, redundant or confusing entries
  • add aliases for old id to new ones and print warning, to allow people to migrate without forcing them to it right away
  • add a safety check to enforce use of lowercase-with-dashes for rule ids, so we assure they remain consistent.

Example output of new rule IDs, do you find one that does not make sense? or that can better rephrased? Keep in mind that these IDs must be under ~30ch, and that they are followed by their shortdesc in most cases.:

# ansible-liunt -T
# List of tags and rules they cover
command-shell:  # Specific to use of command and shell modules
  - command-instead-of-module
  - command-instead-of-shell
  - deprecated-command-syntax
  - inline-env-var
  - no-changed-when
  - risky-shell-pipe
core:  # Related to internal implementation of the linter
  - internal-error
  - load-failure
  - parser-error
  - syntax-check
deprecations:  # Indicate use of features that are removed from Ansible
  - deprecated-bare-vars
  - deprecated-command-syntax
  - deprecated-local-action
  - deprecated-module
  - no-jinja-when
  - role-name
experimental:  # Newly introduced rules, by default triggering only warnings
  - risky-file-permisions
formatting:  # Related to code-style
  - no-jinja-nesting
  - no-tabs
  - playbook-extension
  - risky-octal
  - var-spacing
  - yaml
idempotency:  # Possible indication that consequent runs would produce different results
  - git-latest
  - hg-latest
  - no-changed-when
  - package-latest
idiom:  # Anti-pattern detected, likely to cause undesired behavior
  - command-instead-of-module
  - command-instead-of-shell
  - empty-string-compare
  - inline-env-var
  - literal-compare
  - missing-import
  - no-handler
  - no-loop-var-prefix
  - no-relative-paths
  - unamed-task
metadata:  # Invalid metadata, likely related to galaxy, collections or roles
  - meta-incorrect
  - meta-no-info
  - meta-no-tags
  - meta-video-links
unpredictability:
  - partial-become
  - risky-file-permisions
yaml:  # External linter which will also produce its own rule codes.
  - yaml

@ssbarnea ssbarnea changed the title Refactor all rule identifiers POC: Refactor all rule identifiers Feb 4, 2021
@ssbarnea ssbarnea added feedback-needed Divergent oppinions, additional feedback is desired in order to unblock it. major Used for release notes, requires major versioning bump labels Feb 4, 2021
@ssbarnea ssbarnea marked this pull request as ready for review February 4, 2021 17:36
@ssbarnea ssbarnea force-pushed the 0/mock-roles branch 2 times, most recently from d1a0afa to 84d7c76 Compare February 5, 2021 12:11
@ssbarnea ssbarnea changed the title POC: Refactor all rule identifiers Make all rule identifiers text based Feb 5, 2021
@ssbarnea ssbarnea force-pushed the 0/mock-roles branch 2 times, most recently from 9ebf7e9 to e57150b Compare February 5, 2021 12:46
@ssbarnea ssbarnea added enhancement and removed major Used for release notes, requires major versioning bump labels Feb 5, 2021
Copy link

@samccann samccann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few misspellings...

docs/rules.rst Outdated Show resolved Hide resolved
src/ansiblelint/rules/MissingFilePermissionsRule.py Outdated Show resolved Hide resolved
src/ansiblelint/constants.py Outdated Show resolved Hide resolved
src/ansiblelint/constants.py Outdated Show resolved Hide resolved
src/ansiblelint/rules/TaskHasNameRule.py Outdated Show resolved Hide resolved
examples/playbooks/tasks/directory with spaces/main.yml Outdated Show resolved Hide resolved
examples/playbooks/tasks/simpletask.yml Outdated Show resolved Hide resolved
test/TestRulesCollection.py Outdated Show resolved Hide resolved
@ssbarnea ssbarnea merged commit 022f1ef into master Feb 6, 2021
@ssbarnea ssbarnea deleted the 0/mock-roles branch February 6, 2021 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feedback-needed Divergent oppinions, additional feedback is desired in order to unblock it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants