ci: standardise pre-commit, lint and release tooling - #130
Merged
av-dev2 merged 4 commits intoAug 26, 2026
Merged
Conversation
Add a pre-push hook that runs pre-commit over the whole repository, so a push is rejected when any file is unclean. The commit hook keeps checking staged files only. Replace the divergent per-app setups with one shared toolchain: ruff for lint and format, the self-contained frappe-semgrep hook, and commitlint for commit messages. Anchor the exclude regex so .github/ is no longer skipped by an unanchored .git pattern. Add the pre-commit and semantic-commits workflows, and scripts/setup-git-hooks.sh for a one-command developer bootstrap. Remove ci.yml. Building a bench and migrating a throwaway site cost five to eight minutes per pull request and went red for upstream and runner problems unrelated to the change. Frappe tests continue to run locally. Remove release.yml and .releaserc.json. tag-and-promote-from-pr-label.yml is now the only owner of tags, releases and promotion; running semantic-release alongside it made both tag the same version at different commits.
Mechanical reformat produced by the standardised hooks. No behaviour change.
Merge 5541d80 damaged two files. bom_additional_costs.json was truncated to zero bytes, losing the BOM Additional Costs DocType definition. Restored from 1e41f56, the last good version. weighbridge_ticket.py was concatenated with a second full copy of itself, so the module defined WeighbridgeTicket twice. Python used the second definition, which came from the branch that predated 4528d74 and therefore reinstated the ticket link writes that commit deliberately removed. Rebuilt from 916e2c7, the parent that carries the refactor; the two parents differ only by that change.
orderby passed Order.asc positionally, so pypika read it as a second ORDER BY column instead of a direction. Now passed as the order keyword, in five queries. get_value on a Single doctype is not type safe; switched to get_single_value. Exception objects were interpolated into translated strings; now converted with str() first. The remaining changes are ruff autofixes: unused variables, printf style formatting, isinstance unions and identity comparisons. One rewrite was reverted: ruff turned a Frappe checkbox test into 'is True', which is False for the integer 1 that Frappe returns, so it is now a plain truthiness test.
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin version-16-hotfix
git worktree add -d .worktree/backport-130-to-version-16-hotfix origin/version-16-hotfix
cd .worktree/backport-130-to-version-16-hotfix
git switch --create backport-130-to-version-16-hotfix
git cherry-pick -x b6ee98d4163a56a5ef5d98e456e5473c95a1de83 30c22039cd10a4df624076b64e612480543f66bf 53f23404389390818f475f0a36b81f7d16e5fe53 15ab08bf4b40686ccda968df8f29c2696595c04a |
This was referenced Aug 26, 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.
Brings this app onto the shared toolchain so every in-house app enforces the
same rules.
Hooks now run at three stages
pre-commitcommit-msgpre-pushThe push gate runs
pre-commit run --all-files, so one push covering severalcommits is checked in full without slowing down each individual commit. It was
verified against a throwaway remote: a file committed with
--no-verifyiscaught and the push is rejected with nothing landing on the remote.
Run
bash scripts/setup-git-hooks.shonce per clone. It installs pre-commit ifit is missing and wires up all three hooks. Git cannot force hooks onto a fresh
clone, so the
Pre-commitworkflow runs--all-fileson every pull request asthe real gate.
Standardised
autopep8 and autoflake
environment and clones the rules relative to the repo
excluderegex. The oldnode_modules|.gitpattern also matched.github, so no workflow YAML was ever validated.Removed
ci.yml. Building a bench and migrating a throwaway site cost five to eightminutes per pull request and went red for upstream and runner problems
unrelated to the change. Frappe tests continue to run locally.
release.ymland.releaserc.json.tag-and-promote-from-pr-label.ymlis nowthe only owner of tags, releases and promotion. Running semantic-release
alongside it made both tag the same version at different commits, which fails
the promotion job.
Before merging
Check branch protection. If a required status check names
CI / Server TestsorCI / Install Smoke Check, that check no longer exists and will block every pullrequest until the rule is updated.
Pre-commit will be red. Three pre-existing problems remain:
av_tools/av_tools/doctype/bom_additional_costs/bom_additional_costs.jsonis 0 bytes so the DocType definition is lost, 45 ruff findings, and 17 semgrep findings including 3 multitenancy breaks. All need a separate pull request.