-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Currently pylintrc ignores all tests folders:
Line 2 in 15296fd
| ignore=tests,generated,vendored_sdks,privates |
Some test files contain trailing-whitespace, trailing-newlines, or missing-final-newline.
For example, this line contains trailing-whitespace:
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py
Line 646 in 2cb10db
| self.cmd('vm generalize -g {rg} -n {vm1}') |
Even though code style in test files is not important, IDEs have options to automatically fix spaces and new lines. If another developer edits these test files, trailing-whitespace and trailing-newlines will be trimmed and missing-final-newline will be added, thus appearing in PR's diff. If the other developer doesn't want these changes to appear in the diff, they have to disable automatic fix to comply with the "bad" code style.
For example, in this python file . is used to denote spaces and - is used to denote new lines:
if True:
print(True).
....
print(False)
-
-pylint will report:
> pylint D:\cli\testproj\testpylint.py
************* Module testpylint
testproj\testpylint.py:2:15: C0303: Trailing whitespace (trailing-whitespace)
testproj\testpylint.py:3:0: C0303: Trailing whitespace (trailing-whitespace)
testproj\testpylint.py:5:0: C0305: Trailing newlines (trailing-newlines)
Adding checks for trailing-whitespace, trailing-newlines and missing-final-newline will help unify code style.