Skip to content
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

Fix CodemodCollection API #275

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/codemodder/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class CodemodCollection:
"""A collection of codemods that all share the same origin and documentation."""

origin: str
docs_module: str
semgrep_config_module: str
codemods: list


Expand Down
4 changes: 0 additions & 4 deletions src/core_codemods/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@

registry = CodemodCollection(
origin="pixee",
docs_module="core_codemods.docs",
semgrep_config_module="core_codemods.semgrep",
codemods=[
AddRequestsTimeouts,
DjangoDebugFlagOn,
Expand Down Expand Up @@ -125,8 +123,6 @@

sonar_registry = CodemodCollection(
origin="sonar",
docs_module="core_codemods.docs",
semgrep_config_module="core_codemods.semgrep",
codemods=[
SonarNumpyNanEquality,
SonarLiteralOrNewObjectIdentity,
Expand Down
2 changes: 0 additions & 2 deletions tests/codemods/base_codemod_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ def setup_class(cls):
collection = CodemodCollection(
origin="pixee",
codemods=[cls.codemod],
docs_module="core_codemods.docs",
semgrep_config_module="core_codemods.semgrep",
)
cls.registry = CodemodRegistry()
cls.registry.add_codemod_collection(collection)
Expand Down
2 changes: 1 addition & 1 deletion tests/codemods/test_lazy_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from core_codemods.lazy_logging import LazyLogging

logging_funcs = {"debug", "info", "warning", "warn", "error", "critical"}
each_func = pytest.mark.parametrize("func", logging_funcs)
each_func = pytest.mark.parametrize("func", sorted(logging_funcs))
Copy link
Member Author

@drdavella drdavella Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clavedeluna this would be a good codemod, although we currently ignore test directories by default. I'd like to update that logic, though, so that the ignored directories are codemod-dependent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry which part exactly do you suggest as a codemod? sorting part?



class TestLazyLoggingModulo(BaseSemgrepCodemodTest):
Expand Down
Loading