ci: warn when a PR moves text and its body names no old place
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
Research direction
Start with the commit rules in CONTRIBUTING.md and the existing no-merge-commits check, then read tools/trace-decision/ for the repository’s script and test pattern. Prototype checks must inspect each PR commit from base to head, with tests that build a small repository and verify rename scores and moved-line detection across Linux, macOS, and Windows. Done means the check catches the specified mixed commits, warns for moved lines across files, and passes on the Git version used by CI.
Written by the indexing model from the issue text.
Description
Problem to solve
Commits in CONTRIBUTING.md says: "Moves and rewrites go in different commits." Then git log --follow and git log -L can follow the text, and a reader sees what the rewrite changed. No check enforces this rule. A review must find a mixed commit, and a PR branch then needs a rewrite. #4 had such a commit, and a review found it.
When to write in docs/doc-rules.md says that a rule that a tool can check goes to the tool.
Proposal
A CI job checks each commit of a PR (base..head), like no-merge-commits. It has two levels:
- A rename with a change.
git log --name-status -Mgives a rename a similarity score.R100is a pure move. A score below 100 means that the commit also changed the content. The job fails on it. - A moved block with other changes.
git diff --color-movedmarks moved lines with their own colors. A commit with moved lines and other changed lines mixes a move and a rewrite. Proposal: the job fails when both are in the same file, and only warns when they are in different files.
The check goes into a script in tools/, with tests that build a small repo, like tools/trace-decision/.
More information
I tried both levels in a temporary repo with Git for Windows:
| Commit | Result |
|---|---|
| Rename only | R100 doc.md moved.md |
| Rename and one changed line | R086 moved.md moved2.md |
| Move a section in the file | Only moved lines |
| Move a section and change one line | Moved lines, 1 removed line, 2 added lines |
For level 2, the prototype set fixed colors for color.diff.oldMoved, color.diff.newMoved, color.diff.old and color.diff.new, and counted the color codes in the output of git show --color=always --color-moved=plain.
The history of this repo has no rename with a score below 100.
Limits and choices for the maintainer:
- Git marks a block as moved only when it is long enough, about 20 letters or digits. A short moved line counts as removed and added.
- A section move often comes with link fixes in other files that point to the section. By the letter of the rule, these are rewrites. Level 2 only warns across files for this reason. The maintainer decides if the rule allows these fixes.
- Level 2 reads colors from the Git output. The tests must show that this works on Linux, macOS and Windows, and with the Git version of CI.
- A delete and an add below the rename threshold of Git (50%) are not paired as a rename. Level 1 does not see them, and
git log --followdoes not follow them either.
- Dominant language
- Shell
- Stars
- 1
- Forks
- 0
- Avg merge
- 6h 59m
- Merged PRs (30d)
- 26
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from c-w-z/commit-decision-record
-
type/documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
c-w-z/commit-decision-record#90 · 1 comment ·
Maintainers usually reply within 1 day
-
type/documentation
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
c-w-z/commit-decision-record#85 ·
Maintainers usually reply within 1 day
-
type/documentation
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
c-w-z/commit-decision-record#84 ·
Maintainers usually reply within 1 day
-
type/feature
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
c-w-z/commit-decision-record#35 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue type/documentation
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
c-w-z/commit-decision-record#33 ·
Maintainers usually reply within 1 day
All issues in c-w-z/commit-decision-record
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsotto/sotto-authenticator#139 ·
Maintainers usually reply within 1 day
-
Battery "top up once" ends immediately when UPower reports fully-charged below 100%Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
omacom/omarchy#21286 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
libretro/libretro-super#2238 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ChurchCRM/docs.churchcrm.io#328 ·
Maintainers usually reply within 1 day