Skip to content

Introduce lint #289

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

Merged
merged 121 commits into from
Mar 30, 2023
Merged

Introduce lint #289

merged 121 commits into from
Mar 30, 2023

Conversation

DifferentialOrange
Copy link
Member

Introduce lint with pylint, flake8 and codespell. See commits for more detailed info.

Closes #270

Last PEP8 checkup was in 0.5.5 [1]. Many things has changed since in
both PEP8 and connector source code. To ensure that everything is
alright, this patch removes existing pylint ignores before pylint
checkup. They could be restored after thorough checkup.

1. 93b5d3d

Part of #270
Fix all cases of C0303 trailing-whitespace. Remove trailing whitespaces
from documentation as well.

Part of #270
Fix several cases of C0103 invalid-name.

Part of #270
`t` sounds like a reasonable variable names in tests, `ok` sounds like a
reasonable variable names in general. This patch disables C0103
invalid-name check for them.

Part of #270
`tz` is a part of the Datetime public API and we don't plan to change it
now.

Part of #270
unittest methods use CamelCase for its asserts. We use it here for our
custom assert too.

Part of #270
Lowercase constants are the part of dbapi, we cannot rename them.

Part of #270
Lowercase constants are the part of sphinx API, we cannot rename them.

Part of #270
Fix all cases of C0121 singleton-comparison.

Part of #270
Fix all cases of C0209 consider-using-f-string.

Part of #270
Fix all cases of C0206 consider-using-dict-items.

Part of #270
Fix all cases of C0200 consider-using-enumerate.

Part of #270
Fix all cases of C0201 consider-iterating-dictionary.

Part of #270
Fix all cases of C0202 bad-classmethod-argument.

Part of #270
Fix all cases of C0325 superfluous-parens.

Part of #270
Fix all cases of C0321 multiple-statements.

Part of #270
Fix all cases of C0305 trailing-newlines.

Part of #270
Disable all current cases of C0302 too-many-lines.

Part of #270
Fix all cases of C0411 wrong-import-order.

Part of #270
Fix all cases of C0413 wrong-import-position.

Part of #270
Fix the only case of C0415 import-outside-toplevel.

Part of #270
Disable a case of C0415 import-outside-toplevel and possible E0401
import-error: we allow to run commands like `python setup.py test`
without setuptools_scm.

Part of #270
Fix all cases of C0114 missing-module-docstring.

Part of #270
Use Dataclass for protocol Greeting, as it should be. Extract the
definition outside the function.

Part of #270
Use Enum for preplication JoinState, as it should be. Extract the
definition outside the function.

1. https://www.tarantool.io/en/doc/latest/dev_guide/internals/iproto/replication/#box-protocol-join

Part of #270
Fix several cases of C0115 missing-class-docstring.

Part of #270
Fix several cases of C0116 missing-function-docstring.

Part of #270
Disable remaining cases of C0115 missing-class-docstring for unittest
classes.

Part of #270
Ignore E501 line too long since it's already checked with pylint. It
seems impossible to transfer its rules like "skip docstring links and
tables by regexp", so we just skip it here.

Part of #270
Ignore all cases of E265 block comment should start with '# ' in
documentation configuration template.

Part of #270
W503 is an outdated warning which contradicts modern W504 [1].

1. https://www.flake8rules.com/rules/W503.html

Part of #270
Fix several cases of F841 local variable is assigned to but never used.

Part of #270
This patch includes fixes for all remaining cases of
- E101 indentation contains mixed spaces and tabs,
- E121 continuation line under-indented for hanging
indent,
- E122 continuation line missing indentation or
outdented,
- E123 closing bracket does not match indentation of
opening bracket's line,
- E124 closing bracket does not match visual
indentation,
- E126 continuation line over-indented for hanging
indent,
- E127 continuation line over-indented for visual indent,
- E128 continuation line under-indented for visual indent,
- E131 continuation line unaligned for hanging indent,
- E201 whitespace after '(',
- E202 whitespace before '(',
- E203 Whitespace before ':',
- E221 multiple spaces before operator,
- E225 missing whitespace around operator,
- E226 missing whitespace around arithmetic operator,
- E227 missing whitespace around bitwise or shift,
operator,
- E231 missing whitespace after ',', ';', or ':',
- E241 multiple spaces after ',',
- E251 unexpected spaces around keyword / parameter
equals,
- E252 missing whitespace around parameter equals,
- E261 at least two spaces before inline comment,
- E275 missing whitespace after keyword,
- E301 expected 1 blank line,
- E302 expected 2 blank lines,
- E303 too many blank lines,
- E305 expected 2 blank lines after class or function definition,
- E306 expected 1 blank line before a nested definition,
- E502 the backslash is redundant between brackets,
- W191 indentation contains tabs,
- W293 blank line contains whitespace,
- W504 line break after binary operator.

Part of #270
tarantool.error values import are the part of the DBAPI requirements, so
they cannot be omitted. The same rule is used in pylint.

Part of #270
Fir all remaining cases of F401 unused import.

Part of #270
Skip autogenerated timezones since there are too many abbreviations that
confuse codespell.

Part of #270
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-270-lint branch 3 times, most recently from 9c9bdfc to a543fb1 Compare March 30, 2023 16:37
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-270-lint branch from a543fb1 to 3df0e27 Compare March 30, 2023 16:41
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-270-lint branch from 3df0e27 to e6914b0 Compare March 30, 2023 16:48
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-270-lint branch 2 times, most recently from 2b209b4 to 6913935 Compare March 30, 2023 17:16
@DifferentialOrange DifferentialOrange force-pushed the DifferentialOrange/gh-270-lint branch from 6913935 to fc4d6e8 Compare March 30, 2023 17:25
@DifferentialOrange DifferentialOrange merged commit 4bdbdda into master Mar 30, 2023
@DifferentialOrange DifferentialOrange deleted the DifferentialOrange/gh-270-lint branch March 30, 2023 17:42
DifferentialOrange added a commit to tarantool/doc that referenced this pull request Sep 4, 2023
tarantool-python static analysis was introduced in [1], CRUD API was
introduced in [2].

1. tarantool/tarantool-python#289
2. tarantool/tarantool-python#264
DifferentialOrange added a commit to tarantool/doc that referenced this pull request Sep 4, 2023
tarantool-python static analysis was introduced in [1], CRUD API was
introduced in [2].

1. tarantool/tarantool-python#289
2. tarantool/tarantool-python#264
p7nov pushed a commit to tarantool/doc that referenced this pull request Oct 10, 2023
* connectors: remove queue-python

tarantool/queue-python [1] last commit was in 2016. Module does not
support Tarantool 1.6+.

1. https://github.com/tarantool/queue-python

* connectors: update aiotarantool status

shveenkov/aiotarantool last commit was in 2019.

1. https://github.com/shveenkov/aiotarantool

* connectors: remove gtarantool from comparison

shveenkov/gtarantool [1] last commit was in 2016. It is useless for
modern Tarantool users.

1. https://github.com/shveenkov/gtarantool

* connectors: update comparison table

tarantool-python static analysis was introduced in [1], CRUD API was
introduced in [2].

1. tarantool/tarantool-python#289
2. tarantool/tarantool-python#264
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.

Lint Python code
1 participant