ansible-network / network-engine

This role provides the foundation for building network roles by providing modules and plugins that are common to all Ansible Network roles.
GNU General Public License v3.0
112 stars 53 forks source link

network-engine lint #114

Open fenris02 opened 6 years ago

fenris02 commented 6 years ago

Minor lint issues found in network-engine:

ISSUE TYPE

ANSIBLE VERSION

ansible --version
ansible 2.6.1

ansible-galaxy list | grep ansible.network
- ansible-network.network-engine, v2.6.0

Network OS

n/a for this report.

SUMMARY

STEPS TO REPRODUCE

% find ./roles/ansible-network.network-engine -type f -name \*.yml -print0 | while read -d $'\0' -r YML
  do
    yamllint "$YML"
    ansible-lint "$YML"
  done
./roles/ansible-network.network-engine/tasks/main.yml
  2:32      error    no new line character at the end of file  (new-line-at-end-of-file)

./roles/ansible-network.network-engine/tests/json_template/test.yml
  1:1       warning  missing document start "---"  (document-start)

./roles/ansible-network.network-engine/tests/netcfg_diff/test.yml
  1:1       warning  missing document start "---"  (document-start)

./roles/ansible-network.network-engine/tests/text_parser/test.yml
  1:1       warning  missing document start "---"  (document-start)

./roles/ansible-network.network-engine/tests/vlan_compress/test.yml
  1:1       warning  missing document start "---"  (document-start)

./roles/ansible-network.network-engine/tests/textfsm_parser/test.yml
  1:1       warning  missing document start "---"  (document-start)

./roles/ansible-network.network-engine/tests/interface_range/test.yml
  1:1       warning  missing document start "---"  (document-start)

./roles/ansible-network.network-engine/tests/command_parser/test.yml
  1:1       warning  missing document start "---"  (document-start)

./roles/ansible-network.network-engine/tests/textfsm/test.yml
  1:1       warning  missing document start "---"  (document-start)

./roles/ansible-network.network-engine/tests/interface_split/test.yml
  1:1       warning  missing document start "---"  (document-start)

./roles/ansible-network.network-engine/tests/vlan_expand/test.yml
  1:1       warning  missing document start "---"  (document-start)

./roles/ansible-network.network-engine/meta/main.yml
  4:81      error    line too long (154 > 80 characters)  (line-length)
  13:81     error    line too long (84 > 80 characters)  (line-length)
  19:81     error    line too long (81 > 80 characters)  (line-length)
  22:4      warning  missing starting space in comment  (comments)

./roles/ansible-network.network-engine/.travis.yml
  12:5      error    wrong indentation: expected 6 but found 4  (indentation)
  29:61     error    no new line character at the end of file  (new-line-at-end-of-file)

[ANSIBLE0008] deprecated sudo feature
./roles/ansible-network.network-engine/.travis.yml:2
{'sudo': False}

./roles/ansible-network.network-engine/handlers/main.yml
  2:35      error    no new line character at the end of file  (new-line-at-end-of-file)

EXPECTED RESULTS

Lint checks should not report any results. Almost all of the items above are very minor and trivial to fix.

The one deprecated feature may take longer to resolve.

ACTUAL RESULTS

https://docs.ansible.com/ansible/devel/dev_guide/testing/sanity/

% ansible-test sanity
zsh: command not found: ansible-test

I was not able to test with your published sanity checker. The above commands were available, and did produce reasonable items, so they were used instead.

gundalow commented 6 years ago

@fenris02 (DJ) Thank you for this.

1) I'll need to check, though I'm fairly sure ansible-test runs yamllint. I think we ignore requiring --- at the start 2) Linelength is the same as ansible/ansible 160chrs 3) deprecated sudo feature looks seems valid. Though I think we can just delete .travis.yml 4) Wonder if we should run Will Thames' ansible-lint

gundalow commented 6 years ago

Also from Galaxy import

ERROR [role] ./action_plugins/cli.py:122:9: E722 do not use bare except'
ERROR [role] ./action_plugins/cli.py:132:121: E501 line too long (123 > 120 characters)
ERROR [role] ./action_plugins/command_parser.py:16:1: F401 'ansible.module_utils.six.iterkeys' imported but unused
ERROR [role] ./action_plugins/command_parser.py:20:1: F401 'ansible.plugins.filter.core.combine' imported but unused
ERROR [role] ./filter_plugins/network_engine.py:54:42: F812 list comprehension redefines 'index' from line 38
ERROR [role] ./filter_plugins/network_engine.py:101:35: F812 list comprehension redefines 'index' from line 86
ERROR [role] ./lookup_plugins/network_template.py:49:9: F841 local variable 'convert_data_p' is assigned to but never used
ERROR [role] ./lookup_plugins/network_template.py:50:9: F841 local variable 'lookup_template_vars' is assigned to but never used
ERROR [role] ./lookup_plugins/network_template.py:64:21: F841 local variable 'template_data' is assigned to but never used
ERROR [role] ./lookup_plugins/network_template.py:69:25: F841 local variable 'name' is assigned to but never used
ERROR [role] ./lookup_plugins/network_template.py:123:13: F841 local variable 'name' is assigned to but never used
ERROR [role] ./lookup_plugins/network_template.py:124:13: F841 local variable 'register' is assigned to but never used
ERROR [role] ./lookup_plugins/network_template.py:255:33: F841 local variable 'exc' is assigned to but never used
ERROR Lint failed