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
Testing: Linting, Add pyupgrade and fix isort #6587
Commits on Mar 20, 2024
-
Testing: Remove utf-8 declaration from add_header script; rucio#6538
UTF-8 is the default source encoding in Python 3. Declaring it is unncessary, unless Python 2 is also supported. See also: - https://peps.python.org/pep-3120/ - https://docs.python.org/3/howto/unicode.html#python-s-unicode-support - https://stackoverflow.com/questions/14083111/should-i-use-encoding-declaration-in-python-3
-
Testing: Remove utf-8 declarations; rucio#6538
UTF-8 is the default source encoding in Python 3. Declaring it is unncessary, unless Python 2 is also supported. See also: - https://peps.python.org/pep-3120/ - https://docs.python.org/3/howto/unicode.html#python-s-unicode-support - https://stackoverflow.com/questions/14083111/should-i-use-encoding-declaration-in-python-3
-
Testing: pyupgrade, remove unnecessary object inheritance; rucio#6538
Since Python 3, all classes inherit from object by default, so object can be omitted from the list of base classes. See also: - https://docs.astral.sh/ruff/rules/useless-object-inheritance/ - https://peps.python.org/pep-3115/
-
Testing: pyupgrade, replace exceptions that alias to OSError; rucio#6538
In Python3.3+, a variety of exceptions (such as IOError) were aliased to OSError, with the latter being the preferred exception to use. See also: - https://docs.python.org/3/library/exceptions.html#OSError - https://stackoverflow.com/questions/29347790/difference-between-ioerror-and-oserror - https://docs.astral.sh/ruff/rules/os-error-alias/
-
Testing: Remove extra parentheses when not needed; rucio#6538
See also: - UP034
-
-
-
Testing: Remove unnecessary encode to utf-8; rucio#6538
UTF-8 is the default encoding in Python, so there is no need to call encode when UTF-8 is the desired encoding. Instead, use a bytes literal. See also: - https://docs.astral.sh/ruff/rules/unnecessary-encode-utf8/
-
Testing: Add pyupgrade linting; rucio#6538
Pyupgrade is a linter to check for deprecated Python syntax. This commit configures ruff to perform pyupgrade linting. In the ignore list, I added some pyupgrade error codes (UP*) for the moment. These must either be fixed manually, or might be controversial in some way, so we can consider them at a later point.
-
Mark rucio as first-party dependency for isort and re-sort imports; r…
…ucio#6538 rucio is detected as a third-party dependency by default (likely has to do with the project structure or __init__ files). This change configures isort to treat rucio as a first-party dependency, and re-formats the files.