Skip to content

Fix all open Codacy pylint issues on dev#57

Merged
JE-Chen merged 1 commit intodevfrom
codacy-fixes-all-issues
Apr 24, 2026
Merged

Fix all open Codacy pylint issues on dev#57
JE-Chen merged 1 commit intodevfrom
codacy-fixes-all-issues

Conversation

@JE-Chen
Copy link
Copy Markdown
Member

@JE-Chen JE-Chen commented Apr 24, 2026

Summary

  • Resolves all 95 pylint findings Codacy reported on dev across 27 files.
  • Real code/test fixes where pylint caught a genuine smell; targeted configuration where the rule fires on idiomatic patterns pylint doesn't understand (pytest fixtures, parallel backend-client skeletons, lazy-import cycles).
  • Verified: ruff check, ruff format --check, and the full pytest suite (651 passed, 8 skipped) all pass.

Highlights

Source

  • automation_file/core/config.py — move the tomllib/tomli conditional into a _load_tomllib() helper so module-level imports stay at the top (fixes 5 C0413).
  • automation_file/core/dag_executor.py — justify the intra-package call to ActionExecutor._execute_event with an inline protected-access disable.
  • .pylintrc — add R0401 (cyclic-import) and R0801 (duplicate-code) to the project-level disables, each with a rationale comment. The cycle is a runtime-safe lazy import; the duplicate-code warnings fire on the parallel S3Client / AzureBlobClient / DropboxClient / FTPClient / SFTPClient wrappers that intentionally share a minimal skeleton.

Tests

  • Rewrite 13 x == [] assertions to not x.
  • Convert pytest fixtures in 8 files to the @pytest.fixture(name=\"foo\") + _foo pattern so they no longer shadow the test-parameter name (fixes all 44 W0621).
  • Drop truly unused tmp_path parameters (test_dir_ops, test_file_ops, test_substitution).
  • Switch patch_validator callers to @pytest.mark.usefixtures and strengthen FTP tests that previously received fake_ftp only for side effects to now assert against its recorded state.
  • Add targeted protected-access disables where tests deliberately probe internals (Prometheus ._value, cross_backend._split, AuditLog._db_path, Scheduler._dispatch, fast_find._run_indexer).
  • Keep lambda tag: seen.append(tag) in test_callback_executor with a disable — list.append rejects kwargs, so the lambda is necessary.

Test plan

  • ruff check automation_file/ tests/
  • ruff format --check automation_file/ tests/
  • pytest tests/ — 651 passed, 8 skipped
  • Codacy re-scan on this PR confirms the 95 issues drop to zero

Address the 95 pylint findings Codacy reported on dev. Changes are split
between real code fixes and configuration where the rule fires on an
idiomatic pattern pylint doesn't understand.

- core/config.py: move the tomllib/tomli conditional into a helper so
  all module-level imports stay at the top (5 C0413 fixes).
- core/dag_executor.py: justify the Template-Method protected-access
  call with an inline pylint disable.
- tests: rewrite `x == []` assertions to `not x`, drop truly unused
  `tmp_path` params, convert pytest fixtures to the
  `@pytest.fixture(name=...)` + `_foo` pattern so they no longer shadow
  the test-param name, and switch `patch_validator` callers to
  `@pytest.mark.usefixtures`. Strengthen the FTP tests that receive
  `fake_ftp` purely for side effects by asserting on its recorded
  state. Add targeted `protected-access` disables where tests probe
  internals intentionally.
- .pylintrc: disable R0401 (cyclic-import) and R0801 (duplicate-code)
  project-wide with rationale — the cloud-backend cycle is a runtime
  lazy import, and the duplicate-code warnings fire on the parallel
  remote client wrappers by design.

Verified: `ruff check`, `ruff format --check`, and the full pytest
suite (651 passed, 8 skipped) all pass.
@sonarqubecloud
Copy link
Copy Markdown

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 404aaf3 into dev Apr 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant