├── rules ├── __init__.py ├── AlwaysRunRule.py ├── NoTabsRule.py ├── TrailingWhitespaceRule.py ├── LineTooLongRule.py ├── VariableHasSpacesRule.py ├── GitHasVersionRule.py ├── TaskNoLocalAction.py ├── ComparisonToLiteralBoolRule.py ├── ComparisonToEmptyStringRule.py ├── MercurialHasRevisionRule.py ├── TaskHasNameRule.py ├── PlaybookExtension.py ├── BecomeUserWithoutBecomeRule.py ├── UseHandlerRatherThanWhenChangedRule.py ├── CommandHasChangesCheckRule.py ├── UseCommandInsteadOfShellRule.py ├── MetaChangeFromDefaultRule.py ├── EnvVarsInCommandRule.py ├── PackageIsNotLatestRule.py ├── MetaMainHasInfoRule.py ├── SudoRule.py ├── NoFormattingInWhenRule.py ├── DeprecatedModuleRule.py ├── RoleRelativePath.py ├── CommandsInsteadOfArgumentsRule.py ├── MetaTagValidRule.py ├── PackageHasRetryRule.py ├── CommandsInsteadOfModulesRule.py ├── MetaVideoLinksRule.py ├── UsingBareVariablesIsDeprecatedRule.py └── OctalPermissionsRule.py ├── README.md ├── .gitignore ├── generate_docs.py ├── RULE_DOCS.md └── LICENSE /rules/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | galaxy-lint-rules 2 | ================= 3 | 4 | This repo is archived. All feedback for ansible-lint rules should be made in https://github.com/ansible/ansible-lint 5 | -------------------------------------------------------------------------------- /rules/AlwaysRunRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class AlwaysRunRule(AnsibleLintRule): 8 | id = '101' 9 | shortdesc = 'Deprecated always_run' 10 | description = 'Instead of always_run, use check_mode.' 11 | tags = ['deprecated'] 12 | 13 | def matchtask(self, file, task): 14 | return 'always_run' in task 15 | -------------------------------------------------------------------------------- /rules/NoTabsRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class NoTabsRule(AnsibleLintRule): 8 | id = '203' 9 | shortdesc = 'Most files should not contain tabs' 10 | description = 'Tabs can cause unexpected display issues. Use spaces' 11 | tags = ['formatting'] 12 | 13 | def match(self, file, line): 14 | return '\t' in line 15 | -------------------------------------------------------------------------------- /rules/TrailingWhitespaceRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class TrailingWhitespaceRule(AnsibleLintRule): 8 | id = '201' 9 | shortdesc = 'Trailing whitespace' 10 | description = 'There should not be any trailing whitespace' 11 | tags = ['formatting'] 12 | 13 | def match(self, file, line): 14 | return line.rstrip() != line 15 | -------------------------------------------------------------------------------- /rules/LineTooLongRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class LineTooLongRule(AnsibleLintRule): 8 | id = '204' 9 | shortdesc = 'Lines should be no longer than 120 chars' 10 | description = 'Long lines make code harder to read and ' \ 11 | 'code review more difficult' 12 | tags = ['formatting'] 13 | 14 | def match(self, file, line): 15 | return len(line) > 120 16 | -------------------------------------------------------------------------------- /rules/VariableHasSpacesRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | import re 6 | 7 | 8 | class VariableHasSpacesRule(AnsibleLintRule): 9 | id = '206' 10 | shortdesc = 'Variables should have spaces after {{ and before }}' 11 | description = 'Variables should be of the form {{ varname }}' 12 | tags = ['formatting'] 13 | 14 | bracket_regex = re.compile("{{[^{ ]|[^ }]}}") 15 | 16 | def match(self, file, line): 17 | return self.bracket_regex.search(line) 18 | -------------------------------------------------------------------------------- /rules/GitHasVersionRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class GitHasVersionRule(AnsibleLintRule): 8 | id = '401' 9 | shortdesc = 'Git checkouts must contain explicit version' 10 | description = 'All version control checkouts must point to ' + \ 11 | 'an explicit commit or tag, not just "latest"' 12 | tags = ['module'] 13 | 14 | def matchtask(self, file, task): 15 | return (task['action']['__ansible_module__'] == 'git' and 16 | task['action'].get('version', 'HEAD') == 'HEAD') 17 | -------------------------------------------------------------------------------- /rules/TaskNoLocalAction.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class TaskNoLocalAction(AnsibleLintRule): 8 | id = '504' 9 | shortdesc = ("Use 'connection: local' or 'delegate_to: localhost' " 10 | "instead of 'local_action'") 11 | description = ("Use 'connection: local' or 'delegate_to: localhost' " 12 | "instead of 'local_action'") 13 | tags = ['task'] 14 | 15 | def match(self, file, text): 16 | if 'local_action' in text: 17 | return True 18 | return False 19 | -------------------------------------------------------------------------------- /rules/ComparisonToLiteralBoolRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | import re 6 | 7 | 8 | class ComparisonToLiteralBoolRule(AnsibleLintRule): 9 | id = '601' 10 | shortdesc = "Don't compare to literal True/False" 11 | description = 'Use `when: var` rather than `when: var == True` ' \ 12 | '(or conversely `when: not var`)' 13 | tags = ['idiom'] 14 | literal_bool_compare = re.compile("[=!]= ?(True|true|False|false)") 15 | 16 | def match(self, file, line): 17 | return self.literal_bool_compare.search(line) 18 | -------------------------------------------------------------------------------- /rules/ComparisonToEmptyStringRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | import re 6 | 7 | 8 | class ComparisonToEmptyStringRule(AnsibleLintRule): 9 | id = '602' 10 | shortdesc = "Don't compare to empty string" 11 | description = 'Use `when: var` rather than `when: var != ""` (or ' \ 12 | 'conversely `when: not var` rather than `when: var == ""`)' 13 | tags = ['idiom'] 14 | empty_string_compare = re.compile("[=!]= ?[\"'][\"']") 15 | 16 | def match(self, file, line): 17 | return self.empty_string_compare.search(line) 18 | -------------------------------------------------------------------------------- /rules/MercurialHasRevisionRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class MercurialHasRevisionRule(AnsibleLintRule): 8 | id = '402' 9 | shortdesc = 'Mercurial checkouts must contain explicit revision' 10 | description = 'All version control checkouts must point to ' + \ 11 | 'an explicit commit or tag, not just "latest"' 12 | 13 | tags = ['module'] 14 | 15 | def matchtask(self, file, task): 16 | return (task['action']['__ansible_module__'] == 'hg' and 17 | task['action'].get('revision', 'default') == 'default') 18 | -------------------------------------------------------------------------------- /rules/TaskHasNameRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class TaskHasNameRule(AnsibleLintRule): 8 | id = '502' 9 | shortdesc = 'All tasks should be named' 10 | description = 'All tasks should have a distinct name for readability ' + \ 11 | 'and for --start-at-task to work' 12 | tags = ['task'] 13 | 14 | _nameless_tasks = ['meta', 'debug', 'include_role', 'import_role', 15 | 'include_tasks', 'import_tasks'] 16 | 17 | def matchtask(self, file, task): 18 | return (not task.get('name') and 19 | task["action"]["__ansible_module__"] not in self._nameless_tasks) 20 | -------------------------------------------------------------------------------- /rules/PlaybookExtension.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | import os 7 | 8 | 9 | class PlaybookExtension(AnsibleLintRule): 10 | id = '205' 11 | shortdesc = 'Playbooks should have the ".yml" extension' 12 | description = '' 13 | tags = ['formatting'] 14 | done = [] # already noticed path list 15 | 16 | def match(self, file, text): 17 | if file['type'] != 'playbook': 18 | return False 19 | 20 | path = file['path'] 21 | ext = os.path.splitext(path) 22 | if ext[1] not in ['.yml', '.yaml'] and path not in self.done: 23 | self.done.append(path) 24 | return True 25 | return False 26 | -------------------------------------------------------------------------------- /rules/BecomeUserWithoutBecomeRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | def _become_user_without_become(data): 8 | return 'become_user' in data and 'become' not in data 9 | 10 | 11 | class BecomeUserWithoutBecomeRule(AnsibleLintRule): 12 | id = '501' 13 | shortdesc = 'become_user requires become to work as expected' 14 | description = 'become_user without become will not actually change ' \ 15 | 'user' 16 | tags = ['task'] 17 | 18 | def matchplay(self, file, data): 19 | if file['type'] == 'playbook' and _become_user_without_become(data): 20 | return ({'become_user': data}, self.shortdesc) 21 | 22 | def matchtask(self, file, task): 23 | return _become_user_without_become(task) 24 | -------------------------------------------------------------------------------- /rules/UseHandlerRatherThanWhenChangedRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | import six 5 | 6 | from ansiblelint import AnsibleLintRule 7 | 8 | 9 | def _changed_in_when(item): 10 | return any(changed in item for changed in 11 | ['.changed', '|changed', '["changed"]', "['changed']"]) 12 | 13 | 14 | class UseHandlerRatherThanWhenChangedRule(AnsibleLintRule): 15 | id = '503' 16 | shortdesc = 'Tasks that run when changed should likely be handlers' 17 | description = "If a task has a `when: result.changed` setting, it's " \ 18 | "effectively acting as a handler" 19 | tags = ['task'] 20 | 21 | def matchtask(self, file, task): 22 | if task["__ansible_action_type__"] == 'task': 23 | when = task.get('when') 24 | if isinstance(when, list): 25 | for item in when: 26 | if _changed_in_when(item): 27 | return True 28 | if isinstance(when, six.string_types): 29 | return _changed_in_when(when) 30 | -------------------------------------------------------------------------------- /rules/CommandHasChangesCheckRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class CommandHasChangesCheckRule(AnsibleLintRule): 8 | id = '301' 9 | shortdesc = 'Commands should not change things if nothing needs doing' 10 | description = 'Commands should either read information (and thus set ' \ 11 | 'changed_when) or not do something if it has already been ' \ 12 | 'done (using creates/removes) or only do it if another ' \ 13 | 'check has a particular result (when)' 14 | tags = ['command-shell'] 15 | 16 | _commands = ['command', 'shell', 'raw'] 17 | 18 | def matchtask(self, file, task): 19 | if task["__ansible_action_type__"] == 'task': 20 | if task["action"]["__ansible_module__"] in self._commands: 21 | return 'changed_when' not in task and \ 22 | 'when' not in task and \ 23 | 'creates' not in task['action'] and \ 24 | 'removes' not in task['action'] 25 | -------------------------------------------------------------------------------- /rules/UseCommandInsteadOfShellRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | import re 6 | 7 | 8 | def unjinja(text): 9 | return re.sub(r"{{[^}]*}}", "JINJA_VAR", text) 10 | 11 | 12 | class UseCommandInsteadOfShellRule(AnsibleLintRule): 13 | id = '305' 14 | shortdesc = 'Use shell only when shell functionality is required' 15 | description = 'Shell should only be used when piping, redirecting ' \ 16 | 'or chaining commands (and Ansible would be preferred ' \ 17 | 'for some of those!)' 18 | tags = ['command-shell'] 19 | 20 | def matchtask(self, file, task): 21 | # Use unjinja so that we don't match on jinja filters 22 | # rather than pipes 23 | if task["action"]["__ansible_module__"] == 'shell': 24 | if 'cmd' in task['action']: 25 | unjinjad_cmd = unjinja(task["action"].get("cmd", [])) 26 | else: 27 | unjinjad_cmd = unjinja(' '.join(task["action"].get("__ansible_arguments__", []))) 28 | return not any([ch in unjinjad_cmd for ch in '&|<>;$\n*[]{}?']) 29 | -------------------------------------------------------------------------------- /rules/MetaChangeFromDefaultRule.py: -------------------------------------------------------------------------------- 1 | from ansiblelint import AnsibleLintRule 2 | 3 | 4 | class MetaChangeFromDefaultRule(AnsibleLintRule): 5 | id = '703' 6 | shortdesc = 'meta/main.yml default values should be changed' 7 | field_defaults = [ 8 | ('author', 'your name'), 9 | ('description', 'your description'), 10 | ('company', 'your company (optional)'), 11 | ('license', 'license (GPLv2, CC-BY, etc)'), 12 | ] 13 | description = ('meta/main.yml default values should be changed for: ' + 14 | ', '.join([f[0] for f in field_defaults])) 15 | tags = ['metadata'] 16 | 17 | def matchplay(self, file, data): 18 | if file['type'] != 'meta': 19 | return False 20 | 21 | galaxy_info = data.get('galaxy_info', None) 22 | if not galaxy_info: 23 | return False 24 | 25 | results = [] 26 | for field, default in self.field_defaults: 27 | value = galaxy_info.get(field, None) 28 | if value and value == default: 29 | results.append(({'meta/main.yml': data}, 30 | 'Should change default metadata: %s' % field)) 31 | 32 | return results 33 | -------------------------------------------------------------------------------- /rules/EnvVarsInCommandRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | from ansiblelint.utils import LINE_NUMBER_KEY, FILENAME_KEY 6 | 7 | 8 | class EnvVarsInCommandRule(AnsibleLintRule): 9 | id = '304' 10 | shortdesc = "Environment variables don't work as part of command" 11 | description = 'Environment variables should be passed to shell or ' \ 12 | 'command through environment argument' 13 | tags = ['command-shell'] 14 | 15 | expected_args = ['chdir', 'creates', 'executable', 16 | 'removes', 'stdin', 'warn', 17 | 'cmd', '__ansible_module__', '__ansible_arguments__', 18 | LINE_NUMBER_KEY, FILENAME_KEY] 19 | 20 | def matchtask(self, file, task): 21 | if task["action"]["__ansible_module__"] in ['shell', 'command']: 22 | if 'cmd' in task['action']: 23 | first_cmd_arg = task['action']['cmd'].split()[0] 24 | else: 25 | first_cmd_arg = task['action']['__ansible_arguments__'][0] 26 | return any([arg not in self.expected_args for arg in task['action']] + 27 | ["=" in first_cmd_arg]) 28 | -------------------------------------------------------------------------------- /rules/PackageIsNotLatestRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class PackageIsNotLatestRule(AnsibleLintRule): 8 | id = '403' 9 | shortdesc = 'Package installs should not use latest' 10 | description = 'Package installs should use state=present ' + \ 11 | 'with or without a version' 12 | tags = ['module'] 13 | 14 | _package_managers = [ 15 | 'apk', 16 | 'apt', 17 | 'bower', 18 | 'bundler', 19 | 'dnf', 20 | 'easy_install', 21 | 'gem', 22 | 'homebrew', 23 | 'jenkins_plugin', 24 | 'npm', 25 | 'openbsd_package', 26 | 'openbsd_pkg', 27 | 'package', 28 | 'pacman', 29 | 'pear', 30 | 'pip', 31 | 'pkg5', 32 | 'pkgutil', 33 | 'portage', 34 | 'slackpkg', 35 | 'sorcery', 36 | 'swdepot', 37 | 'win_chocolatey', 38 | 'yarn', 39 | 'yum', 40 | 'zypper', 41 | ] 42 | 43 | def matchtask(self, file, task): 44 | return (task['action']['__ansible_module__'] in self._package_managers and 45 | task['action'].get('state') == 'latest') 46 | -------------------------------------------------------------------------------- /rules/MetaMainHasInfoRule.py: -------------------------------------------------------------------------------- 1 | from ansiblelint import AnsibleLintRule 2 | 3 | 4 | class MetaMainHasInfoRule(AnsibleLintRule): 5 | id = '701' 6 | shortdesc = 'meta/main.yml should contain relevant info' 7 | info = ['author', 'description', 8 | 'license', 'min_ansible_version', 'platforms'] 9 | description = 'meta/main.yml should contain: ' + ', '.join(info) 10 | tags = ['metadata'] 11 | 12 | def matchplay(self, file, data): 13 | if file['type'] != 'meta': 14 | return False 15 | 16 | galaxy_info = data.get('galaxy_info', None) 17 | if not galaxy_info: 18 | return [({'meta/main.yml': data}, 19 | "No 'galaxy_info' found")] 20 | 21 | results = [] 22 | for info in self.info: 23 | if not galaxy_info.get(info, None): 24 | results.append(({'meta/main.yml': data}, 25 | 'Role info should contain %s' % info)) 26 | 27 | platforms = galaxy_info.get('platforms', None) 28 | if platforms: 29 | for platform in platforms: 30 | if not platform.get('name', None): 31 | results.append(({'meta/main.yml': data}, 32 | 'Platform should contain name')) 33 | 34 | return results 35 | -------------------------------------------------------------------------------- /rules/SudoRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class SudoRule(AnsibleLintRule): 8 | id = '103' 9 | shortdesc = 'Deprecated sudo' 10 | description = 'Instead of sudo/sudo_user, use become/become_user.' 11 | tags = ['deprecated'] 12 | 13 | def _check_value(self, play_frag): 14 | results = [] 15 | 16 | if isinstance(play_frag, dict): 17 | if 'sudo' in play_frag: 18 | results.append(({'sudo': play_frag['sudo']}, 19 | 'deprecated sudo feature')) 20 | if 'sudo_user' in play_frag: 21 | results.append(({'sudo_user': play_frag['sudo_user']}, 22 | 'deprecated sudo_user feature')) 23 | if 'tasks' in play_frag: 24 | output = self._check_value(play_frag['tasks']) 25 | if output: 26 | results += output 27 | 28 | if isinstance(play_frag, list): 29 | for item in play_frag: 30 | output = self._check_value(item) 31 | if output: 32 | results += output 33 | 34 | return results 35 | 36 | def matchplay(self, file, play): 37 | return self._check_value(play) 38 | -------------------------------------------------------------------------------- /rules/NoFormattingInWhenRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | try: 6 | from types import StringTypes 7 | except ImportError: 8 | # Python3 removed types.StringTypes 9 | StringTypes = str, 10 | 11 | 12 | class NoFormattingInWhenRule(AnsibleLintRule): 13 | id = '102' 14 | shortdesc = 'No Jinja2 in when' 15 | description = '"when" lines should not include Jinja2 variables' 16 | tags = ['deprecated'] 17 | 18 | def _is_valid(self, when): 19 | if not isinstance(when, StringTypes): 20 | return True 21 | return when.find('{{') == -1 and when.find('}}') == -1 22 | 23 | def matchplay(self, file, play): 24 | errors = [] 25 | if isinstance(play, dict): 26 | if 'roles' not in play: 27 | return errors 28 | for role in play['roles']: 29 | if self.matchtask(file, role): 30 | errors.append(({'when': role}, 31 | 'role "when" clause has Jinja2 templates')) 32 | if isinstance(play, list): 33 | for play_item in play: 34 | sub_errors = self.matchplay(file, play_item) 35 | if sub_errors: 36 | errors = errors + sub_errors 37 | return errors 38 | 39 | def matchtask(self, file, task): 40 | return 'when' in task and not self._is_valid(task['when']) 41 | -------------------------------------------------------------------------------- /rules/DeprecatedModuleRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class DeprecatedModuleRule(AnsibleLintRule): 8 | id = '105' 9 | shortdesc = 'Deprecated module' 10 | description = """These are deprecated modules, some modules are 11 | kept temporarily for backwards compatibility but usage is discouraged. 12 | For more details see: 13 | https://docs.ansible.com/ansible/latest/modules/list_of_all_modules.html 14 | """ 15 | tags = ['deprecated'] 16 | 17 | _modules = [ 18 | 'accelerate', 'aos_asn_pool', 'aos_blueprint', 'aos_blueprint_param', 19 | 'aos_blueprint_virtnet', 'aos_device', 'aos_external_router', 20 | 'aos_ip_pool', 'aos_logical_device', 'aos_logical_device_map', 21 | 'aos_login', 'aos_rack_type', 'aos_template', 'azure', 'cl_bond', 22 | 'cl_bridge', 'cl_img_install', 'cl_interface', 'cl_interface_policy', 23 | 'cl_license', 'cl_ports', 'cs_nic', 'docker', 'ec2_ami_find', 24 | 'ec2_ami_search', 'ec2_remote_facts', 'ec2_vpc', 'kubernetes', 25 | 'netscaler', 'nxos_ip_interface', 'nxos_mtu', 'nxos_portchannel', 26 | 'nxos_switchport', 'oc', 'panos_nat_policy', 'panos_security_policy', 27 | 'vsphere_guest', 'win_msi', 'include' 28 | ] 29 | 30 | def matchtask(self, file, task): 31 | module = task["action"]["__ansible_module__"] 32 | if module in self._modules: 33 | message = '{0} {1}' 34 | return message.format(self.shortdesc, module) 35 | return False 36 | -------------------------------------------------------------------------------- /rules/RoleRelativePath.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | format = "{}" 8 | 9 | 10 | class RoleRelativePath(AnsibleLintRule): 11 | id = '404' 12 | shortdesc = "Doesn't need a relative path in role" 13 | description = '' 14 | tags = ['module'] 15 | 16 | def matchplay(self, file, play): 17 | if file['type'] == 'playbook': 18 | return [] 19 | if 'template' in play: 20 | if not isinstance(play['template'], dict): 21 | return False 22 | if "../templates" in play['template']['src']: 23 | return [({'': play['template']}, 24 | self.shortdesc)] 25 | if 'win_template' in play: 26 | if not isinstance(play['win_template'], dict): 27 | return False 28 | if "../win_templates" in play['win_template']['src']: 29 | return ({'win_template': play['win_template']}, 30 | self.shortdesc) 31 | if 'copy' in play: 32 | if not isinstance(play['copy'], dict): 33 | return False 34 | if 'src' in play['copy']: 35 | if "../files" in play['copy']['src']: 36 | return ({'sudo': play['copy']}, 37 | self.shortdesc) 38 | if 'win_copy' in play: 39 | if not isinstance(play['win_copy'], dict): 40 | return False 41 | if "../files" in play['win_copy']['src']: 42 | return ({'sudo': play['win_copy']}, 43 | self.shortdesc) 44 | return [] 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /rules/CommandsInsteadOfArgumentsRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | import os 5 | 6 | from ansiblelint import AnsibleLintRule 7 | try: 8 | from ansible.module_utils.parsing.convert_bool import boolean 9 | except ImportError: 10 | try: 11 | from ansible.utils.boolean import boolean 12 | except ImportError: 13 | try: 14 | from ansible.utils import boolean 15 | except ImportError: 16 | from ansible import constants 17 | boolean = constants.mk_boolean 18 | 19 | 20 | class CommandsInsteadOfArgumentsRule(AnsibleLintRule): 21 | id = '302' 22 | shortdesc = 'Using command rather than an argument to e.g. file' 23 | description = 'Executing a command when there is are arguments to ' + \ 24 | 'modules is generally a bad idea' 25 | tags = ['command-shell'] 26 | 27 | _commands = ['command', 'shell', 'raw'] 28 | _arguments = {'chown': 'owner', 'chmod': 'mode', 'chgrp': 'group', 29 | 'ln': 'state=link', 'mkdir': 'state=directory', 30 | 'rmdir': 'state=absent', 'rm': 'state=absent'} 31 | 32 | def matchtask(self, file, task): 33 | if task["action"]["__ansible_module__"] in self._commands: 34 | if 'cmd' in task['action']: 35 | first_cmd_arg = task['action']['cmd'].split()[0] 36 | else: 37 | first_cmd_arg = task["action"]["__ansible_arguments__"][0] 38 | if not first_cmd_arg: 39 | return 40 | executable = os.path.basename(first_cmd_arg) 41 | if executable in self._arguments and \ 42 | boolean(task['action'].get('warn', True)): 43 | message = "{0} used in place of argument {1} to file module" 44 | return message.format(executable, self._arguments[executable]) 45 | -------------------------------------------------------------------------------- /rules/MetaTagValidRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | import re 6 | 7 | 8 | class MetaTagValidRule(AnsibleLintRule): 9 | id = '702' 10 | shortdesc = 'Tags must contain lowercase letters and digits only' 11 | description = ("Tags must contain lowercase letters and digits only, " 12 | "and 'galaxy_tags' is expected to be a list") 13 | tags = ['metadata'] 14 | 15 | TAG_REGEXP = re.compile('^[a-z0-9]+$') 16 | 17 | def matchplay(self, file, data): 18 | if file['type'] != 'meta': 19 | return False 20 | 21 | galaxy_info = data.get('galaxy_info', None) 22 | if not galaxy_info: 23 | return False 24 | 25 | tags = [] 26 | results = [] 27 | 28 | if 'galaxy_tags' in galaxy_info: 29 | if isinstance(galaxy_info['galaxy_tags'], list): 30 | tags += galaxy_info['galaxy_tags'] 31 | else: 32 | results.append(({'meta/main.yml': data}, 33 | "Expected 'galaxy_tags' to be a list")) 34 | 35 | if 'categories' in galaxy_info: 36 | results.append(({'meta/main.yml': data}, 37 | "Use 'galaxy_tags' rather than 'categories'")) 38 | if isinstance(galaxy_info['categories'], list): 39 | tags += galaxy_info['categories'] 40 | else: 41 | results.append(({'meta/main.yml': data}, 42 | "Expected 'categories' to be a list")) 43 | 44 | for tag in tags: 45 | msg = self.shortdesc 46 | if not re.match(self.TAG_REGEXP, tag): 47 | results.append(({'meta/main.yml': data}, 48 | "{}, invalid: '{}'".format(msg, tag))) 49 | 50 | return results 51 | -------------------------------------------------------------------------------- /rules/PackageHasRetryRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016, Will Thames and contributors 2 | # Copyright (c) 2018, Ansible Project 3 | 4 | from ansiblelint import AnsibleLintRule 5 | 6 | 7 | class PackageHasRetryRule(AnsibleLintRule): 8 | id = '405' 9 | shortdesc = 'Remote package tasks should have a retry' 10 | description = ('Package operations are unreliable as they require' 11 | 'network communication and the availability of remote' 12 | 'servers. To mitigate the potential problems, retries ' 13 | 'should be used.') 14 | tags = ['module', 'reliability'] 15 | 16 | # module list generated with: 17 | # find lib/ansible/modules/packaging/ -type f -printf '%f\n' \ 18 | # | sort | awk -F '/' \ 19 | # '/__|dpkg|_repo|_facts|_sub|_chan/{next} {split($NF, words, "."); 20 | # print "\""words[1]"\","}' 21 | package_modules = [ 22 | "apk", 23 | "apt_key", 24 | "apt", 25 | "apt_rpm", 26 | "bower", 27 | "bundler", 28 | "composer", 29 | "cpanm", 30 | "dnf", 31 | "easy_install", 32 | "flatpak", 33 | "flatpak_remote", 34 | "gem", 35 | "homebrew_cask", 36 | "homebrew", 37 | "homebrew_tap", 38 | "layman", 39 | "macports", 40 | "maven_artifact", 41 | "npm", 42 | "openbsd_pkg", 43 | "opkg", 44 | "package", 45 | "pacman", 46 | "pear", 47 | "pip", 48 | "pkg5_publisher", 49 | "pkg5", 50 | "pkgin", 51 | "pkgng", 52 | "pkgutil", 53 | "portage", 54 | "portinstall", 55 | "rhn_register", 56 | "rpm_key", 57 | "slackpkg", 58 | "snap", 59 | "sorcery", 60 | "svr4pkg", 61 | "swdepot", 62 | "swupd", 63 | "urpmi", 64 | "xbps", 65 | "yarn", 66 | "yum", 67 | "zypper", 68 | ] 69 | 70 | def matchtask(self, file, task): 71 | return (task['action']['__ansible_module__'] in self.package_modules 72 | and 'until' not in task) 73 | -------------------------------------------------------------------------------- /rules/CommandsInsteadOfModulesRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | import os 5 | 6 | from ansiblelint import AnsibleLintRule 7 | try: 8 | from ansible.module_utils.parsing.convert_bool import boolean 9 | except ImportError: 10 | try: 11 | from ansible.utils.boolean import boolean 12 | except ImportError: 13 | try: 14 | from ansible.utils import boolean 15 | except ImportError: 16 | from ansible import constants 17 | boolean = constants.mk_boolean 18 | 19 | 20 | class CommandsInsteadOfModulesRule(AnsibleLintRule): 21 | id = '303' 22 | shortdesc = 'Using command rather than module' 23 | description = 'Executing a command when there is an Ansible module ' + \ 24 | 'is generally a bad idea' 25 | tags = ['command-shell', 'resources', 'ANSIBLE0006'] 26 | 27 | _commands = ['command', 'shell'] 28 | _modules = { 29 | 'apt-get': 'apt-get', 30 | 'chkconfig': 'service', 31 | 'curl': 'get_url or uri', 32 | 'git': 'git', 33 | 'hg': 'hg', 34 | 'mount': 'mount', 35 | 'patch': 'patch', 36 | 'rpm': 'yum or rpm_key', 37 | 'rsync': 'synchronize', 38 | 'sed': 'template, replace or lineinfile', 39 | 'service': 'service', 40 | 'supervisorctl': 'supervisorctl', 41 | 'svn': 'subversion', 42 | 'systemctl': 'systemd', 43 | 'tar': 'unarchive', 44 | 'unzip': 'unarchive', 45 | 'wget': 'get_url or uri', 46 | 'yum': 'yum', 47 | } 48 | 49 | def matchtask(self, file, task): 50 | if task['action']['__ansible_module__'] not in self._commands: 51 | return 52 | 53 | if 'cmd' in task['action']: 54 | first_cmd_arg = task['action']['cmd'].split()[0] 55 | else: 56 | first_cmd_arg = task['action']['__ansible_arguments__'][0] 57 | if not first_cmd_arg: 58 | return 59 | 60 | executable = os.path.basename(first_cmd_arg) 61 | if executable in self._modules and \ 62 | boolean(task['action'].get('warn', True)): 63 | message = '{0} used in place of {1} module' 64 | return message.format(executable, self._modules[executable]) 65 | -------------------------------------------------------------------------------- /rules/MetaVideoLinksRule.py: -------------------------------------------------------------------------------- 1 | from ansiblelint import AnsibleLintRule 2 | import re 3 | import six 4 | 5 | 6 | class MetaVideoLinksRule(AnsibleLintRule): 7 | id = '704' 8 | shortdesc = "meta/main.yml video_links should be formatted correctly" 9 | description = ("Items in 'video_links' in meta/main.yml should be " 10 | "dictionaries, and contain only keys 'url' and 'title', " 11 | "and have a shared link from a supported provider") 12 | tags = ['metadata'] 13 | 14 | VIDEO_REGEXP = { 15 | 'google': re.compile( 16 | r'https://drive.google.com.*file/d/([0-9A-Za-z-_]+)/.*'), 17 | 'vimeo': re.compile( 18 | r'https://vimeo.com/([0-9]+)'), 19 | 'youtube': re.compile( 20 | r'https://youtu.be/([0-9A-Za-z-_]+)'), 21 | } 22 | 23 | def matchplay(self, file, data): 24 | if file['type'] != 'meta': 25 | return False 26 | 27 | galaxy_info = data.get('galaxy_info', None) 28 | if not galaxy_info: 29 | return False 30 | 31 | video_links = galaxy_info.get('video_links', None) 32 | if not video_links: 33 | return False 34 | 35 | results = [] 36 | 37 | for video in video_links: 38 | if not isinstance(video, dict): 39 | results.append(({'meta/main.yml': data}, 40 | "Expected item in 'video_links' to be " 41 | "a dictionary")) 42 | continue 43 | 44 | if set(video) != {'url', 'title', '__file__', '__line__'}: 45 | results.append(({'meta/main.yml': data}, 46 | "Expected item in 'video_links' to contain " 47 | "only keys 'url' and 'title'")) 48 | continue 49 | 50 | for name, expr in six.iteritems(self.VIDEO_REGEXP): 51 | if expr.match(video['url']): 52 | break 53 | else: 54 | msg = ("URL format '{0}' is not recognized. " 55 | "Expected it be a shared link from Vimeo, YouTube, " 56 | "or Google Drive.".format(video['url'])) 57 | results.append(({'meta/main.yml': data}, msg)) 58 | 59 | return results 60 | -------------------------------------------------------------------------------- /rules/UsingBareVariablesIsDeprecatedRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | import re 5 | import six 6 | from ansiblelint import AnsibleLintRule 7 | 8 | 9 | class UsingBareVariablesIsDeprecatedRule(AnsibleLintRule): 10 | id = '104' 11 | shortdesc = 'Using bare variables is deprecated' 12 | description = 'Using bare variables is deprecated. Update your ' + \ 13 | 'playbooks so that the environment value uses the full variable ' + \ 14 | 'syntax ("{{your_variable}}").' 15 | tags = ['deprecated'] 16 | 17 | _jinja = re.compile(r"{{.*}}") 18 | _glob = re.compile('[][*?]') 19 | 20 | def matchtask(self, file, task): 21 | loop_type = next((key for key in task 22 | if key.startswith("with_")), None) 23 | if loop_type: 24 | if loop_type in ["with_nested", "with_together", "with_flattened"]: 25 | # These loops can either take a list defined directly in the 26 | # task or a variable that is a list itself. When a 27 | # single variable is used we just need to check that 28 | # one variable, and not iterate over it like 29 | # it's a list. Otherwise, loop through and check all items. 30 | items = task[loop_type] 31 | if not isinstance(items, (list, tuple)): 32 | items = [items] 33 | for var in items: 34 | return self._matchvar(var, task, loop_type) 35 | elif loop_type == "with_subelements": 36 | return self._matchvar(task[loop_type][0], task, loop_type) 37 | elif loop_type in ["with_sequence", "with_ini", 38 | "with_inventory_hostnames"]: 39 | pass 40 | else: 41 | return self._matchvar(task[loop_type], task, loop_type) 42 | 43 | def _matchvar(self, varstring, task, loop_type): 44 | if (isinstance(varstring, six.string_types) and 45 | not self._jinja.match(varstring)): 46 | if loop_type != 'with_fileglob' or not (self._jinja.search(varstring) or 47 | self._glob.search(varstring)): 48 | message = "Found a bare variable '{0}' used in a '{1}' loop." + \ 49 | " You should use the full variable syntax ('{{{{{0}}}}}')" 50 | return message.format(task[loop_type], loop_type) 51 | -------------------------------------------------------------------------------- /generate_docs.py: -------------------------------------------------------------------------------- 1 | '''Script to generate rule table markdown documentation.''' 2 | 3 | import os 4 | import importlib 5 | from inspect import getmembers, ismodule, isclass 6 | import rules 7 | from ansiblelint import AnsibleLintRule 8 | from functools import reduce 9 | 10 | 11 | def main(): 12 | import_all_rules() 13 | all_rules = get_serialized_rules() 14 | 15 | grid = [['id', 'sample message']] 16 | for d in all_rules: 17 | if d['id'][1:3] == '01': 18 | if not d['id'][0:3] == '101': 19 | grid.append(['', '']) 20 | grid.append(['**E{}**'.format(d['id'][0]), 21 | '*{}*'.format(d['first_tag'])]) 22 | grid.append(['E{}'.format(d['id']), d['shortdesc']]) 23 | 24 | filename = 'RULE_DOCS.md' 25 | with open(filename, 'w') as file: 26 | file.write(make_table(grid)) 27 | print('{} file written'.format(filename)) 28 | 29 | 30 | def import_all_rules(): 31 | for module in list(os.walk('rules'))[0][2]: 32 | if module == '__init__.py' or module[-3:] != '.py': 33 | continue 34 | module = 'rules.{}'.format(module[:-3]) 35 | importlib.import_module(module) 36 | 37 | 38 | def get_serialized_rules(): 39 | mod_list = [m[1] for m in getmembers(rules) if ismodule(m[1])] 40 | class_list = [] 41 | for mod in mod_list: 42 | class_temp = [m[1] for m in getmembers(mod) if isclass(m[1])] 43 | class_temp = [c for c in class_temp if c is not AnsibleLintRule] 44 | class_list.extend(class_temp) 45 | 46 | all_rules = [] 47 | for c in class_list: 48 | d = {'id': c.id, 'shortdesc': c.shortdesc, 'first_tag': c.tags[0]} 49 | all_rules.append(d) 50 | all_rules = sorted(all_rules, key=lambda k: k['id']) 51 | return all_rules 52 | 53 | 54 | def make_table(grid): 55 | cell_width = 2 + max(reduce(lambda x, y: x+y, 56 | [[len(item) for item in row] for row in grid], [])) 57 | num_cols = len(grid[0]) 58 | block = '' 59 | header = True 60 | for row in grid: 61 | block = block + '| ' + '| '.join([normalize_cell(x, cell_width-1) 62 | for x in row]) + '|\n' 63 | if header: 64 | block = block + num_cols*('|' + (cell_width)*'-') + '|\n' 65 | header = False 66 | return block 67 | 68 | 69 | def normalize_cell(string, length): 70 | return string + ((length - len(string)) * ' ') 71 | 72 | 73 | if __name__ == '__main__': 74 | main() 75 | -------------------------------------------------------------------------------- /rules/OctalPermissionsRule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 Ansible, Inc. 2 | # All Rights Reserved. 3 | 4 | from ansiblelint import AnsibleLintRule 5 | import re 6 | import six 7 | 8 | 9 | class OctalPermissionsRule(AnsibleLintRule): 10 | id = '202' 11 | shortdesc = 'Octal file permissions must contain leading zero' 12 | description = 'Numeric file permissions without leading zero can ' + \ 13 | 'behave in unexpected ways. See ' + \ 14 | 'http://docs.ansible.com/ansible/file_module.html' 15 | tags = ['module'] 16 | 17 | _modules = ['assemble', 'copy', 'file', 'ini_file', 'lineinfile', 18 | 'replace', 'synchronize', 'template', 'unarchive'] 19 | 20 | mode_regex = re.compile(r'^\s*[0-9]+\s*$') 21 | valid_mode_regex = re.compile(r'^\s*0[0-7]{3,4}\s*$') 22 | 23 | def is_invalid_permission(self, mode): 24 | # sensible file permission modes don't 25 | # have write bit set when read bit is 26 | # not set and don't have execute bit set 27 | # when user execute bit is not set. 28 | # also, user permissions are more generous than 29 | # group permissions and user and group permissions 30 | # are more generous than world permissions 31 | 32 | other_write_without_read = (mode % 8 and mode % 8 < 4 and 33 | not (mode % 8 == 1 and (mode >> 6) % 2 == 1)) 34 | group_write_without_read = ((mode >> 3) % 8 and (mode >> 3) % 8 < 4 and 35 | not ((mode >> 3) % 8 == 1 and (mode >> 6) % 2 == 1)) 36 | user_write_without_read = ((mode >> 6) % 8 and (mode >> 6) % 8 < 4 and 37 | not (mode >> 6) % 8 == 1) 38 | other_more_generous_than_group = mode % 8 > (mode >> 3) % 8 39 | other_more_generous_than_user = mode % 8 > (mode >> 6) % 8 40 | group_more_generous_than_user = (mode >> 3) % 8 > (mode >> 6) % 8 41 | 42 | return (other_write_without_read or 43 | group_write_without_read or 44 | user_write_without_read or 45 | other_more_generous_than_group or 46 | other_more_generous_than_user or 47 | group_more_generous_than_user) 48 | 49 | def matchtask(self, file, task): 50 | if task["action"]["__ansible_module__"] in self._modules: 51 | mode = task['action'].get('mode', None) 52 | if isinstance(mode, six.string_types) and self.mode_regex.match(mode): 53 | return not self.valid_mode_regex.match(mode) 54 | if isinstance(mode, int): 55 | return self.is_invalid_permission(mode) 56 | -------------------------------------------------------------------------------- /RULE_DOCS.md: -------------------------------------------------------------------------------- 1 | | id | sample message | 2 | |-------------------------------------------------------------------------------|-------------------------------------------------------------------------------| 3 | | **E1** | *deprecated* | 4 | | E101 | Deprecated always_run | 5 | | E102 | No Jinja2 in when | 6 | | E103 | Deprecated sudo | 7 | | E104 | Using bare variables is deprecated | 8 | | E105 | Deprecated module | 9 | | | | 10 | | **E2** | *formatting* | 11 | | E201 | Trailing whitespace | 12 | | E202 | Octal file permissions must contain leading zero | 13 | | E203 | Most files should not contain tabs | 14 | | E204 | Lines should be no longer than 160 chars | 15 | | E205 | Playbooks should have the ".yml" extension | 16 | | E206 | Variables should have spaces after {{ and before }} | 17 | | | | 18 | | **E3** | *command-shell* | 19 | | E301 | Commands should not change things if nothing needs doing | 20 | | E302 | Using command rather than an argument to e.g. file | 21 | | E303 | Using command rather than module | 22 | | E304 | Environment variables don't work as part of command | 23 | | E305 | Use shell only when shell functionality is required | 24 | | | | 25 | | **E4** | *module* | 26 | | E401 | Git checkouts must contain explicit version | 27 | | E402 | Mercurial checkouts must contain explicit revision | 28 | | E403 | Package installs should not use latest | 29 | | E404 | Doesn't need a relative path in role | 30 | | | | 31 | | **E5** | *task* | 32 | | E501 | become_user requires become to work as expected | 33 | | E502 | All tasks should be named | 34 | | E503 | Tasks that run when changed should likely be handlers | 35 | | E504 | Use 'connection: local' or 'delegate_to: localhost' instead of 'local_action' | 36 | | | | 37 | | **E6** | *idiom* | 38 | | E601 | Don't compare to literal True/False | 39 | | E602 | Don't compare to empty string | 40 | | | | 41 | | **E7** | *metadata* | 42 | | E701 | meta/main.yml should contain relevant info | 43 | | E702 | Tags must contain lowercase letters and digits only | 44 | | E703 | meta/main.yml default values should be changed | 45 | | E704 | meta/main.yml video_links should be formatted correctly | 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------