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

Fix pylint #77

Merged
merged 20 commits into from Dec 5, 2018
Merged

Fix pylint #77

merged 20 commits into from Dec 5, 2018

Conversation

bdrung
Copy link
Contributor

@bdrung bdrung commented Oct 1, 2018

Address comment 655beab#commitcomment-30676385 and make the code comply to pylint.

@jbuchhammer
Copy link
Contributor

@bdrung Impressive work, many thanks!

bdrung and others added 20 commits November 20, 2018 12:57
Commit 655beab changes the interfaces.
Due to this commit at least one of the example scripts
(pb_createDatacenter.py) is not working anymore.

With **kwargs you can pass a dict and the function will set the named
args (or use defaults) and simply ignore unknown.

This reverts commit 655beab.
pylint complains: Do not use `len(variable)` to determine if a sequence
is empty (len-as-condition).
pylint complains about string statement that have no effect. Convert
these statements to comments (as they were intended).
pylint complains: Consider iterating the dictionary directly instead of
calling .keys() (consider-iterating-dictionary)

Since the value of the dictionary items are also required, iterate over
the dictionary items instead of just the dictionary keys.
pylint complains: Anomalous backslash in string: '\d'. String constant
might be missing an r prefix. (anomalous-backslash-in-string)
pylint complains: Unnecessary parens after 'return' or 'if' keyword
(superfluous-parens)
pylint complains: Using type() instead of isinstance() for a typecheck.
(unidiomatic-typecheck)
To avoid pylint to complain about no-name-in-module, use relative
imports for the tests helpers. Also group the imports by standard,
3rd party, profitbricks, and relative imports.
pylint complains: Class method setUpClass/tearDownClass should have
'cls' as first argument (bad-classmethod-argument)
pylint complains: Redefining name 'resource' from outer scope
(redefined-outer-name)
The functions read_dc_definition and write_dc_definition have an unused
argument pbclient. Remove this unused argument.
pylint complains: Either all return statements in a function should
return an expression, or none of them should.
(inconsistent-return-statements)

Add useful return values in case the function is executed until the end.
pylint complains: Dangerous default value [] as argument
(dangerous-default-value)
pylint complains: Statement seems to have no effect
(pointless-statement). These statements are just used to check whether
the environment variable is defined.
pylint complains: Unnecessary "else" after "return" (no-else-return)
Some pylint issues are not important and would make the examples less
readable.
Third party imports should be placed before its own library imports.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
@bdrung
Copy link
Contributor Author

bdrung commented Nov 20, 2018

Please review the changes. Otherwise I will merge them without the additional review.

@bdrung bdrung merged commit 2c804b1 into master Dec 5, 2018
@bdrung
Copy link
Contributor Author

bdrung commented Dec 5, 2018

No comment received. Merged to master.

@bdrung bdrung deleted the fix-pylint branch December 5, 2018 20:17
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

Successfully merging this pull request may close these issues.

None yet

2 participants