refactor(ruff): remove ruff per file exemptions (#2120)#2139
refactor(ruff): remove ruff per file exemptions (#2120)#2139cfxegbert wants to merge 13 commits into
Conversation
Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
…cademySoftwareFoundation#2120) Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
…ftwareFoundation#2120) Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
…ation#2120) Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
…mySoftwareFoundation#2120) Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
…ion#2120) Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
…ation#2120) Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
…ion#2120) Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
Signed-off-by: Robert Minsk <robertminsk@yahoo.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2139 +/- ##
==========================================
- Coverage 61.31% 61.30% -0.02%
==========================================
Files 164 164
Lines 20568 20573 +5
Branches 3575 3576 +1
==========================================
+ Hits 12611 12612 +1
- Misses 7085 7088 +3
- Partials 872 873 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JeanChristopheMorinPerso
left a comment
There was a problem hiding this comment.
Let a few comments. Let me know what you think
| - '!src/rez/utils/_version.py' | ||
| - '!src/rez/vendor/**' | ||
| - '!src/rez/data/**' | ||
| - '!src/support/**' |
There was a problem hiding this comment.
Umm, support is something we would want to lint eventually...
|
|
||
| def commands() -> None: | ||
| env.PYTHONPATH.append('{this.root}/python') | ||
| env.PYTHONPATH.append('{this.root}/python') # noqa: F821 |
There was a problem hiding this comment.
I would prefer if we use qualified names instead of IDs.
| extend = "../../../ruff.toml" | ||
|
|
||
| # Treat rex as builtin | ||
| builtins = [ |
There was a problem hiding this comment.
This feels "risky" to me. Can we instead use https://github.com/AcademySoftwareFoundation/rez/blob/main/src/rez/utils/lint_helper.py where these are referenced?
|
|
||
| def __eq__(self, other): | ||
| return type(self) == type(other) and str(self) == str(other) # noqa: E721 | ||
| if isinstance(other, type(self)): |
There was a problem hiding this comment.
Are we 100% sure that this will not create a problem? This is different than type() == type(). isinstance will check if an object is an instance of a class or a subclass.
|
|
||
| def __eq__(self, other): | ||
| return type(self) == type(other) # noqa: E721 | ||
| return type(self) is type(other) |
There was a problem hiding this comment.
Why do we use is here while we are using isinstance higher?
| return type(self) == type(other) and str(self) == str(other) # noqa: E721 | ||
| if isinstance(other, type(self)): | ||
| return str(self) == str(other) | ||
| return NotImplemented |
There was a problem hiding this comment.
Why return NotImplemented here and not in other classes?
| import venv | ||
| except ImportError: | ||
| USE_VIRTUALENV = True | ||
| import virtualenv |
There was a problem hiding this comment.
Should we keep this just to make sure that there's an import failure if it's not installed?
Branch summary:
refactor/2120-remove-ruff-per-file-exemptions13 commits ahead of
main(issue #2120). 16 files changed, +55 / −84 lines.Goal
Remove most Ruff per-file-ignores and fix the underlying lint issues in code instead of suppressing them globally per file.
Config & CI
ruff.toml: Dropped ~20 per-file ignore entries (tests, bind, resolver, CLI, rezgui, install/setup scripts, etc.). Only one remains:src/rezplugins/release_vcs/git.py— F821 (undefinedgitinexport(); uses thegitPython package, which isn’t installed — noted as a known bug used byrez-diff/diff_packages.py)ruff.toml+.github/workflows/ruff.yaml: Excludesrc/support/from Ruff entirely.src/rez/tests/ruff.toml(new): Extends root config and treats rex builtins (env,command, etc.) as known names in tests.Code fixes (replacing suppressions)
package_order.py,rezgui/objects/Config.py— usetype(x) is type(y)cli/_main.py— f-strings instead of implicit concatenationContextToolsWidget.py— removed unusedappimport;install.py— removed unusedvirtualenvimportTimestampWidget.py— inline lambdaresolver.py— TYPE_CHECKING imports;bind/_pymodule.py— inline# noqa: F821onenvtest_formatter.py— inline# noqa: E742on classIinstall.py,setup.py,release-rez.py— inline# noqa: E402release-rez.py— inline# noqa: DTZ011ondate.today()git.py— added missingretain_cwdimport (used byexport(), whichdiff_packages.pycalls)Not in committed changes
diff_packages.pyis unchanged on this branch; it’s relevant context because it callsGitReleaseVCS.export(), which is why thegit.pyF821 exemption remains.I used some help from an LLM to create the summary for this PR