Skip to content

fix: resolve F821 undefined name violations, remove per-file-ignores#129

Merged
ericchansen merged 1 commit intomasterfrom
fix/f821-undefined-names
Mar 23, 2026
Merged

fix: resolve F821 undefined name violations, remove per-file-ignores#129
ericchansen merged 1 commit intomasterfrom
fix/f821-undefined-names

Conversation

@ericchansen
Copy link
Owner

Summary

Resolves all 33 F821 (undefined name) violations across 3 files and removes the entire per-file-ignores section from pyproject.toml.

Changes

q2mm/parsers/jaguar.py — Initialize current_structure and temp_eigenvectors before the parsing loop. These were assigned inside conditional blocks but used outside them; works at runtime but ruff couldn't verify the control flow.

q2mm/parsers/macromodel.py — Initialize bonds, angles, torsions, atoms, current_structure before the main loop in MacroModel.structures, and col_nums, elements, row_num before the word loop in MacroModelLog.hessian. Same scoping pattern.

test/test_linear_algebra.py — Replace dead code in test_last (already @unittest.skip) with pass. The method referenced log and min_hessian that were never defined — genuinely incomplete refactoring.

pyproject.toml — Remove entire [tool.ruff.lint.per-file-ignores] section. Also removed 3 stale entries (gaussian.py, mol2.py, structures.py) that had zero violations.

Verification

  • ruff check . — all checks passed
  • ruff format --check — all files formatted
  • 421 tests passed, 83 skipped

Closes #128

- jaguar.py: initialize current_structure and temp_eigenvectors before loop
- macromodel.py: initialize bonds/angles/torsions/atoms/current_structure
  and col_nums/elements/row_num before their respective loops
- test_linear_algebra.py: replace dead code in skipped test with pass
- pyproject.toml: remove entire per-file-ignores section (zero remaining)

Closes #128

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 23, 2026 20:39
Copy link

Copilot AI left a comment

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 removes all remaining Ruff F821 (undefined name) violations by making variable initialization explicit in a few legacy parsers/tests, allowing the repository-wide removal of Ruff per-file-ignores for F821.

Changes:

  • Initialize previously conditionally-assigned locals in JaguarOut.import_file() and MacroModel.structures / MacroModelLog.hessian so Ruff can prove they’re defined.
  • Remove incomplete/undefined-reference code from a skipped legacy unittest (test_last) to eliminate F821.
  • Delete the entire Ruff [tool.ruff.lint.per-file-ignores] section from pyproject.toml.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
q2mm/parsers/jaguar.py Initializes current_structure / temp_eigenvectors before the parsing loop to satisfy F821.
q2mm/parsers/macromodel.py Initializes structure-accumulator locals in .structures and Hessian parsing locals in .hessian to satisfy F821.
test/test_linear_algebra.py Removes undefined-name references from an already-skipped test to eliminate F821.
pyproject.toml Removes Ruff per-file-ignores now that F821 issues are resolved.

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

@ericchansen ericchansen merged commit 7395180 into master Mar 23, 2026
15 checks passed
@ericchansen ericchansen deleted the fix/f821-undefined-names branch March 23, 2026 20:48
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.

fix: resolve F821 undefined name violations in parsers

2 participants