Commit graph

43 commits

Author SHA1 Message Date
Toshio Kuratomi
5147e792d3 Enable the bare-except pylint and pep8 checking 2018-12-16 15:03:19 -08:00
Brandon Bell
5568ffd45b Fix syntax error for Python 2.6 (#47635)
* Fix syntax error for Python 2.6

* Removing consul.py from pylint/ignore.txt
2018-10-27 12:43:53 +10:00
Matt Clay
c24c19594e
Enable pylint rules and fix exposed bugs. (#47219)
* Resolve invalid-unary-operand-type.

* Resolve raising-format-tuple.

* Resolve stop-iteration-return.

* Use disable comment instead of fixing logic.

The affected line in _find_address_range will only fail on Python 3.7
and later if the function is called with an empty address list. As an
internal method it is never called in this way, making it a non-issue
for use via public methods.

Using a comment to disable the rule in favor of an ignore.txt entry
since there are no plans to change the logic in the code itself. This
will also prevent any potential future issues being added in other
parts of the code when updating it based on upstream changes.
2018-10-19 08:32:52 -07:00
Matt Clay
37b013aca3
Enable additional pylint rules and resolve issues found. (#47221)
* Resolve unneeded-not.
* Resolve global-at-module-level.
* Resolve useless-import-alias.
* Resolve bad-whitespace.
* Resolve global-variable-not-assigned.
* Resolve logging-not-lazy.
* Resolve comparison-with-itself.
2018-10-18 13:38:08 -07:00
Matt Clay
76bf861308
Upgrade pylint to version 2.1.1. (#47036)
* Fix issues reported by the latest pylint.
* Split pylint runs into more contexts.
* Upgrade pylint.
2018-10-14 22:59:52 -07:00
Matt Clay
0c29463785 Block module ansible imports outside module_utils. 2018-10-11 19:54:54 -07:00
Matt Clay
a11f631ee4 Python 3.8 collections compatibility fixes.
Includes a new pylint blacklist plugin to prevent regressions.
2018-10-08 11:26:37 -07:00
Matt Martz
49eb53b44d
pylint plugin to catch due/past-due deprecated calls (#44143)
* Start of work on pylint plugin to catch due/past-due deprecated calls

* Improve deprecated pylint plugin

* Catch call to AnsibleModule.deprecate also

* Skip splatted kwargs, we can't infer that info

* Add error for invalid version in deprecation

* Skip version if it's a reference to a var

* Disable ansible-deprecated-no-version for displaying deprecated module info

* fix comments

* is None

* Force specifying a version, this can be disabled on a per case basis

* Disable ansible-deprecated-version by default

* Remove to look for 2.8 deprecated

* Revert "Remove to look for 2.8 deprecated"

This reverts commit 4e84034fd1.

* Add script and template used for creating issues for deprecated issues

* Fix underscore var
2018-09-25 10:31:41 -05:00
Matt Clay
ac492476e5
Bug fixes and cleanup for ansible-test. (#45991)
* Remove unused imports.
* Clean up ConfigParser usage in ansible-test.
* Fix bare except statements in ansible-test.
* Miscellaneous cleanup from PyCharm inspections.
* Enable pylint no-self-use for ansible-test.
* Remove obsolete pylint ignores for Python 3.7.
* Fix shellcheck issuers under newer shellcheck.
* Use newer path for ansible-test.
* Fix issues in code-smell tests.
2018-09-21 11:38:22 -07:00
Matt Clay
f3d1f9544b
Make ansible-test available in the bin directory. (#45876) 2018-09-19 17:58:55 -07:00
Eric Helms
74b94e119e Deprecate foreman and katello modules (#42043)
* Deprecate foreman and katello modules in 2.8, remove in 2.12
2018-09-19 11:41:54 -05:00
Ondra Machacek
24c26aded8 oVirt: Add depracation warning to all modules (#44440) 2018-08-23 09:42:05 -04:00
Ryan Brown
858a1b09bb EC2_group module refactor (formerly pr/37255) (#38678)
* Refactor ec2_group

Replace nested for loops with list comprehensions

Purge rules before adding new ones in case sg has maximum permitted rules

* Add check mode tests for ec2_group

* add tests

* Remove dead code

* Fix integration test assertions for old boto versions

* Add waiter for security group that is autocreated

* Add support for in-account group rules

* Add common util to get AWS account ID

Fixes #31383

* Fix protocol number and add separate tests for egress rule handling

* Return egress rule treatment to be backwards compatible

* Remove functions that were obsoleted by `Rule` namedtuple

* IP tests

* Move description updates to a function

* Fix string formatting missing index

* Add tests for auto-creation of the same group in quick succession

* Resolve use of brand-new group in a rule without a description

* Clean up duplicated get-security-group function

* Add reverse cleanup in case of dependency issues

* Add crossaccount ELB group support

* Deal with non-STS calls to account API

* Add filtering of owner IDs that match the current account
2018-05-24 11:53:21 -04:00
pierremahot
3903ca5c8e Fix ios_vlan to correctly identify unmodified config when having long interface names (#40145)
Change the command to get the interface in a vlan "show vlan" => "show vlan brief"
Change the parsing of the return command of the switch.
The return of the ios command is fixed so i cut with fix number of carracter.
Adding looking for the next line to add the forgeted interfaces.
2018-05-23 10:15:54 -04:00
Nathaniel Case
3b3c72f3e5
Fix use of bytes in cliconf plugins for Python 3 (#37715)
* Remove raw byte-strings from cliconf plugins of supported platforms + edgeos

Remove uses of to_bytes, too

* Update CliConfBase docstring to reflect current position on byte strings
2018-04-17 10:15:21 -04:00
Toshio Kuratomi
86242e6871
Enable wildcard import pylint (#35786)
* Wildcard imports should be taken care of.  Enable the pylint check for them
* Remove wildcard import code-smell test as we're now checking via pylint
* Add unused-wildcard-import as ignored in our compat code.

These three files use wildcard imports so that they can export
symbols in a compatible location.  The real code lives elsewhere.
So disable the pylint tests for the relevant sections of code.
2018-02-06 15:17:49 -08:00
Matt Clay
b9c5147be2
Move import sanity test files into own directory. (#35593) 2018-02-01 09:52:31 -08:00
Dag Wieers
628eca85c3
ACI: Fixing new pylint issue (#34775) 2018-01-12 08:07:59 +01:00
Dag Wieers
83b7ec69fc
Fix pylint issue (#34773) 2018-01-12 02:26:14 +01:00
Dag Wieers
03dd3214b4
Fix new pylint issue (#34772)
Is it all worth it ?
2018-01-12 02:25:03 +01:00
Matt Clay
96e5cce5ea Ignore pylint errors. 2018-01-11 15:38:35 -08:00
Kedar Kekan
08957cf46e
cliconf and netconf refactor of iosxr_logging (#34495)
* * cliconf and netconf refactor of iosxr_logging

* * documentation issue fix

* * adds required_if and mutually_exclusive in arg spec
2018-01-11 10:08:11 +05:30
Matt Clay
784360385e Remove already fixed Python 3.7 pylint ignores. 2018-01-10 14:08:11 -08:00
Matt Clay
797664d9cb Python 2.6 str.format() compatibility fixes. 2018-01-10 14:08:11 -08:00
Chris Houseknecht
623ff39443
Separate common and raw (#34563) 2018-01-09 07:22:46 -05:00
Matt Clay
85761d1291 Add ignore lines for string_format pylint plugin. 2018-01-05 19:59:17 -08:00
Matt Martz
8c1353537d Add string_format pylint plugin. 2018-01-05 19:59:17 -08:00
Matt Clay
aff16225eb Add per file+rule pylint ignore to ansible-test. 2018-01-05 19:59:17 -08:00
Matt Clay
c6bb6c72cc Fix anomalous backslashes and enable pylint test. 2017-11-21 23:22:51 -08:00
Matt Clay
cf1337ca9a Update ansible-test sanity command. (#31958)
* Use correct pip version in ansible-test.
* Add git fallback for validate-modules.
* Run sanity tests in a docker container.
* Use correct python version for sanity tests.
* Pin docker completion images and add default.
* Split pylint execution into multiple contexts.
* Only test .py files in use-argspec-type-path test.
* Accept identical python interpeter name or binary.
* Switch cloud tests to default container.
* Remove unused extras from pip install.
* Filter out empty pip commands.
* Don't force running of pip list.
* Support delegation for windows and network tests.
* Fix ansible-test python version usage.
* Fix ansible-test python version skipping.
* Use absolute path for log in ansible-test.
* Run vyos_command test on python 3.
* Fix windows/network instance persistence.
* Add `test/cache` dir to classification.
* Enable more python versions for network tests.
* Fix cs_router test.
2017-10-26 00:21:46 -07:00
Matt Clay
f76afab6e5 Add new default Docker container for ansible-test. (#31944)
* Add new default Docker container for ansible-test.
* Update ansible-test change classification.
* Update list of disabled pylint rules.
* Fix pylint issues with ansible-test.
2017-10-19 13:37:22 -07:00
Matt Clay
dbf9634b1b Enable more pylint rules and fix reported issues. (#30543)
* Enable pylint invalid-encoded-data test.
* Enable pylint anomalous-unicode-escape-in-string test.
2017-09-19 00:45:35 -07:00
Matt Clay
7714dcd04e Enable more pylint rules and fix reported issues. (#30539)
* Enable pylint unreachable test.
* Enable pylint suppressed-message test.
* Enable pylint redundant-unittest-assert test.
* Enable pylint bad-open-mode test.
* Enable pylint signature-differs test.
* Enable pylint unnecessary-pass test.
* Enable pylint unnecessary-lambda test.
* Enable pylint raising-bad-type test.
* Enable pylint logging-not-lazy test.
* Enable pylint logging-format-interpolation test.
* Enable pylint useless-else-on-loop test.
2017-09-18 23:20:32 -07:00
Matt Clay
442af3744e Miscellaneous pylint fixes.
The following rules are no longer disabled:

- bad-format-string
- duplicate-key
- lost-exception
- trailing-newlines
- unexpected-keyword-arg
- useless-suppression
- using-constant-test
2017-09-13 01:53:08 -07:00
Matt Clay
68aeaa58a8 Fix dangerous default args. (#29839) 2017-09-12 00:11:13 -07:00
Matt Clay
79bc49e150 Fix ansible-test unicode and sanity tests. (#29743)
* Show warning when using pylint on Python 2.6.
* Add pylint disable entries for Python 2.
* Fix unicode handling in ansible-test.
* Add missing documentation.
2017-09-11 16:39:34 -07:00
Matt Clay
f88750d665 Expand disabled pylint rules. (#29162)
* Expand disabled pylint rules.
* Fix pylint and unicode issues in ansible-test.
2017-09-09 08:59:09 -07:00
Toshio Kuratomi
21564cdb98 Add some features to the pylint sanity check
* Enable specific tests (this lets us disable a group and then
  enable a particular test inside of it)
* Comment out tests in the enable and disable files
2017-07-29 14:13:30 -07:00
Toshio Kuratomi
9f7b0dfc30 Remove automatic use of system six
* Enable the pylint no-name-in-module check.  Checks that identifiers in
  imports actually exist.  When we do this, we also have to ignore
  _MovedItems used in our bundled six.  This means pylint won't check
  for bad imports below ansible.module_utils.six.moves but that's
  something that pylint punts on with a system copy of six so this is
  still an improvement.
* Remove automatic use of system six.  The exec in the six code which
  tried to use a system library if available destroyed pylint's ability
  to check for imports of identifiers which did not exist (the
  no-name-in-module check).  That test is important enough that we
  should sacrifice the bundling detection in favour of the test.
  Distributions that want to unbundle six can replace the bundled six in
  ansible/module_utils/six/__init__.py to unbundle.  however, be aware
  that six is tricky to unbundle.  They may want to base their efforts
  off the code we were using:

  2fff690caa/lib/ansible/module_utils/six/__init__.py

* Update tests for new location of bundled six Several code-smell tests
  whitelist the bundled six library.  Update the path to the library so
  that they work.

* Also check for basestring in modules as the enabled pylint tests will
  also point out basestring usage for us.
2017-07-25 15:58:23 -07:00
Toshio Kuratomi
da3d3d512e Enable pylint checking for undefined variables 2017-07-25 15:58:23 -07:00
Matt Clay
e7bb508ad6 Fix var precedence check to support python 3. (#23552)
* Fix var precedence check to support python 3.
* Run CI sanity tests using python 3.5.
* Disable pylint non-iterator-returned test to pass on python 3.5.
2017-04-13 00:07:40 -07:00
Matt Clay
48eeab8a53 Fix errors reported by pylint. (#23282)
* Fix pylint misplaced-bare-raise errors.
* Fix pylint return-in-init error.
* Fix pylint bad-format-character error.
* Fix pylint too-many-format-args errors.
* Fix pylint too-few-format-args errors.
* Fix pylint truncated-format-string error.
2017-04-06 16:58:16 -07:00
Matt Clay
1daa69d685 Initial pylint support for ansible-test sanity. 2017-04-04 16:16:21 -07:00