Replace whitespace inside template parens during make fmt (#24293)
Remove space/tab after `(` and before `)` in templates. Only two violations it seems.
This commit is contained in:
parent
cc8874864c
commit
a319da0688
3 changed files with 8 additions and 4 deletions
8
Makefile
8
Makefile
|
@ -278,8 +278,12 @@ clean:
|
||||||
fmt:
|
fmt:
|
||||||
GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
|
GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
|
||||||
$(eval TEMPLATES := $(shell find templates -type f -name '*.tmpl'))
|
$(eval TEMPLATES := $(shell find templates -type f -name '*.tmpl'))
|
||||||
@# strip whitespace after '{{' and before `}}` unless there is only whitespace before it
|
@# strip whitespace after '{{' or '(' and before '}}' or ')' unless there is only
|
||||||
@$(SED_INPLACE) -e 's/{{[ ]\{1,\}/{{/g' -e '/^[ ]\{1,\}}}/! s/[ ]\{1,\}}}/}}/g' $(TEMPLATES)
|
@# whitespace before it
|
||||||
|
@$(SED_INPLACE) \
|
||||||
|
-e 's/{{[ ]\{1,\}/{{/g' -e '/^[ ]\{1,\}}}/! s/[ ]\{1,\}}}/}}/g' \
|
||||||
|
-e 's/([ ]\{1,\}/(/g' -e '/^[ ]\{1,\})/! s/[ ]\{1,\})/)/g' \
|
||||||
|
$(TEMPLATES)
|
||||||
|
|
||||||
.PHONY: fmt-check
|
.PHONY: fmt-check
|
||||||
fmt-check: fmt
|
fmt-check: fmt
|
||||||
|
|
Loading…
Reference in a new issue