Skip to content

fix(lint): hoist hooks_cli_mod import to top of test_hooks_cli (E402)#1375

Merged
igorls merged 1 commit into
developfrom
fix/lint-e402-test-hooks-cli
May 6, 2026
Merged

fix(lint): hoist hooks_cli_mod import to top of test_hooks_cli (E402)#1375
igorls merged 1 commit into
developfrom
fix/lint-e402-test-hooks-cli

Conversation

@igorls

@igorls igorls commented May 6, 2026

Copy link
Copy Markdown
Member

Problem

The lint check on develop has been failing since #1305 merged with a red `lint` check (the other 5 OS lanes were green, so the merge went through). The failure is:

```
tests/test_hooks_cli.py:972:1: E402 Module level import not at top of file
```

`import mempalace.hooks_cli as hooks_cli_mod` was placed at line 972, below an explanatory comment block introduced by #1305. Every PR rebased onto develop now inherits this failure (just hit it on #988's rebase).

Fix

Move the import next to the existing `from mempalace.hooks_cli import (...)` line at the top of the file. The comment block above the original location explains what the tests are checking, not why the import had to live there — there's no reason it can't sit with the other imports.

Test plan

  • `uvx ruff@0.4 check .` — passes
  • `uvx ruff@0.4 format --check .` — passes
  • `pytest tests/test_hooks_cli.py` — 78 passed, 1 skipped (pre-existing)

The alias was placed below an explanatory comment block introduced by
#1305, which trips ruff E402 (module-level import not at top of file).
Moved next to the existing 'from mempalace.hooks_cli import (...)' line.

CI lint went red on develop after #1305 merged with the failing check;
this re-greens it so subsequent PRs do not inherit the failure.
Copilot AI review requested due to automatic review settings May 6, 2026 04:57
@igorls igorls added this to the v3.3.5 milestone May 6, 2026
@igorls igorls merged commit 46d9eb5 into develop May 6, 2026
8 checks passed
@igorls igorls deleted the fix/lint-e402-test-hooks-cli branch May 6, 2026 04:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a Ruff E402 lint failure in tests/test_hooks_cli.py by moving a module-level import (import mempalace.hooks_cli as hooks_cli_mod) to the top-of-file import section, keeping the existing explanatory comment block focused on test intent rather than import placement.

Changes:

  • Hoist import mempalace.hooks_cli as hooks_cli_mod to the top of tests/test_hooks_cli.py to satisfy Ruff’s “imports at top of file” rule.
  • Remove the now-redundant mid-file import that was triggering E402.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants