style: fix two wrong @file tags and convert leading tab indentation to spaces - #8011
Merged
mohanchen merged 2 commits intoSep 30, 2026
Merged
Conversation
Critsium-xy
force-pushed
the
chore/code-quality-easy-fixes
branch
3 times, most recently
from
September 27, 2026 10:29
1eb5da4 to
0994301
Compare
Critsium-xy
force-pushed
the
chore/code-quality-easy-fixes
branch
from
September 28, 2026 05:31
0994301 to
9b0627e
Compare
Doxygen's @file takes the name of the file it documents. These two name a file that does not exist, so Doxygen attributes the block to the wrong (or to no) file: source_base/ndarray.h said NDArray.h source_lcao/module_rt/band_energy.h said bandenegy.h (also a typo) Found by tools/03_code_analysis/code_quality_score.py (rule doc_file_mismatch). The scan also flagged source_pw/module_pwdft/radial_proj.h (said radial_projection.h), but deepmodeling#8007 has since moved that header to source_pw/module_proj/ with the tag already corrected, so it is no longer part of this commit. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
.editorconfig has required `indent_style = space` with `indent_size = 4` for the whole repository, but 339 files under source/ still indent with tabs. This converts the leading whitespace of 246 of them. 253 files were selected when this was prepared. Since then, develop has deleted two of them and already converted five others, which leaves 246: - deleted: source_lcao/setup_dm.h (deepmodeling#8000), source_pw/module_stodft/hamilt_sdft_pw.cpp (deepmodeling#8012); - already converted: source_base/module_out/binstream.{h,cpp} (deepmodeling#8025), source_pw/module_stodft/sto_hamilt_pw.h (renamed from hamilt_sdft_pw.h in deepmodeling#8012), source_io/module_ctrl/ctrl_output_pw.h and source_pw/module_pwdft/op_pw_nl.cpp (deepmodeling#8043). Files that develop moved are converted at their new path, e.g. onsite_proj_tools_stress.cpp is now under source_pw/module_proj/ (deepmodeling#8007). Scope. Three groups were deliberately left out: - 48 files touched by the pull requests open at the time of writing (deepmodeling#8000, deepmodeling#7924, deepmodeling#7906, deepmodeling#8005 and others), so this does not force a conflict on work in flight; - 5 vendored files: source_base/libm/ is ported from glibc-2.36 and carries its own LICENCE, and source_base/mcd.c is Softpixel MemCheckDeluxe under a BSD licence. Reformatting vendored sources makes future syncs with their upstream harder; - tabs that appear after the first non-blank character (alignment tabs, 1193 lines). Only leading indentation is converted. Method and verification. `expand -i -t4`, which rewrites the initial whitespace of a line and nothing else, followed by three checks: - `git diff -w --stat` is empty, so not one non-whitespace character changed anywhere in the diff; - of the 42 raw string literals in the changed files (222 lines, all in source_io/module_parameter/read_inp_out.cpp), none has a line that this commit touches. Leading whitespace inside `R"(...)"` is part of the string, so that was the one place a leading-whitespace rewrite could have changed behaviour; - no changed line follows a line ending in a backslash, so no backslash-continued string literal is affected either; - no file gained a CR. Effect on tools/03_code_analysis/code_quality_score.py: average score over source/ goes from 82.15 to 82.58 and the number of passing files from 1560 to 1562. Six files score 1 to 3 points lower, all through the `line_too_long` rule, because the scorer counts a tab as a single character while it renders as up to four columns. The lines were already over 120 columns on screen; the tab was hiding it. One of them, module_ri/exx_abfs_ctor_orbs.cpp, moves from 60 to 59 and so drops just below the tool's pass line. Wrapping those lines would mean editing code in a commit that is otherwise whitespace-only, so it is left for a follow-up. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Critsium-xy
force-pushed
the
chore/code-quality-easy-fixes
branch
from
September 30, 2026 01:35
9b0627e to
2ab39e7
Compare
mohanchen
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.source/changes.Linked Issue
No issue; this is hygiene found by running
tools/03_code_analysis/code_quality_score.pyover the wholesource/tree.Happy to open a tracking issue if maintainers prefer one.
Unit Tests and/or Case Tests for my changes
No test is added: no behaviour changes. Apart from two comment lines, the whole
diff is whitespace. What matters is the evidence that nothing
else moved.
Commands run
Result summary
git diff -w --statis empty: not one non-whitespace character changedanywhere in the 246-file whitespace commit.
source_io/module_parameter/read_inp_out.cpp), none has a line this PRtouches. Leading whitespace inside
R"(...)"is part of the string, so thatwas the one place where rewriting leading whitespace could have changed
behaviour.
backslash-continued string literal is affected either.
(
module_bse/hamilt_bse.cpp,esolver_factory.cpp,esolver_lr_lcao_bse.cpp) all stop atfatal error: RI/physics/LR.h: No such file or directory. That header isabsent from the LibRI 2.1.1 copy on this machine, which ships only
Exx.h/GW.h/RPA.h. The same three targets fail identically on theunpatched baseline, which I confirmed by reverting
source/and rebuildingthem — so this is an environment gap, not a regression from this PR.
Checks not run, with reason
Check documentation consistencystep (regeneratedocs/parameters.yamland diff) was not run locally: the local build could not link an executable
because of the LibRI gap above. This PR touches
source_io/module_parameter/read_inp_out.cpp, but only outside its raw stringliterals, so the generated docs cannot change. CI's own doc-consistency step is
the authoritative check and will confirm it.
What's changed?
1. Two
@filetags that name a file which does not exist. Doxygen thenattributes the block to the wrong file, or to none.
@filesaidsource_base/ndarray.hNDArray.hsource_lcao/module_rt/band_energy.hbandenegy.h(also a typo)The scorer's
doc_file_mismatchrule originally flagged a third file,source_pw/module_pwdft/radial_proj.h(saidradial_projection.h). #8007 hassince moved that header to
source_pw/module_proj/radial_proj.hwith the tagalready corrected, so it was dropped from this PR on rebase.
2. Leading tab indentation converted to spaces in 246 files.
.editorconfighas requiredindent_style = spacewithindent_size = 4forthe whole repository, yet 339 files under
source/still indent with tabs(18,846 lines).
expand -i -t4rewrites the initial whitespace of a line andnothing else.
Three groups were deliberately left out:
Refactor occupy.h/cpp and update MPI kmesh_world #7906, Add CUDA NEP backend and GPU neighbor lists #8005 and others), so this does not force a conflict on work in flight.
Of the 286 files selected, 253 actually had leading tabs; the rest had only
alignment tabs. Since then
develophas deletedsource_lcao/setup_dm.h(Refactor density matrix module. #8000) and
module_stodft/hamilt_sdft_pw.cpp(Move HSolverPW_SDFT into module_stodft as StoHSolverPW; rename HamiltSdftPW to StoHamiltPW #8012), and already convertedmodule_out/binstream.{h,cpp}(fix: guard Binstream write path against unopened files and failed fwrite #8025),module_stodft/sto_hamilt_pw.h(Move HSolverPW_SDFT into module_stodft as StoHSolverPW; rename HamiltSdftPW to StoHamiltPW #8012),
module_ctrl/ctrl_output_pw.handmodule_pwdft/op_pw_nl.cpp(Feature: Plane-wave RT-TDDFT with CPU/GPU and mixed-precision support #8043), leaving 246. Files that
developmoved are converted at their newpath, e.g.
module_proj/onsite_proj_tools_stress.cpp(Refactor projection in pw basis #8007).source_base/libm/is ported from glibc-2.36 and carriesits own
LICENCE;source_base/mcd.cis Softpixel MemCheckDeluxe under a BSDlicence. Reformatting vendored sources makes future syncs with their upstream
harder.
leading indentation is converted.
Effect on
code_quality_score.pyoversource/: average 82.15 -> 82.58,passing files 1560 -> 1562, 204 files up and 6 down.
The 6 that go down lose 1 to 3 points, all through
line_too_long, because thescorer counts a tab as one character while it renders as up to four columns.
Those lines were already past 120 columns on screen; the tab was hiding it. One
of them,
module_ri/exx_abfs_ctor_orbs.cpp, moves from 60 to 59 and so slipsjust under the tool's pass line. Wrapping those lines would mean editing code in
a commit that is otherwise whitespace-only, so I left it for a follow-up rather
than muddy the diff.
Reviewers:
git diff -won this branch is empty, so reviewing withgit diff -wor GitHub's "Hide whitespace changes" shows only the twocomment lines from the first commit.
Rebase notes
The branch has been rebased onto
developfour times to resolve conflicts with PRsmerged in the meantime (#8000, #8007, #8012, #8023, #8025, #8026, #7924, #8043 and others). Because the
second commit is whitespace-only, conflicts were not merged by hand: each
conflicting file was taken from
developas-is andexpand -i -t4was run onit again. After the latest rebase (base
43a4a2afb):git diff -w --stat upstream/developlists onlyndarray.handband_energy.h(one comment line each);left;
git ls-files --eolreports all of them asi/lf w/lf, and no addedline ends in CR;
read_inp_out.cpp(the only changed file with raw string literals) waschanged on
developagain (Update out_stru parameter and its output context #8026, feat(xc): add gga_grad 1/2 with variationally consistent mode 2 #7924), so the raw-string check was re-runon the rebased file: 42 literals covering 222 lines, 47 lines changed by this PR,
overlap none; no changed line follows a backslash-continued line;
PYTHONUTF8=1 python tools/03_code_analysis/agent_governance_check.py --base upstream/develop --head HEAD --format textexits 0 with no errors; its warnings are the INPUT-docs warning answered
below plus "new default parameters" warnings on existing declarations
(e.g.
blas_connector.h) whose lines were only re-indented.The full compile check above was run before the rebases; CI builds the rebased
branch.
Governance Notes
documentation warning because
source_io/module_parameter/read_inp_out.cppisin the diff, but no
Input_Itemregistration,annotation,description,default_valueor availability changes. The parameter descriptions in thatfile live inside
R"(...)"raw string literals, and none of the 222 linescovered by those literals is touched by this PR, so
docs/parameters.yamlanddocs/advanced/input_files/input-main.mdneed no regeneration.flow changes anywhere. ESolver, HSolver, ElecState, Hamilt, Operator and Psi
are affected only by the indentation of lines in files they own.
🤖 Generated with Claude Code