Skip to content

Conversation

@chenpeizhi
Copy link
Collaborator

Use ruff for linting and formatting. Clean up the codebase.

Copilot AI review requested due to automatic review settings November 17, 2025 00:36
Copy link
Contributor

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 introduces ruff as a linting and formatting tool for the codebase and applies automated cleanup to address various code quality issues including unused imports, unused variables, and style violations.

Key changes:

  • Added ruff configuration in .ruff.toml with Python 3.12 target, 79-character line length, and selective rule ignores
  • Updated pyproject.toml to add ruff>=0.14.5, pytest, and pre-commit as dev dependencies
  • Applied automated code cleanup across multiple files to remove unused imports/variables and fix style issues

Reviewed Changes

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

Show a summary per file
File Description
.ruff.toml New ruff configuration file with sensible defaults for the project
pyproject.toml Added dev dependency group with ruff, pytest, and pre-commit
uv.lock Updated lock file with new dependencies including ruff, pre-commit, and their transitive dependencies
tests/spin_one_half_test.py Removed unused variable p
tests/name_injection_test.py Added noqa: F821 comments for intentionally undefined names from injection
tests/genquad_test.py Removed unused pytest import
drudge/utils.py Removed unused ManagedProperties import
drudge/nuclear.py Reordered variable assignments to avoid unused variable warnings
drudge/drudge.py Fixed style issues: != to is not, lambda to def, added missing import in docstring
docs/conf.py Added noqa: E402 for module-level import after other code

@chenpeizhi chenpeizhi requested a review from Copilot November 17, 2025 03:47
Copy link
Contributor

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

Copilot reviewed 47 out of 49 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

drudge/su2.py:1

  • Extra trailing comma creates a single-element tuple for phase assignment. This should be phase = _NEG_UNITY ** (JOf(k2) + mk2) without the trailing comma.
"""Drudge for SU(2) Lie algebra."""

chenpeizhi and others added 6 commits November 16, 2025 21:55
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@chenpeizhi chenpeizhi merged commit d1cb842 into master Nov 17, 2025
4 of 5 checks passed
@chenpeizhi chenpeizhi deleted the ruff branch November 17, 2025 04:04
@coveralls
Copy link

coveralls commented Nov 17, 2025

Pull Request Test Coverage Report for Build 19417954037

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 349 of 446 (78.25%) changed or added relevant lines in 15 files are covered.
  • 25 unchanged lines in 6 files lost coverage.
  • Overall coverage decreased (-0.1%) to 87.887%

Changes Missing Coverage Covered Lines Changed/Added Lines %
drudge/report.py 22 24 91.67%
drudge/_tceparser.py 17 20 85.0%
drudge/drs.py 19 22 86.36%
drudge/wick.py 6 9 66.67%
drudge/genquad.py 12 18 66.67%
drudge/utils.py 19 25 76.0%
drudge/fock.py 45 53 84.91%
drudge/nuclear.py 41 60 68.33%
drudge/term.py 58 77 75.32%
drudge/drudge.py 83 111 74.77%
Files with Coverage Reduction New Missed Lines %
drudge/fock.py 1 94.32%
drudge/report.py 1 80.95%
drudge/term.py 2 90.58%
drudge/wick.py 3 76.88%
drudge/drudge.py 5 89.66%
drudge/nuclear.py 13 72.75%
Totals Coverage Status
Change from base Build 19239773526: -0.1%
Covered Lines: 3693
Relevant Lines: 4202

💛 - Coveralls

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.

3 participants