From 647b2649b1600107c5fec3505db691f78b2c1e2a Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 31 Aug 2022 17:58:54 +0200 Subject: [PATCH] Make sure fmt catches all templates (#20979) * Make sure fmt catches all templates Make's `wildcard` is not recursive so it missed many template files, fix that by using `find`. * Update Makefile --- Makefile | 2 +- templates/admin/auth/edit.tmpl | 12 +-- templates/admin/auth/new.tmpl | 8 +- templates/admin/user/edit.tmpl | 2 +- templates/admin/user/new.tmpl | 2 +- templates/mail/auth/activate.tmpl | 2 +- templates/mail/auth/activate_email.tmpl | 2 +- templates/mail/auth/reset_passwd.tmpl | 2 +- templates/org/member/members.tmpl | 4 +- templates/package/shared/list.tmpl | 2 +- templates/repo/diff/blob_excerpt.tmpl | 8 +- .../repo/diff/comment_form_datahandler.tmpl | 6 +- templates/repo/diff/comments.tmpl | 12 +-- templates/repo/diff/compare.tmpl | 8 +- templates/repo/diff/image_diff.tmpl | 16 ++-- templates/repo/diff/new_review.tmpl | 4 +- templates/repo/diff/section_split.tmpl | 4 +- templates/repo/diff/section_unified.tmpl | 4 +- templates/repo/diff/whitespace_dropdown.tmpl | 8 +- templates/repo/editor/edit.tmpl | 4 +- templates/repo/editor/upload.tmpl | 4 +- templates/repo/graph/commits.tmpl | 10 +-- templates/repo/issue/labels.tmpl | 2 +- templates/repo/issue/labels/label_list.tmpl | 4 +- templates/repo/issue/milestone_issues.tmpl | 2 +- templates/repo/issue/milestones.tmpl | 2 +- templates/repo/issue/new_form.tmpl | 4 +- templates/repo/issue/view_content.tmpl | 26 +++--- .../repo/issue/view_content/add_reaction.tmpl | 4 +- .../repo/issue/view_content/comments.tmpl | 80 +++++++++---------- .../view_content/comments_delete_time.tmpl | 6 +- .../repo/issue/view_content/context_menu.tmpl | 12 +-- templates/repo/issue/view_content/pull.tmpl | 24 +++--- .../repo/issue/view_content/reactions.tmpl | 2 +- .../view_content/reference_issue_dialog.tmpl | 2 +- .../repo/issue/view_content/sidebar.tmpl | 26 +++--- templates/repo/issue/view_title.tmpl | 18 ++--- templates/repo/migrate/migrate.tmpl | 2 +- templates/repo/projects/list.tmpl | 4 +- templates/repo/projects/view.tmpl | 42 +++++----- templates/repo/release/list.tmpl | 6 +- templates/repo/settings/collaboration.tmpl | 8 +- templates/repo/settings/lfs_pointers.tmpl | 2 +- templates/repo/settings/options.tmpl | 6 +- templates/repo/settings/tags.tmpl | 4 +- templates/repo/settings/webhook/history.tmpl | 4 +- templates/repo/wiki/revision.tmpl | 2 +- templates/repo/wiki/view.tmpl | 2 +- templates/user/auth/change_passwd_inner.tmpl | 2 +- templates/user/auth/grant_error.tmpl | 2 +- templates/user/auth/reset_passwd.tmpl | 6 +- templates/user/auth/signup_inner.tmpl | 6 +- .../user/auth/signup_openid_connect.tmpl | 2 +- .../user/auth/signup_openid_register.tmpl | 8 +- templates/user/dashboard/feeds.tmpl | 38 ++++----- templates/user/dashboard/milestones.tmpl | 2 +- .../user/notification/notification_div.tmpl | 2 +- templates/user/settings/account.tmpl | 4 +- .../user/settings/applications_oauth2.tmpl | 2 +- templates/user/settings/keys_ssh.tmpl | 2 +- templates/user/settings/repos.tmpl | 2 +- templates/user/settings/security/twofa.tmpl | 2 +- 62 files changed, 251 insertions(+), 251 deletions(-) diff --git a/Makefile b/Makefile index 0b2dce53ee..9e0c29f2b5 100644 --- a/Makefile +++ b/Makefile @@ -243,7 +243,7 @@ clean: .PHONY: fmt fmt: @MISSPELL_PACKAGE=$(MISSPELL_PACKAGE) GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}' - $(eval TEMPLATES := $(wildcard templates/**/*.tmpl)) + $(eval TEMPLATES := $(shell find templates -type f -name '*.tmpl')) @# strip whitespace after '{{' and before `}}` unless there is only whitespace before it @$(SED_INPLACE) -e 's/{{[ ]\{1,\}/{{/g' -e '/^[ ]\{1,\}}}/! s/[ ]\{1,\}}}/}}/g' $(TEMPLATES) diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl index 18722f4837..bf9d53152c 100644 --- a/templates/admin/auth/edit.tmpl +++ b/templates/admin/auth/edit.tmpl @@ -23,7 +23,7 @@ {{if or .Source.IsLDAP .Source.IsDLDAP}} - {{ $cfg:=.Source.Cfg }} + {{$cfg:=.Source.Cfg}}