-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: ignore UP031 #762
Fix: ignore UP031 #762
Conversation
CodSpeed Performance ReportMerging #762 will not alter performanceComparing Summary
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #762 +/- ##
=======================================
Coverage 85.15% 85.15%
=======================================
Files 81 81
Lines 7526 7526
=======================================
Hits 6409 6409
Misses 1117 1117 ☔ View full report in Codecov by Sentry. |
Warning Rate limit exceeded@wanghan-iapcm has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 1 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 Walkthrough📝 WalkthroughWalkthroughThis pull request primarily updates the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (3)
dpdata/plugins/amber.py (1)
139-140
: Consider using f-strings for better readabilityWhile the current %-formatting with
noqa: UP031
works, f-strings would be more Pythonic and eliminate the need for the linting suppressions:- inp_fn = os.path.join(d, "%d.in" % ii) # noqa: UP031 - out_fn = os.path.join(d, "%d.out" % ii) # noqa: UP031 + inp_fn = os.path.join(d, f"{ii}.in") + out_fn = os.path.join(d, f"{ii}.out")However, since this PR's focus is on fixing UP031 warnings, the current approach with noqa comments is acceptable.
dpdata/abacus/relax.py (1)
50-50
: Consider using f-strings for error messagesWhile the noqa comment addresses the UP031 warning, consider using f-strings for better readability:
- "ERROR: detected atom number in log file is %d" % natoms # noqa: UP031 + f"ERROR: detected atom number in log file is {natoms}"dpdata/rdkit/sanitize.py (1)
370-370
: Consider modernizing string formatting throughout the file.While the current changes to suppress warnings are acceptable, consider modernizing the codebase to use f-strings consistently throughout the file. This would improve readability and follow modern Python practices.
Example refactor:
- mol.SetProp("edit", "%d_%d" % (i, j)) # noqa: UP031 + mol.SetProp("edit", f"{i}_{j}") - mol.SetProp("edit", edited + ",%d_%d" % (i, j)) # noqa: UP031 + mol.SetProp("edit", f"{edited},{i}_{j}")Also applies to: 373-373
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (18)
.pre-commit-config.yaml
(1 hunks)dpdata/abacus/md.py
(4 hunks)dpdata/abacus/relax.py
(2 hunks)dpdata/data_type.py
(1 hunks)dpdata/deepmd/comp.py
(2 hunks)dpdata/deepmd/hdf5.py
(2 hunks)dpdata/deepmd/raw.py
(1 hunks)dpdata/gaussian/gjf.py
(2 hunks)dpdata/lammps/dump.py
(1 hunks)dpdata/lammps/lmp.py
(6 hunks)dpdata/plugins/amber.py
(1 hunks)dpdata/plugins/gaussian.py
(1 hunks)dpdata/pwmat/atomconfig.py
(2 hunks)dpdata/qe/traj.py
(2 hunks)dpdata/rdkit/sanitize.py
(1 hunks)dpdata/system.py
(3 hunks)dpdata/vasp/poscar.py
(2 hunks)dpdata/vasp/xml.py
(2 hunks)
✅ Files skipped from review due to trivial changes (14)
- dpdata/abacus/md.py
- dpdata/data_type.py
- dpdata/pwmat/atomconfig.py
- dpdata/deepmd/comp.py
- dpdata/vasp/xml.py
- dpdata/vasp/poscar.py
- dpdata/gaussian/gjf.py
- dpdata/qe/traj.py
- dpdata/plugins/gaussian.py
- dpdata/deepmd/raw.py
- dpdata/deepmd/hdf5.py
- dpdata/lammps/dump.py
- dpdata/lammps/lmp.py
- dpdata/system.py
🧰 Additional context used
🪛 Ruff (0.8.0)
dpdata/abacus/relax.py
79-79: Do not assert False
(python -O
removes these calls), raise AssertionError()
Replace assert False
(B011)
🔇 Additional comments (2)
.pre-commit-config.yaml (1)
24-24
: Verify compatibility with ruff v0.8.1
The update from v0.7.4 to v0.8.1 is significant. Let's verify there are no breaking changes that could affect the codebase.
✅ Verification successful
The update to ruff v0.8.1 appears safe to proceed
The codebase shows extensive Python files that would be affected by ruff linting. The pre-commit configuration is properly structured with ruff configured to run in fix mode, which will automatically correct any fixable issues. Since ruff follows semantic versioning, the update from v0.7.4 to v0.8.1 should maintain backward compatibility for existing rules.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for breaking changes between ruff versions
# Get the changelog for the version update
curl -s https://raw.githubusercontent.com/astral-sh/ruff/main/CHANGELOG.md | grep -A 10 "## \[0.8.1\]"
# Check if there are any remaining UP031 violations after the update
ruff check --select UP031 .
Length of output: 229
Script:
#!/bin/bash
# Let's check the codebase for any Python files and potential UP031 violations
# using ast-grep since ruff is not available in the sandbox
# First, let's find all Python files
fd -e py
# Check for any instances of 'print' function calls without parentheses
# which is what UP031 typically flags
ast-grep --pattern 'print $_'
# Let's also check the pre-commit config details
cat .pre-commit-config.yaml
Length of output: 6339
dpdata/rdkit/sanitize.py (1)
370-370
: LGTM! Suppressing UP031 warnings is appropriate here.
The addition of # noqa: UP031
comments to suppress the string formatting warnings is acceptable as it's part of a targeted effort to address specific linting issues.
Also applies to: 373-373
Summary by CodeRabbit
SQMMinimizer
class for enhanced data minimization.sanitize_mol
function.