Skip to content

Commit

Permalink
Fix CodemodCollection API (#275)
Browse files Browse the repository at this point in the history
* Fix non-deterministic test cases when using xdist

* Get rid of unused CodemodCollection attributes
drdavella authored Feb 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 6fa0615 commit 782311c
Showing 4 changed files with 1 addition and 9 deletions.
2 changes: 0 additions & 2 deletions src/codemodder/registry.py
Original file line number Diff line number Diff line change
@@ -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


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

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

sonar_registry = CodemodCollection(
origin="sonar",
docs_module="core_codemods.docs",
semgrep_config_module="core_codemods.semgrep",
codemods=[
SonarNumpyNanEquality,
SonarLiteralOrNewObjectIdentity,
2 changes: 0 additions & 2 deletions tests/codemods/base_codemod_test.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion tests/codemods/test_lazy_logging.py
Original file line number Diff line number Diff line change
@@ -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))


class TestLazyLoggingModulo(BaseSemgrepCodemodTest):

0 comments on commit 782311c

Please sign in to comment.