Skip to content

ci: standardise pre-commit, lint and release tooling - #130

Merged
av-dev2 merged 4 commits into
Aakvatech-Limited:version-15-hotfixfrom
av-dev2:chore/ci-standardisation
Aug 26, 2026
Merged

ci: standardise pre-commit, lint and release tooling#130
av-dev2 merged 4 commits into
Aakvatech-Limited:version-15-hotfixfrom
av-dev2:chore/ci-standardisation

Conversation

@av-dev2

@av-dev2 av-dev2 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Brings this app onto the shared toolchain so every in-house app enforces the
same rules.

Hooks now run at three stages

Stage Scope Behaviour
pre-commit staged files fast, autofixes, blocks the commit
commit-msg the message conventional prefix, blocks the commit
pre-push whole repository blocks the push on any failure

The push gate runs pre-commit run --all-files, so one push covering several
commits is checked in full without slowing down each individual commit. It was
verified against a throwaway remote: a file committed with --no-verify is
caught and the push is rejected with nothing landing on the remote.

Run bash scripts/setup-git-hooks.sh once per clone. It installs pre-commit if
it is missing and wires up all three hooks. Git cannot force hooks onto a fresh
clone, so the Pre-commit workflow runs --all-files on every pull request as
the real gate.

Standardised

  • ruff for lint and format, replacing the per-app mix of black, isort, flake8,
    autopep8 and autoflake
  • commitlint for commit messages, replacing three different checkers
  • the self-contained frappe-semgrep hook, which installs semgrep into its own
    environment and clones the rules relative to the repo
  • an anchored exclude regex. The old node_modules|.git pattern also matched
    .github, so no workflow YAML was ever validated.

Removed

  • 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.
  • 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, which fails
    the promotion job.

Before merging

Check branch protection. If a required status check names CI / Server Tests or
CI / Install Smoke Check, that check no longer exists and will block every pull
request 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.json is 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.

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.
@av-dev2
av-dev2 merged commit 1fcaa1f into Aakvatech-Limited:version-15-hotfix Aug 26, 2026
@github-actions

Copy link
Copy Markdown

Backport failed for version-16-hotfix, because it was unable to cherry-pick the commit(s).

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants