-
Notifications
You must be signed in to change notification settings - Fork 32
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
Chore: Fix typos and linter errors #196
Conversation
Hey, I gave it a shot.
So, is that the expected behavior ? |
The stuff running in pre-commit hooks is run against the changed files to be commited - so if they are without typos and ruff isn't complaining, then you are fine. But try to fix typo it one of the huge files, like |
There is a place for fine tuning: if you need to add some words to be ignored by codespell (like parms used in Houdini), you can edit Warning words in In similar manner, ruff can be tweaked per file - remember, there is no file-wide [tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402"] this will apply |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file does not match the function in the .py
file - shall we remove it completely? OR fix it up? e.g. remap_source
does not have a source
argument.
Also, it lacks many functions that are in the .py
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove it - this was there mainly for python 2 compatibility and with ayon-core, we can drop it.
@@ -1,5 +1,5 @@ | |||
from ayon_server.settings import BaseSettingsModel, SettingsField | |||
from ayon_server.types import ColorRGBA_uint8, ColorRGB_uint8 | |||
from ayon_server.types import ColorRGBA_uint8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're at it. Should we also remove the commented lines on lines 16-18 along with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lines are actually correct and should be used. But that would require to implement conversion of settings in server addon.
I wanted to do that when we split TVPaint to real addon.
@@ -9,7 +9,6 @@ | |||
) | |||
|
|||
from .pipeline import ( | |||
AfterEffectsHost, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if instead of removing this it should actually be added to the __all__
below instead? (Looking at what the api/__init__.py
seems to do for e.g. Blender or Maya hosts.
@@ -7,7 +7,6 @@ | |||
import hiero.core | |||
from hiero.core import util | |||
|
|||
import opentimelineio as otio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this here to make sure otio is imported?
# append reformated tag | ||
add_tags.append("reformated") | ||
# append reformatted tag | ||
add_tags.append("reformatted") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure we should not be changing these "tags" keys unless we're entirely sure that ALL other code relying on reformated
to be refactored as well?
E.g. here:
reformat_in_baking = bool("reformated" in new_repre["tags"]) |
reformated
occurs in many other places instead of just here.
@@ -766,8 +766,7 @@ def _rename_groups( | |||
group["red"], | |||
group["green"], | |||
group["blue"], | |||
group_name | |||
) | |||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | |
) |
@@ -13,7 +13,6 @@ def tray_init(self): | |||
# Add library tool | |||
self._loader_imported = False | |||
try: | |||
from ayon_core.tools.loader.ui import LoaderWindow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Purpose of the method is to make sure the tool can be imported, removing the import makes it useless.
@@ -1,15 +0,0 @@ | |||
from .font_factory import FontFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think removing content of api.py
in this case is not a good idea. Probably rather add __all__
.
@@ -720,7 +720,7 @@ class IntegrateHeroVersionModel(BaseSettingsModel): | |||
|
|||
class CleanUpModel(BaseSettingsModel): | |||
_isGroup = True | |||
paterns: list[str] = SettingsField( | |||
patterns: list[str] = SettingsField( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was kept as paterns
on purpose for backwards compatibility. This would require to handle the change of the model in server addon.
@@ -1,5 +1,4 @@ | |||
import os | |||
from .version import __version__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is here on purpose...
commandlet_cmd = [f'{ue_editor_exe.as_posix()}', | ||
f'{cmdlet_project.as_posix()}', | ||
f'-run=AyonGenerateProject', | ||
'-run=AyonGenerateProject', | ||
f'{project_file.resolve().as_posix()}'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commandlet_cmd = [
ue_editor_exe.as_posix(),
cmdlet_project.as_posix(),
'-run=AyonGenerateProject',
project_file.resolve().as_posix()
]
@@ -1,13 +1,8 @@ | |||
from ayon_core.addon import ( | |||
AYONAddon, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are here on purpose ayon_core.modules
exists only for backwards compatibility.
@@ -1,4 +1,3 @@ | |||
import ayon_api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ok to have first line empty?
@@ -58,7 +58,7 @@ def load(self, context, name=None, namespace=None, data=None): | |||
|
|||
normal_node.setInput(0, unpack) | |||
|
|||
null = container.createNode("null", node_name="OUT".format(name)) | |||
null = container.createNode("null", node_name="OUT".format()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null = container.createNode("null", node_name="OUT".format()) | |
null = container.createNode("null", node_name="OUT") |
@@ -72,5 +72,5 @@ def get_invalid(cls, instance): | |||
if output_node.type().category().name() != "Cop2": | |||
raise PublishValidationError( | |||
("Output node %s is not of category Cop2. " | |||
"This is a bug...").format(output_node.path()), | |||
"This is a bug...").format(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"This is a bug...").format(), | |
"This is a bug..."), |
@@ -74,7 +74,7 @@ def process(self, instance): | |||
renamed_to_extract.append("|".join(node_path)) | |||
|
|||
with renamed(original_parent, parent_node): | |||
self.log.debug("Extracting: {}".format(renamed_to_extract, path)) | |||
self.log.debug("Extracting: {}".format(renamed_to_extract, )) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.log.debug("Extracting: {}".format(renamed_to_extract, )) | |
self.log.debug("Extracting: {}".format(renamed_to_extract)) |
This just can't be merged in single PR, or it would take too long. The PR contains crutial bugfixes, some changes that can be merged without much thinking, but also many questionable changes that need discussions. I'll start to make separate PRs based on changes here. We can keep this as reference. |
I gave it another shot. I found out that
I think this PR works but I wonder why do I in some case find inconsistent results ? (I have code-spell from this PR and VS extension) Running tool provided by this PR:
A no0b question. (sorry I need to check my understanding).
Fixing workflow mentioned in the PR description is basically:
So, was that summary correct ? Another question: |
Tested with this code and it works as expected. Just wondering if this can be also applied to the addon repos which are already separate(e.g. zbrush, resolve etc.)? Or I have to add it into client folder for the check in the current stage? |
closing as this was already merged via different PRs and is working |
Changelog Description
Fixing typos and linter errors in the repository.
Additional info
Based on #192 this is using codespell and ruff to cleanup the repo. (Un)fortunately any typo-fixed is marking the file as a food for ruff and so it starts triggering linter errors in pre-commit hook preventing the commit. The only way around it is obey the ruff tool - and that is a good thing, isn't it?
Note
This is using #192 for tools
Fixing workflow
./.poetry/bin/poetry run codespell
./.poetry/bin/poetry run ruff check /path/to/file.py