Repository navigation
feat(template): add editorconfig auto-fix target and use it in CI (issue 76) - #186
Closed
bacluc-agent wants to merge 1 commit into
Closed
bacluc-agent wants to merge 1 commit into
bacluc-agent wants to merge 1 commit into
Conversation
Contributor
|
Sorry for that. Agent should have opened the PR against a fork. |
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.
Related issue: https://github.com/bacluc-agent/agent-vshn-todo/issues/76
Summary
Adds an EditorConfig auto-fix path to the rendered component template and wires it into CI.
format_editorconfigmake target usingnpx --yes eclint@$(ECLINT_VERSION) fix ..ECLINT_VERSION ?= 2.8.1pin in{{ cookiecutter.slug }}/Makefile.vars.mkwith a# renovate: datasource=npm depName=eclintannotation.formattarget now runsformat_jsonnet format_editorconfig;lint/allare untouched.editorconfigjob now runsmake format_editorconfigfollowed bygit diff --exit-code, replacing thesnow-actions/eclint@v1.0.1action.renovate.json: regexcustomManagerwith slash-wrappedmanagerFilePatterns(/^...$/) matching{{ cookiecutter.slug }}/Makefile.vars.mk, so theECLINT_VERSIONpin is picked up.{{ cookiecutter.slug }}/.github/changelog-configuration.json:{% endraw %}→{% endraw -%}so the rendered file ends with}\n(no trailing blank line). Without this,eclint fixstrips the trailing blank line andgit diff --exit-codewould fail in CI on every component.No CI runs on fork PRs; all verification below was performed locally.
Verification
Template rendered with
cruft(2.10.x) from the committed HEAD, using 6 option combos ofadd_golden/add_matrix/add_go_unit:y y n,n n n,y y y,y n n,n y y,n n y.Rendered content (all 6 combos, exit 0 each):
format: format_jsonnet format_editorconfig ## All-in-one formattingpresent;format_editorconfig: ## Fix EditorConfig issuespresent; recipe uses a real TAB (sed -n '47p' Makefile | cat -A→^Inpx --yes eclint@$(ECLINT_VERSION) fix .).Makefile.vars.mkhasECLINT_VERSION ?= 2.8.1.snow-actions/eclintabsent from rendered.github/workflows/test.yaml;editorconfig:job containsmake format_editorconfigandgit diff --exit-code.Fixer no-op on fresh render (all 6 combos):
git init && git add -A && git committhenmake format_editorconfig→ make exit0,git status --porcelain= 0 lines,git diff --exit-codeexit0.Deliberate violation (combo
y y n):printf 'key: value \n' > bad.yaml+ commit, thenmake format_editorconfig→git diff -- bad.yamlshowskey: value→key: value,git diff --exit-codeexit1(fixer did real work).bad.yamlremoved afterwards.Idempotency: two consecutive
make format_editorconfigruns → exit0/0, tree clean after second run (0 porcelain lines, diff exit0).Old template control (upstream
de8e8df, same render options):npx --yes eclint@2.8.1 fix .rewrites only.github/changelog-configuration.json(removes trailing blank line):With the
{% endraw -%}fix, the new template produces zero rewrites (step 2).Workflow lint (all 6 combos):
yamllint -f parsable -c .yamllint.yml --no-warnings -- .github/workflows/test.yaml→ exit0for all 6.docker run --rm -v "$PWD":/repo -w /repo rhysd/actionlint:latest→ exit0for theadd_go_unit=ncombos (y y n,n n n,y n n); combos withadd_go_unit=yreport a pre-existingSC2086in the unrelated "Determine Go version from go.mod" step. Confirmed pre-existing by running actionlint on a control render of upstreamde8e8dfwith the same options (same finding at line 44, exit1). Not caused by this change; out of scope.Renovate (
npx --yes --package renovate@44.168.4 renovate-config-validator renovate.json, no--strict) → exit0, only the pre-existingconfig:base→config:recommendedmigration WARN. Matching self-check: slash-wrappedmanagerFilePatternsmatches{{ cookiecutter.slug }}/Makefile.vars.mkand not bareMakefile.vars.mk;matchStringsextracts{'datasource': 'npm', 'depName': 'eclint', 'currentValue': '2.8.1'}.make help(rendered component): showsformat_editorconfig Fix EditorConfig issues.Test evidence
No CI runs on fork PRs; verification was local (see commands and exit codes above).
Assumptions
renovate.jsontargets the template repository's own Renovate runs; the rendered component'srenovate.jsonis generated byhooks/post_gen_project.pyand is intentionally unchanged.ECLINT_VERSION = 2.8.1is the current npm latest foreclint.SC2086warning is left untouched as out of scope.