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

Update rules to utilize configurations per rule #1

Merged
merged 14 commits into from May 2, 2021
Merged

Conversation

ssato
Copy link
Owner

@ssato ssato commented May 2, 2021

Because github.com/ansible/ansible-lint#1534 was merged, we now can configure each rule by its own configurations in .ansible-lint. This change utilizes that and eliminate hacks to configure rules by environment variables.

ssato added 14 commits April 18, 2021 14:26
- allow to inject rule's configurations with the rule_options argument
  given to tests.common.runner.get_collection.
- add some test cases to confirm the above works
…ions

- tests.common.testcases.BaseTestCase.get_runner: create runner on
  demand when running linter, and allow to configure the behavior of the
  rule with the config argument
- tests.common.testcases.RuleTestCase.{run_playbook,lint}: allow to pass
  and set rule's configurations
- tests.common.testcases.CliTestCase: simplify and allow to configure
  the rule with configuration file
… 'debug'

Extend to allow to load and utilize rule's specific configurations
(rules.debug.enabled) for custom rule 'debug' to change its behavior.

- rules.DebugRule.DebugRule: now it can be enabled with .ansible-lint
  configuration (rules.debug.enabled) instead of an environment variable.
- tests.TestDebugRule: follow changes in the above class and inject its
  configuration as needed
Change to allow listing modules to block for the 'blocked_modules' rule
in ansible-lint's configuration file such like the following

  rules:
    blocked_modules:
      blocked:
        - shell
        - ping

- rules.BlockedModules.BlockedModules: now it can be configured to block
  modules in .ansible-lint configuration (rules.blocked_modules.blocked)
  instead of an environment variable.
- tests.TestBlockedModules: follow changes in the above class and inject
  its configuration as needed.
Utilize configurations for rules instead of environment variables.
@ssato ssato changed the base branch from master to next May 2, 2021 02:19
@ssato ssato added the enhancement New feature or request label May 2, 2021
@ssato ssato self-assigned this May 2, 2021
@ssato ssato merged commit fa08e4c into next May 2, 2021
@ssato ssato deleted the per-rule-configs branch May 2, 2021 02:29
@lgtm-com
Copy link

lgtm-com bot commented May 2, 2021

This pull request introduces 7 alerts and fixes 1 when merging 0d1aff1 into d624484 - view on LGTM.com

new alerts:

  • 4 for Module is imported with 'import' and 'import from'
  • 3 for Except block handles 'BaseException'

fixed alerts:

  • 1 for First parameter of a method is not named 'self'

@lgtm-com
Copy link

lgtm-com bot commented May 2, 2021

This pull request introduces 7 alerts when merging 0d1aff1 into 3419b87 - view on LGTM.com

new alerts:

  • 4 for Module is imported with 'import' and 'import from'
  • 3 for Except block handles 'BaseException'

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

Successfully merging this pull request may close these issues.

None yet

1 participant