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

network-engine lint #114

Open
fenris02 opened this issue Jul 16, 2018 · 2 comments
Open

network-engine lint #114

fenris02 opened this issue Jul 16, 2018 · 2 comments
Assignees

Comments

@fenris02
Copy link

Minor lint issues found in network-engine:

ISSUE TYPE

  • Bug Report

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
Copy link
Contributor

gundalow commented Aug 2, 2018

@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
Copy link
Contributor

gundalow commented Aug 6, 2018

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
  • So we want line length 120 characters

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

No branches or pull requests

2 participants