From 647b2649b1600107c5fec3505db691f78b2c1e2a Mon Sep 17 00:00:00 2001
From: silverwind <me@silverwind.io>
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 @@
 
 				<!-- LDAP and DLDAP -->
 				{{if or .Source.IsLDAP .Source.IsDLDAP}}
-					{{ $cfg:=.Source.Cfg }}
+					{{$cfg:=.Source.Cfg}}
 					<div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}">
 						<label>{{.locale.Tr "admin.auths.security_protocol"}}</label>
 						<div class="ui selection security-protocol dropdown">
@@ -180,7 +180,7 @@
 
 				<!-- SMTP -->
 				{{if .Source.IsSMTP}}
-					{{ $cfg:=.Source.Cfg }}
+					{{$cfg:=.Source.Cfg}}
 					<div class="inline required field">
 						<label>{{.locale.Tr "admin.auths.smtp_auth"}}</label>
 						<div class="ui selection type dropdown">
@@ -242,7 +242,7 @@
 
 				<!-- PAM -->
 				{{if .Source.IsPAM}}
-					{{ $cfg:=.Source.Cfg }}
+					{{$cfg:=.Source.Cfg}}
 					<div class="required field">
 						<label for="pam_service_name">{{.locale.Tr "admin.auths.pam_service_name"}}</label>
 						<input id="pam_service_name" name="pam_service_name" value="{{$cfg.ServiceName}}" required>
@@ -262,7 +262,7 @@
 
 				<!-- OAuth2 -->
 				{{if .Source.IsOAuth2}}
-					{{ $cfg:=.Source.Cfg }}
+					{{$cfg:=.Source.Cfg}}
 					<div class="inline required field">
 						<label>{{.locale.Tr "admin.auths.oauth2_provider"}}</label>
 						<div class="ui selection type dropdown">
@@ -337,7 +337,7 @@
 
 					<div class="field">
 						<label for="oauth2_scopes">{{.locale.Tr "admin.auths.oauth2_scopes"}}</label>
-						<input id="oauth2_scopes" name="oauth2_scopes" value="{{if $cfg.Scopes}}{{Join $cfg.Scopes "," }}{{end}}">
+						<input id="oauth2_scopes" name="oauth2_scopes" value="{{if $cfg.Scopes}}{{Join $cfg.Scopes ","}}{{end}}">
 					</div>
 					<div class="field">
 						<label for="oauth2_required_claim_name">{{.locale.Tr "admin.auths.oauth2_required_claim_name"}}</label>
@@ -365,7 +365,7 @@
 
 				<!-- SSPI -->
 				{{if .Source.IsSSPI}}
-					{{ $cfg:=.Source.Cfg }}
+					{{$cfg:=.Source.Cfg}}
 					<div class="field">
 						<div class="ui checkbox">
 							<label for="sspi_auto_create_users"><strong>{{.locale.Tr "admin.auths.sspi_auto_create_users"}}</strong></label>
diff --git a/templates/admin/auth/new.tmpl b/templates/admin/auth/new.tmpl
index 6bfda9fcd3..213c621b42 100644
--- a/templates/admin/auth/new.tmpl
+++ b/templates/admin/auth/new.tmpl
@@ -30,10 +30,10 @@
 				</div>
 
 				<!-- LDAP and DLDAP -->
-				{{ template "admin/auth/source/ldap" . }}
+				{{template "admin/auth/source/ldap" .}}
 
 				<!-- SMTP -->
-				{{ template "admin/auth/source/smtp" . }}
+				{{template "admin/auth/source/smtp" .}}
 
 				<!-- PAM -->
 				<div class="pam required field {{if not (eq .type 4)}}hide{{end}}">
@@ -51,10 +51,10 @@
 				</div>
 
 				<!-- OAuth2 -->
-				{{ template "admin/auth/source/oauth" . }}
+				{{template "admin/auth/source/oauth" .}}
 
 				<!-- SSPI -->
-				{{ template "admin/auth/source/sspi" . }}
+				{{template "admin/auth/source/sspi" .}}
 
 				<div class="ldap field">
 					<div class="ui checkbox">
diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl
index dd2646b50a..7aeaa2537c 100644
--- a/templates/admin/user/edit.tmpl
+++ b/templates/admin/user/edit.tmpl
@@ -12,7 +12,7 @@
 				{{.CsrfTokenHtml}}
 				<div class="field {{if .Err_UserName}}error{{end}}">
 					<label for="user_name">{{.locale.Tr "username"}}</label>
-					<input id="user_name" name="user_name" value="{{.User.Name}}" autofocus {{if not .User.IsLocal }}disabled{{end}}>
+					<input id="user_name" name="user_name" value="{{.User.Name}}" autofocus {{if not .User.IsLocal}}disabled{{end}}>
 				</div>
 				<!-- Types and name -->
 				<div class="inline required field {{if .Err_LoginType}}error{{end}}">
diff --git a/templates/admin/user/new.tmpl b/templates/admin/user/new.tmpl
index b8fd8c0ad1..9fdf0dce93 100644
--- a/templates/admin/user/new.tmpl
+++ b/templates/admin/user/new.tmpl
@@ -69,7 +69,7 @@
 
 				<div class="inline field local{{if ne .login_type "0-0"}} hide{{end}}">
 					<div class="ui checkbox">
-						<label><strong>{{.locale.Tr "auth.allow_password_change" }}</strong></label>
+						<label><strong>{{.locale.Tr "auth.allow_password_change"}}</strong></label>
 						<input name="must_change_password" type="checkbox" checked>
 					</div>
 				</div>
diff --git a/templates/mail/auth/activate.tmpl b/templates/mail/auth/activate.tmpl
index fcb54c0a78..75a0b8564a 100644
--- a/templates/mail/auth/activate.tmpl
+++ b/templates/mail/auth/activate.tmpl
@@ -6,7 +6,7 @@
 	<title>{{.locale.Tr "mail.activate_account.title" (.DisplayName|DotEscape)}}</title>
 </head>
 
-{{ $activate_url := printf "%suser/activate?code=%s" AppUrl (QueryEscape .Code)}}
+{{$activate_url := printf "%suser/activate?code=%s" AppUrl (QueryEscape .Code)}}
 <body>
 	<p>{{.locale.Tr "mail.activate_account.text_1" (.DisplayName|DotEscape) AppName | Str2html}}</p><br>
 	<p>{{.locale.Tr "mail.activate_account.text_2" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>
diff --git a/templates/mail/auth/activate_email.tmpl b/templates/mail/auth/activate_email.tmpl
index e65ebd6b98..0a24dc19c8 100644
--- a/templates/mail/auth/activate_email.tmpl
+++ b/templates/mail/auth/activate_email.tmpl
@@ -6,7 +6,7 @@
 	<title>{{.locale.Tr "mail.activate_email.title" (.DisplayName|DotEscape)}}</title>
 </head>
 
-{{ $activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl (QueryEscape .Code) (QueryEscape .Email)}}
+{{$activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl (QueryEscape .Code) (QueryEscape .Email)}}
 <body>
 	<p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}</p><br>
 	<p>{{.locale.Tr "mail.activate_email.text" .ActiveCodeLives | Str2html}}</p><p><a href="{{$activate_url}}">{{$activate_url}}</a></p><br>
diff --git a/templates/mail/auth/reset_passwd.tmpl b/templates/mail/auth/reset_passwd.tmpl
index a013ebd7a6..6a3625ab78 100644
--- a/templates/mail/auth/reset_passwd.tmpl
+++ b/templates/mail/auth/reset_passwd.tmpl
@@ -6,7 +6,7 @@
 	<title>{{.locale.Tr "mail.reset_password.title" (.DisplayName|DotEscape)}}</title>
 </head>
 
-{{ $recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}}
+{{$recover_url := printf "%suser/recover_account?code=%s" AppUrl (QueryEscape .Code)}}
 <body>
 	<p>{{.locale.Tr "mail.hi_user_x" (.DisplayName|DotEscape) | Str2html}}</p><br>
 	<p>{{.locale.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}</p><p><a href="{{$recover_url}}">{{$recover_url}}</a></p><br>
diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl
index b558dbe5ee..fceb080134 100644
--- a/templates/org/member/members.tmpl
+++ b/templates/org/member/members.tmpl
@@ -5,7 +5,7 @@
 		{{template "base/alert" .}}
 
 		<div class="list">
-			{{ range .Members}}
+			{{range .Members}}
 				<div class="item ui grid">
 					<div class="ui four wide column" style="display: flex;">
 						{{avatar . 48}}
@@ -19,7 +19,7 @@
 							{{$.locale.Tr "org.members.membership_visibility"}}
 						</div>
 						<div class="meta">
-							{{ $isPublic := index $.MembersIsPublicMember .ID}}
+							{{$isPublic := index $.MembersIsPublicMember .ID}}
 							{{if $isPublic}}
 								<strong>{{$.locale.Tr "org.members.public"}}</strong>
 								{{if or (eq $.SignedUser.ID .ID) $.IsOrganizationOwner}}(<a class="link-action" href data-url="{{$.OrgLink}}/members/action/private?uid={{.ID}}">{{$.locale.Tr "org.members.public_helper"}}</a>){{end}}
diff --git a/templates/package/shared/list.tmpl b/templates/package/shared/list.tmpl
index b48f772f39..37c47cef33 100644
--- a/templates/package/shared/list.tmpl
+++ b/templates/package/shared/list.tmpl
@@ -50,7 +50,7 @@
 					{{svg "octicon-package" 32}}
 					<h2>{{.locale.Tr "packages.empty"}}</h2>
 					{{if and .Repository .CanWritePackages}}
-						{{$packagesUrl := URLJoin .Owner.HTMLURL "-" "packages" }}
+						{{$packagesUrl := URLJoin .Owner.HTMLURL "-" "packages"}}
 						<p>{{.locale.Tr "packages.empty.repo" $packagesUrl | Safe}}</p>
 					{{end}}
 					<p>{{.locale.Tr "packages.empty.documentation" | Safe}}</p>
diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl
index c821d12d90..402435c467 100644
--- a/templates/repo/diff/blob_excerpt.tmpl
+++ b/templates/repo/diff/blob_excerpt.tmpl
@@ -3,12 +3,12 @@
 	<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
 		{{if eq .GetType 4}}
 			<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}">
-				{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+				{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
 					<a role="button" class="blob-excerpt" data-url="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=down&wiki={{$.PageIsWiki}}" data-anchor="{{$.Anchor}}">
 						{{svg "octicon-fold-down"}}
 					</a>
 				{{end}}
-				{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+				{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}}
 					<a role="button" class="blob-excerpt" data-url="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=up&wiki={{$.PageIsWiki}}" data-anchor="{{$.Anchor}}">
 						{{svg "octicon-fold-up"}}
 					</a>
@@ -47,12 +47,12 @@
 	<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
 		{{if eq .GetType 4}}
 			<td colspan="2" class="lines-num">
-				{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+				{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
 					<a role="button" class="blob-excerpt" data-url="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.PageIsWiki}}" data-anchor="{{$.Anchor}}">
 						{{svg "octicon-fold-down"}}
 					</a>
 				{{end}}
-				{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+				{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}}
 					<a role="button" class="blob-excerpt" data-url="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.PageIsWiki}}" data-anchor="{{$.Anchor}}">
 						{{svg "octicon-fold-up"}}
 					</a>
diff --git a/templates/repo/diff/comment_form_datahandler.tmpl b/templates/repo/diff/comment_form_datahandler.tmpl
index 9656944719..d0e493488d 100644
--- a/templates/repo/diff/comment_form_datahandler.tmpl
+++ b/templates/repo/diff/comment_form_datahandler.tmpl
@@ -1,7 +1,7 @@
 {{if $.comment}}
-	{{ template "repo/diff/comment_form" dict "root" $.root "hidden" $.hidden "reply" $.reply "Line" $.comment.UnsignedLine "File" $.comment.TreePath "Side" $.comment.DiffSide "HasComments" true}}
+	{{template "repo/diff/comment_form" dict "root" $.root "hidden" $.hidden "reply" $.reply "Line" $.comment.UnsignedLine "File" $.comment.TreePath "Side" $.comment.DiffSide "HasComments" true}}
 {{else if $.root}}
-	{{ template "repo/diff/comment_form" $}}
+	{{template "repo/diff/comment_form" $}}
 {{else}}
-	{{ template "repo/diff/comment_form" dict "root" $}}
+	{{template "repo/diff/comment_form" dict "root" $}}
 {{end}}
diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl
index 9905f09baa..0cc7853378 100644
--- a/templates/repo/diff/comments.tmpl
+++ b/templates/repo/diff/comments.tmpl
@@ -1,8 +1,8 @@
 {{range .comments}}
 
-{{ $createdStr:= TimeSinceUnix .CreatedUnix $.root.locale }}
+{{$createdStr:= TimeSinceUnix .CreatedUnix $.root.locale}}
 <div class="comment" id="{{.HashTag}}">
-	{{if .OriginalAuthor }}
+	{{if .OriginalAuthor}}
 		<span class="avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
 	{{else}}
 		<a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>
@@ -12,17 +12,17 @@
 	<div class="content comment-container">
 		<div class="ui top attached header comment-header df ac sb">
 			<div class="comment-header-left df ac">
-				{{if .OriginalAuthor }}
+				{{if .OriginalAuthor}}
 					<span class="text black mr-2">
 						{{svg (MigrationIcon $.root.Repository.GetOriginalURLHostname)}}
-						{{ .OriginalAuthor }}
+						{{.OriginalAuthor}}
 					</span>
 					<span class="text grey">
 						{{$.root.locale.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdStr | Safe}}
 					</span>
 					<span class="text migrate">
 						{{if $.root.Repository.OriginalURL}}
-							({{$.root.locale.Tr "repo.migrated_from" ($.root.Repository.OriginalURL | Escape) ($.root.Repository.GetOriginalURLHostname | Escape) | Safe }})
+							({{$.root.locale.Tr "repo.migrated_from" ($.root.Repository.OriginalURL | Escape) ($.root.Repository.GetOriginalURLHostname | Escape) | Safe}})
 						{{end}}
 					</span>
 				{{else}}
@@ -46,7 +46,7 @@
 						</div>
 					{{end}}
 				{{end}}
-				{{template "repo/issue/view_content/add_reaction" Dict "ctx" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) }}
+				{{template "repo/issue/view_content/add_reaction" Dict "ctx" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}}
 				{{template "repo/issue/view_content/context_menu" Dict "ctx" $.root "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}}
 			</div>
 		</div>
diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl
index 426ea737bd..5875efaac3 100644
--- a/templates/repo/diff/compare.tmpl
+++ b/templates/repo/diff/compare.tmpl
@@ -7,11 +7,11 @@
 		{{if and $.PageIsComparePull $.IsSigned (not .Repository.IsArchived)}}
 			{{.locale.Tr "repo.pulls.compare_changes"}}
 			<div class="sub header">{{.locale.Tr "repo.pulls.compare_changes_desc"}}</div>
-		{{ else }}
+		{{else}}
 			{{.locale.Tr "action.compare_commits_general"}}
-		{{ end }}
+		{{end}}
 	</h2>
-	{{ $BaseCompareName := $.BaseName -}}
+	{{$BaseCompareName := $.BaseName -}}
 	{{- $HeadCompareName := $.HeadRepo.OwnerName -}}
 	{{- if and (eq $.BaseName $.HeadRepo.OwnerName) (ne $.Repository.Name $.HeadRepo.Name) -}}
 		{{- $HeadCompareName = printf "%s/%s" $.HeadRepo.OwnerName $.HeadRepo.Name -}}
@@ -174,7 +174,7 @@
 	</div>
 
 	{{if .IsNothingToCompare}}
-		{{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived) }}
+		{{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}}
 			<div class="ui segment">{{.locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}</div>
 			<div class="ui info message show-form-container" {{if .Flash}}style="display: none"{{end}}>
 				<button class="ui button green show-form">{{.locale.Tr "repo.pulls.new"}}</button>
diff --git a/templates/repo/diff/image_diff.tmpl b/templates/repo/diff/image_diff.tmpl
index 71a6da5c5e..4b95c8d85f 100644
--- a/templates/repo/diff/image_diff.tmpl
+++ b/templates/repo/diff/image_diff.tmpl
@@ -4,17 +4,17 @@
 		<div class="image-diff" data-path-before="{{.root.BeforeRawPath}}/{{PathEscapeSegments .file.OldName}}" data-path-after="{{.root.RawPath}}/{{PathEscapeSegments .file.Name}}">
 			<div class="ui secondary pointing tabular top attached borderless menu stackable new-menu">
 				<div class="new-menu-inner">
-					<a class="item active" data-tab="diff-side-by-side-{{ .file.Index }}">{{.root.locale.Tr "repo.diff.image.side_by_side"}}</a>
+					<a class="item active" data-tab="diff-side-by-side-{{.file.Index}}">{{.root.locale.Tr "repo.diff.image.side_by_side"}}</a>
 					{{if and .blobBase .blobHead}}
-					<a class="item" data-tab="diff-swipe-{{ .file.Index }}">{{.root.locale.Tr "repo.diff.image.swipe"}}</a>
-					<a class="item" data-tab="diff-overlay-{{ .file.Index }}">{{.root.locale.Tr "repo.diff.image.overlay"}}</a>
+					<a class="item" data-tab="diff-swipe-{{.file.Index}}">{{.root.locale.Tr "repo.diff.image.swipe"}}</a>
+					<a class="item" data-tab="diff-overlay-{{.file.Index}}">{{.root.locale.Tr "repo.diff.image.overlay"}}</a>
 					{{end}}
 				</div>
 			</div>
 			<div class="hide">
-				<div class="ui bottom attached tab image-diff-container active" data-tab="diff-side-by-side-{{ .file.Index }}">
+				<div class="ui bottom attached tab image-diff-container active" data-tab="diff-side-by-side-{{.file.Index}}">
 					<div class="diff-side-by-side">
-						{{if .blobBase }}
+						{{if .blobBase}}
 						<span class="side">
 							<p class="side-header">{{.root.locale.Tr "repo.diff.file_before"}}</p>
 							<span class="before-container"><img class="image-before" /></span>
@@ -29,7 +29,7 @@
 							</p>
 						</span>
 						{{end}}
-						{{if .blobHead }}
+						{{if .blobHead}}
 						<span class="side">
 							<p class="side-header">{{.root.locale.Tr "repo.diff.file_after"}}</p>
 							<span class="after-container"><img class="image-after" /></span>
@@ -47,7 +47,7 @@
 					</div>
 				</div>
 				{{if and .blobBase .blobHead}}
-				<div class="ui bottom attached tab image-diff-container" data-tab="diff-swipe-{{ .file.Index }}">
+				<div class="ui bottom attached tab image-diff-container" data-tab="diff-swipe-{{.file.Index}}">
 					<div class="diff-swipe">
 						<div class="swipe-frame">
 							<span class="before-container"><img class="image-before" /></span>
@@ -61,7 +61,7 @@
 						</div>
 					</div>
 				</div>
-				<div class="ui bottom attached tab image-diff-container" data-tab="diff-overlay-{{ .file.Index }}">
+				<div class="ui bottom attached tab image-diff-container" data-tab="diff-overlay-{{.file.Index}}">
 					<div class="diff-overlay">
 						<div class="overlay-frame">
 							<div class="ui centered">
diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl
index 857577b152..60ebb61fb9 100644
--- a/templates/repo/diff/new_review.tmpl
+++ b/templates/repo/diff/new_review.tmpl
@@ -22,9 +22,9 @@
 					</div>
 				{{end}}
 				<div class="ui divider"></div>
-				<button type="submit" name="type" value="approve" {{ if and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID) }} disabled {{ end }} class="ui submit green tiny button btn-submit">{{$.locale.Tr "repo.diff.review.approve"}}</button>
+				<button type="submit" name="type" value="approve" {{if and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID)}} disabled {{end}} class="ui submit green tiny button btn-submit">{{$.locale.Tr "repo.diff.review.approve"}}</button>
 				<button type="submit" name="type" value="comment" class="ui submit tiny basic button btn-submit">{{$.locale.Tr "repo.diff.review.comment"}}</button>
-				<button type="submit" name="type" value="reject" {{ if and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID) }} disabled {{ end }} class="ui submit red tiny button btn-submit">{{$.locale.Tr "repo.diff.review.reject"}}</button>
+				<button type="submit" name="type" value="reject" {{if and $.IsSigned ($.Issue.IsPoster $.SignedUser.ID)}} disabled {{end}} class="ui submit red tiny button btn-submit">{{$.locale.Tr "repo.diff.review.reject"}}</button>
 			</form>
 		</div>
 	</div>
diff --git a/templates/repo/diff/section_split.tmpl b/templates/repo/diff/section_split.tmpl
index 5ea71ae595..6143a47158 100644
--- a/templates/repo/diff/section_split.tmpl
+++ b/templates/repo/diff/section_split.tmpl
@@ -6,12 +6,12 @@
 			<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{DiffLineTypeToStr .GetType}}">
 				{{if eq .GetType 4}}
 					<td class="lines-num lines-num-old">
-						{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+						{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
 							<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=down&wiki={{$.root.PageIsWiki}}" data-anchor="diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}">
 								{{svg "octicon-fold-down"}}
 							</a>
 						{{end}}
-						{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+						{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}}
 							<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=split&direction=up&wiki={{$.root.PageIsWiki}}" data-anchor="diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}">
 								{{svg "octicon-fold-up"}}
 							</a>
diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl
index aaf53b97c5..373747002c 100644
--- a/templates/repo/diff/section_unified.tmpl
+++ b/templates/repo/diff/section_unified.tmpl
@@ -5,12 +5,12 @@
 			<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}" data-line-type="{{DiffLineTypeToStr .GetType}}">
 				{{if eq .GetType 4}}
 					<td colspan="2" class="lines-num">
-						{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+						{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
 							<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.root.PageIsWiki}}" data-anchor="diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}">
 								{{svg "octicon-fold-down"}}
 							</a>
 						{{end}}
-						{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+						{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}}
 							<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.root.PageIsWiki}}" data-anchor="diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}">
 								{{svg "octicon-fold-up"}}
 							</a>
diff --git a/templates/repo/diff/whitespace_dropdown.tmpl b/templates/repo/diff/whitespace_dropdown.tmpl
index d28cb12bf8..9df79dab73 100644
--- a/templates/repo/diff/whitespace_dropdown.tmpl
+++ b/templates/repo/diff/whitespace_dropdown.tmpl
@@ -3,19 +3,19 @@
 	{{svg "octicon-triangle-down" 14 "dropdown icon"}}
 	<div class="menu">
 		<a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=show-all">
-			<i class="circle {{ if eq .WhitespaceBehavior "show-all" }}dot{{else}}outline{{end}} icon"></i>
+			<i class="circle {{if eq .WhitespaceBehavior "show-all"}}dot{{else}}outline{{end}} icon"></i>
 			{{.locale.Tr "repo.diff.whitespace_show_everything"}}
 		</a>
 		<a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-all">
-			<i class="circle {{ if eq .WhitespaceBehavior "ignore-all" }}dot{{else}}outline{{end}} icon"></i>
+			<i class="circle {{if eq .WhitespaceBehavior "ignore-all"}}dot{{else}}outline{{end}} icon"></i>
 			{{.locale.Tr "repo.diff.whitespace_ignore_all_whitespace"}}
 		</a>
 		<a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-change">
-			<i class="circle {{ if eq .WhitespaceBehavior "ignore-change" }}dot{{else}}outline{{end}} icon"></i>
+			<i class="circle {{if eq .WhitespaceBehavior "ignore-change"}}dot{{else}}outline{{end}} icon"></i>
 			{{.locale.Tr "repo.diff.whitespace_ignore_amount_changes"}}
 		</a>
 		<a class="item" href="?style={{if .IsSplitStyle}}split{{else}}unified{{end}}&whitespace=ignore-eol">
-			<i class="circle {{ if eq .WhitespaceBehavior "ignore-eol" }}dot{{else}}outline{{end}} icon"></i>
+			<i class="circle {{if eq .WhitespaceBehavior "ignore-eol"}}dot{{else}}outline{{end}} icon"></i>
 			{{.locale.Tr "repo.diff.whitespace_ignore_at_eol"}}
 		</a>
 	</div>
diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl
index 77a6bf15e1..ebe56ec477 100644
--- a/templates/repo/editor/edit.tmpl
+++ b/templates/repo/editor/edit.tmpl
@@ -11,8 +11,8 @@
 				<div class="fitted item treepath">
 					<div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}">
 						<a class="section" href="{{$.BranchLink}}">{{.Repository.Name}}</a>
-						{{ $n := len .TreeNames}}
-						{{ $l := Subtract $n 1}}
+						{{$n := len .TreeNames}}
+						{{$l := Subtract $n 1}}
 						{{range $i, $v := .TreeNames}}
 							<div class="divider"> / </div>
 							{{if eq $i $l}}
diff --git a/templates/repo/editor/upload.tmpl b/templates/repo/editor/upload.tmpl
index d388f1ef65..f8496d5911 100644
--- a/templates/repo/editor/upload.tmpl
+++ b/templates/repo/editor/upload.tmpl
@@ -9,8 +9,8 @@
 				<div class="item fitted treepath">
 					<div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}">
 						<a class="section" href="{{$.BranchLink}}">{{.Repository.Name}}</a>
-						{{ $n := len .TreeNames}}
-						{{ $l := Subtract $n 1}}
+						{{$n := len .TreeNames}}
+						{{$l := Subtract $n 1}}
 						{{range $i, $v := .TreeNames}}
 							<div class="divider"> / </div>
 							{{if eq $i $l}}
diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl
index 478121f27c..357c99b2b8 100644
--- a/templates/repo/graph/commits.tmpl
+++ b/templates/repo/graph/commits.tmpl
@@ -1,10 +1,10 @@
 <div id="rev-container">
 	<ul id="rev-list">
-		{{ range $commitI, $commit := .Graph.Commits }}
+		{{range $commitI, $commit := .Graph.Commits}}
 			<li {{if $commit.Rev}}id="commit-{{$commit.Rev}}"{{end}} data-flow="{{$commit.Flow}}">
-				{{ if $commit.OnlyRelation }}
+				{{if $commit.OnlyRelation}}
 					<span></span>
-				{{ else }}
+				{{else}}
 					<span class="sha" id="{{$commit.ShortRev}}">
 						{{$class := "ui sha label"}}
 						{{if $commit.Commit.Signature}}
@@ -72,8 +72,8 @@
 						{{end}}
 					</span>
 					<span class="time df ac">{{$commit.Date}}</span>
-				{{ end }}
+				{{end}}
 			</li>
-		{{ end }}
+		{{end}}
 	</ul>
 </div>
diff --git a/templates/repo/issue/labels.tmpl b/templates/repo/issue/labels.tmpl
index 9467f3253b..88cfd124a7 100644
--- a/templates/repo/issue/labels.tmpl
+++ b/templates/repo/issue/labels.tmpl
@@ -19,7 +19,7 @@
 	</div>
 </div>
 
-{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived) }}
+{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}
 {{template "repo/issue/labels/edit_delete_label" .}}
 {{end}}
 </div>
diff --git a/templates/repo/issue/labels/label_list.tmpl b/templates/repo/issue/labels/label_list.tmpl
index 660cf9f861..a56d5abf53 100644
--- a/templates/repo/issue/labels/label_list.tmpl
+++ b/templates/repo/issue/labels/label_list.tmpl
@@ -21,7 +21,7 @@
 
 <div class="ui attached segment">
 	<div class="labelspage">
-		{{if and (not $.PageIsOrgSettingsLabels) (or $.CanWriteIssues $.CanWritePulls) (eq .NumLabels 0) (not $.Repository.IsArchived) }}
+		{{if and (not $.PageIsOrgSettingsLabels) (or $.CanWriteIssues $.CanWritePulls) (eq .NumLabels 0) (not $.Repository.IsArchived)}}
 			{{template "repo/issue/labels/label_load_template" .}}
 			<div class="ui divider"></div>
 		{{else if and ($.PageIsOrgSettingsLabels) (eq .NumLabels 0)}}
@@ -57,7 +57,7 @@
 			</div>
 			</li>
 		{{end}}
-		{{if and (not .PageIsOrgSettingsLabels) (.OrgLabels) }}
+		{{if and (not .PageIsOrgSettingsLabels) (.OrgLabels)}}
 			<li class="item">
 				<div class="ui grid middle aligned">
 					<div class="ten wide column">
diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl
index 0f00e9284a..e17cb2ae6c 100644
--- a/templates/repo/issue/milestone_issues.tmpl
+++ b/templates/repo/issue/milestone_issues.tmpl
@@ -22,7 +22,7 @@
 		</div>
 		<div class="ui one column stackable grid">
 			<div class="column">
-				{{ $closedDate:= TimeSinceUnix .Milestone.ClosedDateUnix $.locale }}
+				{{$closedDate:= TimeSinceUnix .Milestone.ClosedDateUnix $.locale}}
 				{{if .IsClosed}}
 					{{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate|Str2html}}
 				{{else}}
diff --git a/templates/repo/issue/milestones.tmpl b/templates/repo/issue/milestones.tmpl
index 0b6fdd37f2..641dc6c918 100644
--- a/templates/repo/issue/milestones.tmpl
+++ b/templates/repo/issue/milestones.tmpl
@@ -71,7 +71,7 @@
 						</div>
 					</div>
 					<div class="meta">
-						{{ $closedDate:= TimeSinceUnix .ClosedDateUnix $.locale }}
+						{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}}
 						{{if .IsClosed}}
 							{{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate|Str2html}}
 						{{else}}
diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl
index 1f03014b54..91a523a1e2 100644
--- a/templates/repo/issue/new_form.tmpl
+++ b/templates/repo/issue/new_form.tmpl
@@ -57,13 +57,13 @@
 					{{if or .Labels .OrgLabels}}
 						{{range .Labels}}
 							<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check"}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}}
-							{{if .Description }}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a>
+							{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a>
 						{{end}}
 
 						<div class="ui divider"></div>
 						{{range .OrgLabels}}
 							<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check"}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}}
-							{{if .Description }}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a>
+							{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a>
 						{{end}}
 					{{else}}
 						<div class="header" style="text-transform: none;font-size:14px;">{{.locale.Tr "repo.issues.new.no_items"}}</div>
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl
index 3d4d1450ae..de11846af7 100644
--- a/templates/repo/issue/view_content.tmpl
+++ b/templates/repo/issue/view_content.tmpl
@@ -15,11 +15,11 @@
 	<input type="hidden" id="issueIndex" value="{{.Issue.Index}}"/>
 	<input type="hidden" id="type" value="{{.IssueType}}">
 
-	{{ $createdStr:= TimeSinceUnix .Issue.CreatedUnix $.locale }}
+	{{$createdStr:= TimeSinceUnix .Issue.CreatedUnix $.locale}}
 	<div class="twelve wide column comment-list prevent-before-timeline">
 		<ui class="ui timeline">
 			<div id="{{.Issue.HashTag}}" class="timeline-item comment first">
-			{{if .Issue.OriginalAuthor }}
+			{{if .Issue.OriginalAuthor}}
 				<span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
 			{{else}}
 				<a class="timeline-avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
@@ -29,16 +29,16 @@
 				<div class="content comment-container">
 					<div class="ui top attached header comment-header df ac sb">
 						<div class="comment-header-left df ac">
-							{{if .Issue.OriginalAuthor }}
+							{{if .Issue.OriginalAuthor}}
 								<span class="text black">
 									{{svg (MigrationIcon .Repository.GetOriginalURLHostname)}}
-									{{ .Issue.OriginalAuthor }}
+									{{.Issue.OriginalAuthor}}
 								</span>
 								<span class="text grey">
-									{{ .locale.Tr "repo.issues.commented_at" (.Issue.HashTag|Escape) $createdStr | Safe }}
+									{{.locale.Tr "repo.issues.commented_at" (.Issue.HashTag|Escape) $createdStr | Safe}}
 								</span>
 								<span class="text migrate">
-									{{if .Repository.OriginalURL}} ({{$.locale.Tr "repo.migrated_from" (.Repository.OriginalURL|Escape) (.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}
+									{{if .Repository.OriginalURL}} ({{$.locale.Tr "repo.migrated_from" (.Repository.OriginalURL|Escape) (.Repository.GetOriginalURLHostname|Escape) | Safe}}){{end}}
 								</span>
 							{{else}}
 								<a class="inline-timeline-avatar" href="{{.Issue.Poster.HomeLink}}">
@@ -92,13 +92,13 @@
 				</div>
 			</div>
 
-			{{ template "repo/issue/view_content/comments" . }}
+			{{template "repo/issue/view_content/comments" .}}
 
 			{{if and .Issue.IsPull (not $.Repository.IsArchived)}}
-				{{ template "repo/issue/view_content/pull". }}
+				{{template "repo/issue/view_content/pull".}}
 			{{end}}
 			{{if .IsSigned}}
-				{{ if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not .Issue.IsLocked)) (not .Repository.IsArchived) }}
+				{{if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not .Issue.IsLocked)) (not .Repository.IsArchived)}}
 				<div class="timeline-item comment form">
 					<a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
 						{{avatar .SignedUser}}
@@ -129,7 +129,7 @@
 						</form>
 					</div>
 				</div>
-				{{ else if .Repository.IsArchived }}
+				{{else if .Repository.IsArchived}}
 					<div class="ui warning message">
 						{{if .Issue.IsPull}}
 							{{.locale.Tr "repo.archive.pull.nocomment"}}
@@ -137,7 +137,7 @@
 							{{.locale.Tr "repo.archive.issue.nocomment"}}
 						{{end}}
 					</div>
-				{{ end }}
+				{{end}}
 			{{else}}
 			{{if .Repository.IsArchived}}
 				<div class="ui warning message">
@@ -191,7 +191,7 @@
 		</ui>
 	</div>
 
-	{{ template "repo/issue/view_content/sidebar" . }}
+	{{template "repo/issue/view_content/sidebar" .}}
 </div>
 
 <div class="hide" id="edit-content-form">
@@ -231,7 +231,7 @@
 <div class="ui small basic delete modal">
 	<div class="ui icon header">
 		{{svg "octicon-trash"}}
-		{{.locale.Tr "repo.branch.delete" .HeadTarget }}
+		{{.locale.Tr "repo.branch.delete" .HeadTarget}}
 	</div>
 	<div class="content">
 		<p>{{.locale.Tr "repo.branch.delete_desc" | Str2html}}</p>
diff --git a/templates/repo/issue/view_content/add_reaction.tmpl b/templates/repo/issue/view_content/add_reaction.tmpl
index 1d0ddb62a9..9bd9022d28 100644
--- a/templates/repo/issue/view_content/add_reaction.tmpl
+++ b/templates/repo/issue/view_content/add_reaction.tmpl
@@ -1,10 +1,10 @@
 {{if .ctx.IsSigned}}
-<div class="item action ui pointing select-reaction dropdown top right" data-action-url="{{ .ActionURL }}">
+<div class="item action ui pointing select-reaction dropdown top right" data-action-url="{{.ActionURL}}">
 	<a class="add-reaction">
 		{{svg "octicon-smiley"}}
 	</a>
 	<div class="menu">
-		<div class="header">{{ .ctx.locale.Tr "repo.pick_reaction"}}</div>
+		<div class="header">{{.ctx.locale.Tr "repo.pick_reaction"}}</div>
 		<div class="divider"></div>
 		{{range $value := AllowedReactions}}
 			<div class="item reaction tooltip" data-content="{{$value}}">{{ReactionToEmoji $value}}</div>
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index e284d5aef5..e33981a012 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -1,7 +1,7 @@
-{{ template "base/alert" }}
+{{template "base/alert"}}
 {{range .Issue.Comments}}
 	{{if call $.ShouldShowCommentType .Type}}
-		{{ $createdStr:= TimeSinceUnix .CreatedUnix $.locale }}
+		{{$createdStr:= TimeSinceUnix .CreatedUnix $.locale}}
 
 		<!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF,
 		5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING,
@@ -14,7 +14,7 @@
 		35 = CANCEL_SCHEDULED_AUTO_MERGE_PR -->
 		{{if eq .Type 0}}
 			<div class="timeline-item comment" id="{{.HashTag}}">
-			{{if .OriginalAuthor }}
+			{{if .OriginalAuthor}}
 				<span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
 			{{else}}
 				<a class="timeline-avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>
@@ -24,16 +24,16 @@
 				<div class="content comment-container">
 					<div class="ui top attached header comment-header df ac sb">
 						<div class="comment-header-left df ac">
-							{{if .OriginalAuthor }}
+							{{if .OriginalAuthor}}
 								<span class="text black mr-2">
 									{{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
-									{{ .OriginalAuthor }}
+									{{.OriginalAuthor}}
 								</span>
 								<span class="text grey">
 									{{$.locale.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdStr | Safe}} {{if $.Repository.OriginalURL}}
 								</span>
 								<span class="text migrate">
-									({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}
+									({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe}}){{end}}
 								</span>
 							{{else}}
 								{{if gt .Poster.ID 0}}
@@ -101,7 +101,7 @@
 				</a>
 				<span class="text grey">
 					<a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
-					{{if .Issue.IsPull }}
+					{{if .Issue.IsPull}}
 						{{$.locale.Tr "repo.pulls.reopened_at" .EventTag $createdStr | Safe}}
 					{{else}}
 						{{$.locale.Tr "repo.issues.reopened_at" .EventTag $createdStr | Safe}}
@@ -116,7 +116,7 @@
 				</a>
 				<span class="text grey">
 					<a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
-					{{if .Issue.IsPull }}
+					{{if .Issue.IsPull}}
 						{{$.locale.Tr "repo.pulls.closed_at" .EventTag $createdStr | Safe}}
 					{{else}}
 						{{$.locale.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}}
@@ -140,19 +140,19 @@
 				</span>
 			</div>
 		{{else if eq .Type 3 5 6}}
-			{{ $refFrom:= "" }}
+			{{$refFrom:= ""}}
 			{{if ne .RefRepoID .Issue.RepoID}}
-				{{ $refFrom = $.locale.Tr "repo.issues.ref_from" (.RefRepo.FullName|Escape) }}
+				{{$refFrom = $.locale.Tr "repo.issues.ref_from" (.RefRepo.FullName|Escape)}}
 			{{end}}
-			{{ $refTr := "repo.issues.ref_issue_from" }}
+			{{$refTr := "repo.issues.ref_issue_from"}}
 			{{if .Issue.IsPull}}
-				{{ $refTr = "repo.issues.ref_pull_from" }}
-			{{else if eq .RefAction 1 }}
-				{{ $refTr = "repo.issues.ref_closing_from" }}
-			{{else if eq .RefAction 2 }}
-				{{ $refTr = "repo.issues.ref_reopening_from" }}
+				{{$refTr = "repo.issues.ref_pull_from"}}
+			{{else if eq .RefAction 1}}
+				{{$refTr = "repo.issues.ref_closing_from"}}
+			{{else if eq .RefAction 2}}
+				{{$refTr = "repo.issues.ref_reopening_from"}}
 			{{end}}
-			{{ $createdStr:= TimeSinceUnix .CreatedUnix $.locale }}
+			{{$createdStr:= TimeSinceUnix .CreatedUnix $.locale}}
 			<div class="timeline-item event" id="{{.HashTag}}">
 				<span class="badge">{{svg "octicon-bookmark"}}</span>
 				<a href="{{.Poster.HomeLink}}">
@@ -224,11 +224,11 @@
 						</a>
 						<span class="text grey">
 							<a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a>
-							{{ if eq .Poster.ID .Assignee.ID }}
+							{{if eq .Poster.ID .Assignee.ID}}
 								{{$.locale.Tr "repo.issues.remove_self_assignment" $createdStr | Safe}}
-							{{ else }}
+							{{else}}
 								{{$.locale.Tr "repo.issues.remove_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
-							{{ end }}
+							{{end}}
 						</span>
 					{{else}}
 						<a href="{{.Assignee.HomeLink}}">
@@ -288,7 +288,7 @@
 					<a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
 					{{$.locale.Tr "repo.issues.stop_tracking_history"  $createdStr | Safe}}
 				</span>
-				{{ template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" . }}
+				{{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}}
 				<div class="detail">
 					{{svg "octicon-clock"}}
 					<span class="text grey">{{.Content}}</span>
@@ -304,7 +304,7 @@
 					<a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
 					{{$.locale.Tr "repo.issues.add_time_history"  $createdStr | Safe}}
 				</span>
-				{{ template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" . }}
+				{{template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" .}}
 				<div class="detail">
 					{{svg "octicon-clock"}}
 					<span class="text grey">{{.Content}}</span>
@@ -408,7 +408,7 @@
 		{{else if eq .Type 22}}
 			<div class="timeline-item-group">
 				<div class="timeline-item event">
-					{{if .OriginalAuthor }}
+					{{if .OriginalAuthor}}
 					{{else}}
 					<a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
 						{{avatar .Poster}}
@@ -416,13 +416,13 @@
 					{{end}}
 					<span class="badge{{if eq .Review.Type 1}} bg-green text-white{{else if eq .Review.Type 3}} bg-red text-white{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span>
 					<span class="text grey">
-						{{if .OriginalAuthor }}
+						{{if .OriginalAuthor}}
 							<span class="text black">
 								{{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
-								{{ .OriginalAuthor }}
+								{{.OriginalAuthor}}
 							</span>
 							<span class="text grey"> {{if $.Repository.OriginalURL}}</span>
-							<span class="text migrate">({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span>
+							<span class="text migrate">({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe}}){{end}}</span>
 						{{else}}
 							<a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
 						{{end}}
@@ -447,13 +447,13 @@
 						<div class="ui top attached header comment-header df ac sb">
 							<div class="comment-header-left df ac">
 								<span class="text grey">
-									{{if .OriginalAuthor }}
+									{{if .OriginalAuthor}}
 										<span class="text black">
 											{{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
-											{{ .OriginalAuthor }}
+											{{.OriginalAuthor}}
 										</span>
 										<span class="text grey"> {{if $.Repository.OriginalURL}}</span>
-										<span class="text migrate">({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span>
+										<span class="text migrate">({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe}}){{end}}</span>
 									{{else}}
 										<a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
 									{{end}}
@@ -509,7 +509,7 @@
 
 				{{if .Review.CodeComments}}
 				<div class="timeline-item event">
-					{{ range $filename, $lines := .Review.CodeComments}}
+					{{range $filename, $lines := .Review.CodeComments}}
 						{{range $line, $comms := $lines}}
 								<div class="ui segments">
 									<div class="ui segment py-3 df ac sb">
@@ -519,7 +519,7 @@
 										{{$isNotPending := (not (eq (index $comms 0).Review.Type 0))}}
 										<div class="df ac">
 											<a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment ml-3 word-break">{{$filename}}</a>
-											{{if $invalid }}
+											{{if $invalid}}
 												<span class="ui label basic small ml-3">
 													{{$.locale.Tr "repo.issues.review.outdated"}}
 												</span>
@@ -564,24 +564,24 @@
 									<div id="code-comments-{{(index $comms 0).ID}}" class="comment-code-cloud ui segment{{if $resolved}} hide{{end}}">
 										<div class="ui comments mb-0">
 											{{range $comms}}
-												{{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.locale }}
+												{{$createdSubStr:= TimeSinceUnix .CreatedUnix $.locale}}
 												<div class="comment code-comment pb-4" id="{{.HashTag}}">
 													<div class="content">
 														<div class="header comment-header">
 															<div class="comment-header-left df ac">
-																{{if not .OriginalAuthor }}
+																{{if not .OriginalAuthor}}
 																	<a class="avatar">
 																		{{avatar .Poster}}
 																	</a>
 																{{end}}
 																<span class="text grey">
-																	{{if .OriginalAuthor }}
+																	{{if .OriginalAuthor}}
 																		<span class="text black">
 																			{{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
-																			{{ .OriginalAuthor }}
+																			{{.OriginalAuthor}}
 																		</span>
 																		<span class="text grey"> {{if $.Repository.OriginalURL}}</span>
-																		<span class="text migrate">({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span>
+																		<span class="text migrate">({{$.locale.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe}}){{end}}</span>
 																	{{else}}
 																		<a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
 																	{{end}}
@@ -671,17 +671,17 @@
 				<a href="{{.Poster.HomeLink}}">
 					{{avatar .Poster}}
 				</a>
-				{{ if .Content }}
+				{{if .Content}}
 					<span class="text grey">
 						<a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
 						{{$.locale.Tr "repo.issues.lock_with_reason" .Content $createdStr | Safe}}
 					</span>
-				{{ else }}
+				{{else}}
 					<span class="text grey">
 						<a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
 						{{$.locale.Tr "repo.issues.lock_no_reason" $createdStr | Safe}}
 					</span>
-				{{ end }}
+				{{end}}
 			</div>
 		{{else if eq .Type 24}}
 			<div class="timeline-item event" id="{{.HashTag}}">
@@ -752,7 +752,7 @@
 				<span class="badge">{{svg "octicon-repo-push"}}</span>
 				<span class="text grey">
 					<a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
-					{{ if .IsForcePush }}
+					{{if .IsForcePush}}
 						{{$.locale.Tr "repo.issues.force_push_codes" ($.Issue.PullRequest.HeadBranch|Escape) (ShortSha .OldCommit) (($.Issue.Repo.CommitLink .OldCommit)|Escape)  (ShortSha .NewCommit) (($.Issue.Repo.CommitLink .NewCommit)|Escape) $createdStr | Safe}}
 					{{else}}
 						{{$.locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}}
diff --git a/templates/repo/issue/view_content/comments_delete_time.tmpl b/templates/repo/issue/view_content/comments_delete_time.tmpl
index 8ace95f33e..e01d2602f6 100644
--- a/templates/repo/issue/view_content/comments_delete_time.tmpl
+++ b/templates/repo/issue/view_content/comments_delete_time.tmpl
@@ -1,6 +1,6 @@
-{{ if .comment.Time }} {{/* compatibility with time comments made before v1.14 */}}
-	{{ if (not .comment.Time.Deleted) }}
-		{{ if (or .ctx.IsAdmin (and .ctx.IsSigned (eq .ctx.SignedUserID .comment.PosterID))) }}
+{{if .comment.Time}} {{/* compatibility with time comments made before v1.14 */}}
+	{{if (not .comment.Time.Deleted)}}
+		{{if (or .ctx.IsAdmin (and .ctx.IsSigned (eq .ctx.SignedUserID .comment.PosterID)))}}
 			<span class="ui float right">
 				<div class="ui mini modal issue-delete-time-modal" data-id="{{.comment.Time.ID}}">
 					<form method="POST" class="delete-time-form" action="{{.ctx.RepoLink}}/issues/{{.ctx.Issue.Index}}/times/{{.comment.TimeID}}/delete">
diff --git a/templates/repo/issue/view_content/context_menu.tmpl b/templates/repo/issue/view_content/context_menu.tmpl
index d3907eee99..45dd08bf61 100644
--- a/templates/repo/issue/view_content/context_menu.tmpl
+++ b/templates/repo/issue/view_content/context_menu.tmpl
@@ -4,12 +4,12 @@
 		{{svg "octicon-kebab-horizontal"}}
 	</a>
 	<div class="menu">
-		{{ $referenceUrl := "" }}
-		{{ if .issue }}
-			{{ $referenceUrl = Printf "%s#%s" .ctx.Issue.HTMLURL .item.HashTag }}
-		{{ else }}
-			{{ $referenceUrl = Printf "%s/files#%s" .ctx.Issue.HTMLURL .item.HashTag }}
-		{{ end }}
+		{{$referenceUrl := ""}}
+		{{if .issue}}
+			{{$referenceUrl = Printf "%s#%s" .ctx.Issue.HTMLURL .item.HashTag}}
+		{{else}}
+			{{$referenceUrl = Printf "%s/files#%s" .ctx.Issue.HTMLURL .item.HashTag}}
+		{{end}}
 		<div class="item context" data-clipboard-text="{{$referenceUrl}}">{{.ctx.locale.Tr "repo.issues.context.copy_link"}}</div>
 		<div class="item context quote-reply {{if .diff}}quote-reply-diff{{end}}" data-target="{{.item.ID}}">{{.ctx.locale.Tr "repo.issues.context.quote_reply"}}</div>
 		{{if not .ctx.UnitIssuesGlobalDisabled}}
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl
index fd901f013e..1e07225300 100644
--- a/templates/repo/issue/view_content/pull.tmpl
+++ b/templates/repo/issue/view_content/pull.tmpl
@@ -1,10 +1,10 @@
-{{if or .PullReviewers .OriginalReviews }}
+{{if or .PullReviewers .OriginalReviews}}
 	<div class="comment box">
 		<div class="content">
 			<div class="ui segment">
 				<h4>{{$.locale.Tr "repo.issues.review.reviewers"}}</h4>
 				{{range .PullReviewers}}
-					{{ $createdStr:= TimeSinceUnix .Review.UpdatedUnix $.locale }}
+					{{$createdStr:= TimeSinceUnix .Review.UpdatedUnix $.locale}}
 					<div class="ui divider"></div>
 					<div class="review-item">
 						<div class="review-item-left">
@@ -71,7 +71,7 @@
 								{{- else if eq .Review.Type 4}}yellow
 								{{else}}grey{{end}}">
 
-								{{if .CanChange }}
+								{{if .CanChange}}
 									<a href="#" class="ui tooltip icon re-request-review {{if .Checked}}checked{{end}}" data-issue-id="{{$.Issue.ID}}" data-content="{{if .Checked}} {{$.locale.Tr "repo.issues.remove_request_review"}} {{else}} {{$.locale.Tr "repo.issues.re_request_review"}} {{end}}"  data-id="{{.ItemID}}" data-update-url="{{$.RepoLink}}/issues/request_review">
 										{{if .Checked}} {{svg "octicon-trash"}} {{else}} {{svg "octicon-sync"}} {{end}}
 									</a>
@@ -82,14 +82,14 @@
 					</div>
 				{{end}}
 				{{range .OriginalReviews}}
-					{{ $createdStr:= TimeSinceUnix .UpdatedUnix $.locale }}
+					{{$createdStr:= TimeSinceUnix .UpdatedUnix $.locale}}
 					<div class="ui divider"></div>
 					<div class="review-item">
 						<div class="review-item-left">
-							<a href="{{$.Repository.OriginalURL}}" class="ui tooltip" data-content="{{$.locale.Tr "repo.migrated_from_fake" ($.Repository.GetOriginalURLHostname|Escape) | Safe }}">
+							<a href="{{$.Repository.OriginalURL}}" class="ui tooltip" data-content="{{$.locale.Tr "repo.migrated_from_fake" ($.Repository.GetOriginalURLHostname|Escape) | Safe}}">
 								<span class="text black ">
 									{{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
-									{{ .OriginalAuthor }}
+									{{.OriginalAuthor}}
 								</span>
 							</a>
 						</div>
@@ -180,7 +180,7 @@
 				<div class="item toggle-wip df ac sb" data-title="{{.Issue.Title}}" data-wip-prefix="{{(.WorkInProgressPrefix|Escape)}}" data-update-url="{{.Issue.Link}}/title">
 					<div>
 						<i class="icon icon-octicon">{{svg "octicon-x"}}</i>
-						{{$.locale.Tr "repo.pulls.cannot_merge_work_in_progress" }}
+						{{$.locale.Tr "repo.pulls.cannot_merge_work_in_progress"}}
 					</div>
 					<div>
 						{{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}}
@@ -224,7 +224,7 @@
 				{{else if .IsBlockedByChangedProtectedFiles}}
 					<div class="item">
 						<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
-						{{$.locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n" | Safe }}
+						{{$.locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n" | Safe}}
 						<div class="ui ordered list">
 							{{range .ChangedProtectedFiles}}
 								<div data-value="-" class="item">{{.}}</div>
@@ -248,7 +248,7 @@
 					</div>
 					<div class="item">
 						<i class="icon unlock"></i>
-						{{$.locale.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }}
+						{{$.locale.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason)}}
 					</div>
 				{{end}}
 
@@ -278,7 +278,7 @@
 					{{else if .IsSigned}}
 						<div class="item">
 							<i class="icon unlock"></i>
-							{{$.locale.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }}
+							{{$.locale.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason)}}
 						</div>
 					{{end}}
 				{{end}}
@@ -290,7 +290,7 @@
 							{{$.locale.Tr "repo.pulls.outdated_with_base_branch"}}
 						</div>
 						<div class="item-section-right">
-							{{if and .UpdateAllowed .UpdateByRebaseAllowed }}
+							{{if and .UpdateAllowed .UpdateByRebaseAllowed}}
 								<div class="dib">
 									<div class="ui buttons update-button">
 										<button class="ui button" data-do="{{.Link}}/update" data-redirect="{{.Link}}">
@@ -460,7 +460,7 @@
 				{{else if .IsBlockedByChangedProtectedFiles}}
 					<div class="item text red">
 						<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
-						{{$.locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n" | Safe }}
+						{{$.locale.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n" | Safe}}
 						<div class="ui ordered list">
 							{{range .ChangedProtectedFiles}}
 								<div data-value="-" class="item">{{.}}</div>
diff --git a/templates/repo/issue/view_content/reactions.tmpl b/templates/repo/issue/view_content/reactions.tmpl
index 64bd715238..c0a925d18b 100644
--- a/templates/repo/issue/view_content/reactions.tmpl
+++ b/templates/repo/issue/view_content/reactions.tmpl
@@ -1,5 +1,5 @@
 {{range $key, $value := .Reactions}}
-	<a class="ui label basic{{if $value.HasUser $.ctx.SignedUserID}} primary{{end}}{{if not $.ctx.IsSigned}} disabled{{end}}" data-title="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{ $.ctx.locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" data-content="{{ $key }}" data-action-url="{{ $.ActionURL }}">
+	<a class="ui label basic{{if $value.HasUser $.ctx.SignedUserID}} primary{{end}}{{if not $.ctx.IsSigned}} disabled{{end}}" data-title="{{$value.GetFirstUsers}}{{if gt ($value.GetMoreUserCount) 0}} {{$.ctx.locale.Tr "repo.reactions_more" $value.GetMoreUserCount}}{{end}}" data-content="{{$key}}" data-action-url="{{$.ActionURL}}">
 		<span class="reaction">{{ReactionToEmoji $key}}</span>
 		<span class="reaction-count">{{len $value}}</span>
 	</a>
diff --git a/templates/repo/issue/view_content/reference_issue_dialog.tmpl b/templates/repo/issue/view_content/reference_issue_dialog.tmpl
index 3d7ef7e54e..e877ffb688 100644
--- a/templates/repo/issue/view_content/reference_issue_dialog.tmpl
+++ b/templates/repo/issue/view_content/reference_issue_dialog.tmpl
@@ -3,7 +3,7 @@
 		{{.locale.Tr "repo.issues.context.reference_issue"}}
 	</div>
 	<div class="content" style="text-align:left">
-		<form class="ui form" action="{{ Printf "%s/issues/new" .Repository.Link }}" method="post">
+		<form class="ui form" action="{{Printf "%s/issues/new" .Repository.Link}}" method="post">
 			{{.CsrfTokenHtml}}
 			<div class="ui segment content">
 				<div class="field">
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index 46fd88c753..5b95d3d8e5 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -2,7 +2,7 @@
 	<div class="ui segment metas">
 		{{template "repo/issue/branch_selector_field" .}}
 
-		{{if .Issue.IsPull }}
+		{{if .Issue.IsPull}}
 
 			<input id="reviewer_id" name="reviewer_id" type="hidden" value="{{.reviewer_id}}">
 			<div class="ui {{if or (not .Reviewers) (not .CanChooseReviewer) .Repository.IsArchived}}disabled{{end}} floating jump select-reviewers-modify dropdown">
@@ -79,10 +79,10 @@
 					{{end}}
 					{{range .OriginalReviews}}
 						<div class="item" style="margin-bottom: 10px;">
-							<a href="{{$.Repository.OriginalURL}}" class="ui tooltip" data-content="{{$.locale.Tr "repo.migrated_from_fake" ($.Repository.GetOriginalURLHostname|Escape) | Safe }}">
+							<a href="{{$.Repository.OriginalURL}}" class="ui tooltip" data-content="{{$.locale.Tr "repo.migrated_from_fake" ($.Repository.GetOriginalURLHostname|Escape) | Safe}}">
 								<span class="text black">
 									{{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
-									{{ .OriginalAuthor }}
+									{{.OriginalAuthor}}
 								</span>
 							</a>
 							<span class="ui right type-icon text {{if eq .Type 1}}green
@@ -125,12 +125,12 @@
 				{{if or .Labels .OrgLabels}}
 					{{range .Labels}}
 						<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check"}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}}
-						{{if .Description }}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a>
+						{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a>
 					{{end}}
 					<div class="ui divider"></div>
 					{{range .OrgLabels}}
 						<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check"}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}}
-						{{if .Description }}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a>
+						{{if .Description}}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a>
 					{{end}}
 				{{else}}
 					<div class="header" style="text-transform: none;font-size:14px;">{{.locale.Tr "repo.issues.new.no_items"}}</div>
@@ -337,7 +337,7 @@
 				</div>
 			</div>
 		{{end}}
-		{{if .Repository.IsTimetrackerEnabled }}
+		{{if .Repository.IsTimetrackerEnabled}}
 			{{if and .CanUseTimetracker (not .Repository.IsArchived)}}
 				<div class="ui divider"></div>
 				<div class="ui timetrack">
@@ -580,7 +580,7 @@
 		{{if and .IsRepoAdmin (not .Repository.IsArchived)}}
 			<div class="ui divider"></div>
 			<div class="ui watching">
-				<button class="fluid ui show-modal button {{if .Issue.IsLocked }} negative {{end}}" data-modal="#lock">
+				<button class="fluid ui show-modal button {{if .Issue.IsLocked}} negative {{end}}" data-modal="#lock">
 					{{if .Issue.IsLocked}}
 						{{svg "octicon-key"}}
 						{{.locale.Tr "repo.issues.unlock"}}
@@ -592,7 +592,7 @@
 			</div>
 			<div class="ui tiny modal" id="lock">
 				<div class="header">
-					{{ if .Issue.IsLocked }}
+					{{if .Issue.IsLocked}}
 						{{.locale.Tr "repo.issues.unlock.title"}}
 					{{else}}
 						{{.locale.Tr "repo.issues.lock.title"}}
@@ -600,7 +600,7 @@
 				</div>
 				<div class="content">
 					<div class="ui warning message text left">
-						{{ if .Issue.IsLocked }}
+						{{if .Issue.IsLocked}}
 							{{.locale.Tr "repo.issues.unlock.notice_1"}}<br>
 							{{.locale.Tr "repo.issues.unlock.notice_2"}}<br>
 						{{else}}
@@ -610,13 +610,13 @@
 						{{end}}
 					</div>
 
-					<form class="ui form" action="{{.Issue.Link}}{{ if .Issue.IsLocked }}/unlock{{else}}/lock{{end}}"
+					<form class="ui form" action="{{.Issue.Link}}{{if .Issue.IsLocked}}/unlock{{else}}/lock{{end}}"
 						method="post">
 						{{.CsrfTokenHtml}}
 
-						{{ if not .Issue.IsLocked }}
+						{{if not .Issue.IsLocked}}
 							<div class="field">
-								<strong> {{ .locale.Tr "repo.issues.lock.reason" }} </strong>
+								<strong> {{.locale.Tr "repo.issues.lock.reason"}} </strong>
 							</div>
 
 							<div class="field">
@@ -644,7 +644,7 @@
 						<div class="text right actions">
 							<div class="ui cancel button">{{.locale.Tr "settings.cancel"}}</div>
 							<button class="ui red button">
-								{{ if .Issue.IsLocked }}
+								{{if .Issue.IsLocked}}
 									{{.locale.Tr "repo.issues.unlock_confirm"}}
 								{{else}}
 									{{.locale.Tr "repo.issues.lock_confirm"}}
diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl
index 456515af33..3141e81808 100644
--- a/templates/repo/issue/view_title.tmpl
+++ b/templates/repo/issue/view_title.tmpl
@@ -44,8 +44,8 @@
 			{{$baseHref = printf "<a href=\"%s\">%s</a>" (.BaseBranchHTMLURL | Escape) $baseHref}}
 		{{end}}
 		{{if .Issue.PullRequest.HasMerged}}
-			{{ $mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix $.locale }}
-			{{if .Issue.OriginalAuthor }}
+			{{$mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix $.locale}}
+			{{if .Issue.OriginalAuthor}}
 				{{.Issue.OriginalAuthor}}
 				<span class="pull-desc">{{$.locale.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Safe}}</span>
 			{{else}}
@@ -53,7 +53,7 @@
 				<span class="pull-desc">{{$.locale.Tr "repo.pulls.merged_title_desc" .NumCommits $headHref $baseHref $mergedStr | Safe}}</span>
 			{{end}}
 		{{else}}
-			{{if .Issue.OriginalAuthor }}
+			{{if .Issue.OriginalAuthor}}
 				<span id="pull-desc" class="pull-desc">{{.Issue.OriginalAuthor}} {{$.locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}}</span>
 			{{else}}
 				<span id="pull-desc" class="pull-desc">
@@ -80,11 +80,11 @@
 						</div>
 						<div class="scrolling menu" id="branch-select">
 							{{range .Branches}}
-								{{ $sameBase := ne $.BaseName $.HeadUserName }}
-								{{ $differentBranch := ne . $.HeadBranch }}
-								{{ if or $sameBase $differentBranch }}
+								{{$sameBase := ne $.BaseName $.HeadUserName}}
+								{{$differentBranch := ne . $.HeadBranch}}
+								{{if or $sameBase $differentBranch}}
 									<div class="item {{if eq $.BaseBranch .}}selected{{end}}" data-branch="{{.}}">{{$.BaseName}}{{if $.HeadRepo}}/{{$.HeadRepo}}{{end}}:{{.}}</div>
-								{{ end }}
+								{{end}}
 							{{end}}
 						</div>
 					</div>
@@ -92,9 +92,9 @@
 			</span>
 		{{end}}
 	{{else}}
-		{{ $createdStr:= TimeSinceUnix .Issue.CreatedUnix $.locale }}
+		{{$createdStr:= TimeSinceUnix .Issue.CreatedUnix $.locale}}
 		<span class="time-desc">
-			{{if .Issue.OriginalAuthor }}
+			{{if .Issue.OriginalAuthor}}
 				{{$.locale.Tr "repo.issues.opened_by_fake" $createdStr (.Issue.OriginalAuthor|Escape) | Safe}}
 			{{else if gt .Issue.Poster.ID 0}}
 				{{$.locale.Tr "repo.issues.opened_by" $createdStr (.Issue.Poster.HomeLink|Escape) (.Issue.Poster.GetDisplayName|Escape) | Safe}}
diff --git a/templates/repo/migrate/migrate.tmpl b/templates/repo/migrate/migrate.tmpl
index b34a5373d6..a38302a663 100644
--- a/templates/repo/migrate/migrate.tmpl
+++ b/templates/repo/migrate/migrate.tmpl
@@ -11,7 +11,7 @@
 								{{.Title}}
 							</div>
 							<div class="description tc">
-								{{(Printf "repo.migrate.%s.description" .Name) | $.locale.Tr }}
+								{{(Printf "repo.migrate.%s.description" .Name) | $.locale.Tr}}
 							</div>
 						</div>
 					</a>
diff --git a/templates/repo/projects/list.tmpl b/templates/repo/projects/list.tmpl
index 6703283b8c..9e265f9a91 100644
--- a/templates/repo/projects/list.tmpl
+++ b/templates/repo/projects/list.tmpl
@@ -42,8 +42,8 @@
 				<li class="item">
 					{{svg "octicon-project"}} <a href="{{$.RepoLink}}/projects/{{.ID}}">{{.Title}}</a>
 					<div class="meta">
-						{{ $closedDate:= TimeSinceUnix .ClosedDateUnix $.locale }}
-						{{if .IsClosed }}
+						{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}}
+						{{if .IsClosed}}
 							{{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate|Str2html}}
 						{{end}}
 						<span class="issue-stats">
diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl
index 0f96f11f6c..262efd2e0e 100644
--- a/templates/repo/projects/view.tmpl
+++ b/templates/repo/projects/view.tmpl
@@ -78,7 +78,7 @@
 	<div class="ui container fluid padded" id="project-board">
 
 		<div class="board">
-			{{ range $board := .Boards }}
+			{{range $board := .Boards}}
 
 			<div class="ui segment board-column" style="background: {{.Color}} !important;" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}">
 				<div class="board-column-header df ac sb">
@@ -169,13 +169,13 @@
 								</div>
 							</div>
 						</div>
-					{{ end }}
+					{{end}}
 				</div>
 				<div class="ui divider"></div>
 
 				<div class="ui cards board" data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}" data-project="{{$.Project.ID}}" data-board="{{.ID}}" id="board_{{.ID}}">
 
-					{{ range (index $.IssuesMap .ID) }}
+					{{range (index $.IssuesMap .ID)}}
 
 					<!-- start issue card -->
 					<div class="card board-card" data-issue="{{.ID}}">
@@ -207,8 +207,8 @@
 							<div class="meta my-2">
 								<span class="text light grey">
 									#{{.Index}}
-									{{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.locale }}
-									{{if .OriginalAuthor }}
+									{{$timeStr := TimeSinceUnix .GetLastEventTimestamp $.locale}}
+									{{if .OriginalAuthor}}
 										{{$.locale.Tr .GetLastEventLabelFake $timeStr (.OriginalAuthor|Escape) | Safe}}
 									{{else if gt .Poster.ID 0}}
 										{{$.locale.Tr .GetLastEventLabel $timeStr (.Poster.HomeLink|Escape) (.Poster.GetDisplayName | Escape) | Safe}}
@@ -217,43 +217,43 @@
 									{{end}}
 								</span>
 							</div>
-							{{- if .MilestoneID }}
+							{{- if .MilestoneID}}
 							<div class="meta my-2">
-								<a class="milestone" href="{{$.RepoLink}}/milestone/{{ .MilestoneID}}">
+								<a class="milestone" href="{{$.RepoLink}}/milestone/{{.MilestoneID}}">
 									{{svg "octicon-milestone" 16 "mr-2 vm"}}
-									<span class="vm">{{ .Milestone.Name }}</span>
+									<span class="vm">{{.Milestone.Name}}</span>
 								</a>
 							</div>
-							{{- end }}
-							{{- range index $.LinkedPRs .ID }}
+							{{- end}}
+							{{- range index $.LinkedPRs .ID}}
 							<div class="meta my-2">
-								<a href="{{$.RepoLink}}/pulls/{{ .Index }}">
+								<a href="{{$.RepoLink}}/pulls/{{.Index}}">
 									<span class="m-0 {{if .PullRequest.HasMerged}}purple{{else if .IsClosed}}red{{else}}green{{end}}">{{svg "octicon-git-merge" 16 "mr-2 vm"}}</span>
-									<span class="vm">{{ .Title}} <span class="text light grey">#{{.Index}}</span></span>
+									<span class="vm">{{.Title}} <span class="text light grey">#{{.Index}}</span></span>
 								</a>
 							</div>
-							{{- end }}
+							{{- end}}
 						</div>
 
-						{{ if or .Labels .Assignees }}
+						{{if or .Labels .Assignees}}
 						<div class="extra content labels-list p-0 pt-2">
-							{{ range .Labels }}
+							{{range .Labels}}
 								<a class="ui label" target="_blank" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}};" title="{{.Description | RenderEmojiPlain}}">{{.Name | RenderEmoji}}</a>
-							{{ end }}
+							{{end}}
 							<div class="right floated">
-								{{ range .Assignees }}
+								{{range .Assignees}}
 									<a class="tooltip" target="_blank" href="{{.HTMLURL}}" data-content="{{$.locale.Tr "repo.projects.board.assigned_to"}} {{.Name}}">{{avatar . 28 "mini mr-3"}}</a>
-								{{ end }}
+								{{end}}
 							</div>
 						</div>
-						{{ end }}
+						{{end}}
 					</div>
 					<!-- stop issue card -->
 
-					{{ end }}
+					{{end}}
 				</div>
 			</div>
-			{{ end }}
+			{{end}}
 		</div>
 
 	</div>
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl
index 4eb099129a..1f04743eaf 100644
--- a/templates/repo/release/list.tmpl
+++ b/templates/repo/release/list.tmpl
@@ -84,7 +84,7 @@
 									<a class="mono" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "mr-2"}}{{ShortSha .Sha1}}</a>
 								</span>
 							{{end}}
-							{{if .Sha1 }}
+							{{if .Sha1}}
 								{{template "repo/branch_dropdown" dict "root" $ "release" .}}
 							{{end}}
 						{{end}}
@@ -95,12 +95,12 @@
 								<a href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{svg "octicon-tag" 16 "mr-2"}}{{.TagName}}</a>
 							</h4>
 							<p class="text grey">
-								{{ if gt .Publisher.ID 0 }}
+								{{if gt .Publisher.ID 0}}
 								<span class="author">
 									{{avatar .Publisher 20}}
 									<a href="{{.Publisher.HomeLink}}">{{.Publisher.Name}}</a>
 								</span>
-								{{ end }}
+								{{end}}
 								<span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | PathEscapeSegments}}{{if .Target}}...{{.Target | PathEscapeSegments}}{{end}}">{{$.locale.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.locale.Tr "repo.release.ahead.target" $.DefaultBranch}}</span>
 							</p>
 							<div class="download">
diff --git a/templates/repo/settings/collaboration.tmpl b/templates/repo/settings/collaboration.tmpl
index 5d152a62e4..342b260db6 100644
--- a/templates/repo/settings/collaboration.tmpl
+++ b/templates/repo/settings/collaboration.tmpl
@@ -56,7 +56,7 @@
 		<h4 class="ui top attached header">
 			{{$.locale.Tr "repo.settings.teams"}}
 		</h4>
-		{{ $allowedToChangeTeams := ( or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner)) }}
+		{{$allowedToChangeTeams := ( or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner))}}
 		{{if .Teams}}
 		<div class="ui attached segment collaborator list">
 			{{range $t, $team := .Teams}}
@@ -71,10 +71,10 @@
 						<div class="ui inline dropdown">
 							<div class="text">{{if eq .AccessMode 1}}{{$.locale.Tr "repo.settings.collaboration.read"}}{{else if eq .AccessMode 2}}{{$.locale.Tr "repo.settings.collaboration.write"}}{{else if eq .AccessMode 3}}{{$.locale.Tr "repo.settings.collaboration.admin"}}{{else if eq .AccessMode 4}}{{$.locale.Tr "repo.settings.collaboration.owner"}}{{else}}{{$.locale.Tr "repo.settings.collaboration.undefined"}}{{end}}</div>
 						</div>
-						{{ if or (eq .AccessMode 1) (eq .AccessMode 2) }}
-							{{ $first := true }}
+						{{if or (eq .AccessMode 1) (eq .AccessMode 2)}}
+							{{$first := true}}
 							<div class="description">
-							Sections: {{range $u, $unit := $.Units}}{{if and ($.Repo.UnitEnabled $unit.Type) ($team.UnitEnabled $unit.Type)}}{{if $first}}{{ $first = false }}{{else}}, {{end}}{{$.locale.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}}
+							Sections: {{range $u, $unit := $.Units}}{{if and ($.Repo.UnitEnabled $unit.Type) ($team.UnitEnabled $unit.Type)}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{$.locale.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}}
 							</div>
 						{{end}}
 					</div>
diff --git a/templates/repo/settings/lfs_pointers.tmpl b/templates/repo/settings/lfs_pointers.tmpl
index 85ce2a4324..07633e3342 100644
--- a/templates/repo/settings/lfs_pointers.tmpl
+++ b/templates/repo/settings/lfs_pointers.tmpl
@@ -5,7 +5,7 @@
 	<div class="ui container">
 		{{template "base/alert" .}}
 		<h4 class="ui top attached header">
-			{{.locale.Tr "repo.settings.lfs_pointers.found" .NumPointers .NumAssociated .NumNotAssociated .NumNoExist }}
+			{{.locale.Tr "repo.settings.lfs_pointers.found" .NumPointers .NumAssociated .NumNotAssociated .NumNoExist}}
 			{{if gt .NumAssociatable 0}}
 				<div class="ui right">
 					<form class="ui form" method="post" action="{{$.Link}}/associate">
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index f34057d9c0..a9ceebd446 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -336,7 +336,7 @@
 							</div>
 						</div>
 						<div class="ui checkbox">
-							<input name="enable_close_issues_via_commit_in_any_branch" type="checkbox" {{ if .Repository.CloseIssuesViaCommitInAnyBranch }}checked{{end}}>
+							<input name="enable_close_issues_via_commit_in_any_branch" type="checkbox" {{if .Repository.CloseIssuesViaCommitInAnyBranch}}checked{{end}}>
 							<label>{{.locale.Tr "repo.settings.admin_enable_close_issues_via_commit_in_any_branch"}}</label>
 						</div>
 					</div>
@@ -678,9 +678,9 @@
 							<input type="hidden" name="action" value="cancel_transfer">
 							<button class="ui red button">{{.locale.Tr "repo.settings.transfer_abort"}}</button>
 						</form>
-					{{ else }}
+					{{else}}
 						<button class="ui basic red show-modal button" data-modal="#transfer-repo-modal">{{.locale.Tr "repo.settings.transfer"}}</button>
-					{{ end }}
+					{{end}}
 				</div>
 				<div>
 					<h5>{{.locale.Tr "repo.settings.transfer"}}</h5>
diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl
index d18061c115..1c7e915c66 100644
--- a/templates/repo/settings/tags.tmpl
+++ b/templates/repo/settings/tags.tmpl
@@ -93,14 +93,14 @@
 											{{if or .AllowlistUserIDs (and $.Owner.IsOrganization .AllowlistTeamIDs)}}
 												{{$userIDs := .AllowlistUserIDs}}
 												{{range $.Users}}
-													{{if contain $userIDs .ID }}
+													{{if contain $userIDs .ID}}
 														<a class="ui basic image label" href="{{.HomeLink}}">{{avatar . 26}} {{.GetDisplayName}}</a>
 													{{end}}
 												{{end}}
 												{{if $.Owner.IsOrganization}}
 													{{$teamIDs := .AllowlistTeamIDs}}
 													{{range $.Teams}}
-														{{if contain $teamIDs .ID }}
+														{{if contain $teamIDs .ID}}
 															<a class="ui basic image label" href="{{$.Owner.OrganisationLink}}/teams/{{PathEscape .LowerName}}">{{.Name}}</a>
 														{{end}}
 													{{end}}
diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl
index e99ff6a0b9..767d66114c 100644
--- a/templates/repo/settings/webhook/history.tmpl
+++ b/templates/repo/settings/webhook/history.tmpl
@@ -54,7 +54,7 @@
 								<h5>{{$.locale.Tr "repo.settings.webhook.headers"}}</h5>
 								<pre class="webhook-info"><strong>Request URL:</strong> {{.RequestInfo.URL}}
 <strong>Request method:</strong> {{if .RequestInfo.HTTPMethod}}{{.RequestInfo.HTTPMethod}}{{else}}POST{{end}}
-{{ range $key, $val := .RequestInfo.Headers }}<strong>{{$key}}:</strong> {{$val}}
+{{range $key, $val := .RequestInfo.Headers}}<strong>{{$key}}:</strong> {{$val}}
 {{end}}</pre>
 								<h5>{{$.locale.Tr "repo.settings.webhook.payload"}}</h5>
 								<pre class="webhook-info"><code class="json">{{.PayloadContent}}</code></pre>
@@ -65,7 +65,7 @@
 						<div class="ui bottom attached tab segment" data-tab="response-{{.ID}}">
 							{{if .ResponseInfo}}
 								<h5>{{$.locale.Tr "repo.settings.webhook.headers"}}</h5>
-								<pre class="webhook-info">{{ range $key, $val := .ResponseInfo.Headers }}<strong>{{$key}}:</strong> {{$val}}
+								<pre class="webhook-info">{{range $key, $val := .ResponseInfo.Headers}}<strong>{{$key}}:</strong> {{$val}}
 {{end}}</pre>
 								<h5>{{$.locale.Tr "repo.settings.webhook.body"}}</h5>
 								<pre class="webhook-info"><code>{{.ResponseInfo.Body}}</code></pre>
diff --git a/templates/repo/wiki/revision.tmpl b/templates/repo/wiki/revision.tmpl
index 71b69220c6..b49441f4eb 100644
--- a/templates/repo/wiki/revision.tmpl
+++ b/templates/repo/wiki/revision.tmpl
@@ -1,7 +1,7 @@
 {{template "base/head" .}}
 <div class="page-content repository wiki revisions">
 	{{template "repo/header" .}}
-	{{ $title := .title}}
+	{{$title := .title}}
 	<div class="ui container">
 		<div class="ui stackable grid">
 			<div class="ui eight wide column text right df ac je">
diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl
index d641c25cf0..3cd6617dd9 100644
--- a/templates/repo/wiki/view.tmpl
+++ b/templates/repo/wiki/view.tmpl
@@ -1,7 +1,7 @@
 {{template "base/head" .}}
 <div class="page-content repository wiki view">
 	{{template "repo/header" .}}
-	{{ $title := .title}}
+	{{$title := .title}}
 	<div class="ui container">
 		<div class="repo-button-row df ac sb fw">
 			<div class="df ac">
diff --git a/templates/user/auth/change_passwd_inner.tmpl b/templates/user/auth/change_passwd_inner.tmpl
index 49ae608053..4b18ac944f 100644
--- a/templates/user/auth/change_passwd_inner.tmpl
+++ b/templates/user/auth/change_passwd_inner.tmpl
@@ -20,7 +20,7 @@
 
 			<div class="inline field">
 				<label></label>
-				<button class="ui green button">{{.locale.Tr "settings.change_password" }}</button>
+				<button class="ui green button">{{.locale.Tr "settings.change_password"}}</button>
 			</div>
 			</form>
 		</div>
diff --git a/templates/user/auth/grant_error.tmpl b/templates/user/auth/grant_error.tmpl
index 2173a3311b..b775ac9b92 100644
--- a/templates/user/auth/grant_error.tmpl
+++ b/templates/user/auth/grant_error.tmpl
@@ -4,7 +4,7 @@
 	<div class="column seven wide">
 		<div class="ui middle centered raised segments">
 			<h1 class="ui top attached header">
-				{{.locale.Tr "auth.authorization_failed" }}
+				{{.locale.Tr "auth.authorization_failed"}}
 			</h1>
 			<h3 class="ui attached segment">{{.Error.ErrorDescription}}</h3>
 			<div class="ui attached segment">
diff --git a/templates/user/auth/reset_passwd.tmpl b/templates/user/auth/reset_passwd.tmpl
index bba7b2bc4b..e55eb8d330 100644
--- a/templates/user/auth/reset_passwd.tmpl
+++ b/templates/user/auth/reset_passwd.tmpl
@@ -10,10 +10,10 @@
 				</h2>
 				<div class="ui attached segment">
 					{{template "base/alert" .}}
-					{{if .user_email }}
+					{{if .user_email}}
 						<div class="inline field">
 							<label for="user_name">{{.locale.Tr "email"}}</label>
-							<input id="user_name" type="text" value="{{ .user_email }}" disabled>
+							<input id="user_name" type="text" value="{{.user_email}}" disabled>
 						</div>
 					{{end}}
 					{{if .IsResetForm}}
@@ -34,7 +34,7 @@
 						<h4 class="ui dividing header">
 							{{.locale.Tr "twofa"}}
 						</h4>
-						<div class="ui warning visible message">{{.locale.Tr "settings.twofa_is_enrolled" | Str2html }}</div>
+						<div class="ui warning visible message">{{.locale.Tr "settings.twofa_is_enrolled" | Str2html}}</div>
 						{{if .scratch_code}}
 						<div class="required inline field {{if .Err_Token}}error{{end}}">
 							<label for="token">{{.locale.Tr "auth.scratch_code"}}</label>
diff --git a/templates/user/auth/signup_inner.tmpl b/templates/user/auth/signup_inner.tmpl
index b868b77bed..43df945931 100644
--- a/templates/user/auth/signup_inner.tmpl
+++ b/templates/user/auth/signup_inner.tmpl
@@ -46,19 +46,19 @@
 				{{end}}
 				{{if and .EnableCaptcha (eq .CaptchaType "recaptcha")}}
 					<div class="inline field required">
-						<div class="g-recaptcha" data-sitekey="{{ .RecaptchaSitekey }}"></div>
+						<div class="g-recaptcha" data-sitekey="{{.RecaptchaSitekey}}"></div>
 					</div>
 				{{end}}
 				{{if and .EnableCaptcha (eq .CaptchaType "hcaptcha")}}
 					<div class="inline field required">
-						<div class="h-captcha" data-sitekey="{{ .HcaptchaSitekey }}"></div>
+						<div class="h-captcha" data-sitekey="{{.HcaptchaSitekey}}"></div>
 					</div>
 				{{end}}
 				{{if and .EnableCaptcha (eq .CaptchaType "mcaptcha")}}
 					<div class="inline field df ac db-small captcha-field">
 						<span>{{.locale.Tr "captcha"}}</span>
 						<div class="border-secondary w-100-small" id="mcaptcha__widget-container" style="width: 50%; height: 5em"></div>
-						<div class="m-captcha" data-sitekey="{{ .McaptchaSitekey }}" data-instance-url="{{ .McaptchaURL }}"></div>
+						<div class="m-captcha" data-sitekey="{{.McaptchaSitekey}}" data-instance-url="{{.McaptchaURL}}"></div>
 					</div>
 				{{end}}
 
diff --git a/templates/user/auth/signup_openid_connect.tmpl b/templates/user/auth/signup_openid_connect.tmpl
index b023ca1125..36f0277b40 100644
--- a/templates/user/auth/signup_openid_connect.tmpl
+++ b/templates/user/auth/signup_openid_connect.tmpl
@@ -22,7 +22,7 @@
 					</div>
 					<div class="inline field">
 						<label for="openid">OpenID URI</label>
-						<input id="openid" value="{{ .OpenID }}" readonly>
+						<input id="openid" value="{{.OpenID}}" readonly>
 					</div>
 					<div class="inline field">
 						<label></label>
diff --git a/templates/user/auth/signup_openid_register.tmpl b/templates/user/auth/signup_openid_register.tmpl
index 9fe0a9de1b..9c0558311f 100644
--- a/templates/user/auth/signup_openid_register.tmpl
+++ b/templates/user/auth/signup_openid_register.tmpl
@@ -32,22 +32,22 @@
 					{{end}}
 					{{if and .EnableCaptcha (eq .CaptchaType "recaptcha")}}
 						<div class="inline field required">
-							<div class="g-recaptcha" data-sitekey="{{ .RecaptchaSitekey }}"></div>
+							<div class="g-recaptcha" data-sitekey="{{.RecaptchaSitekey}}"></div>
 						</div>
 					{{end}}
 					{{if and .EnableCaptcha (eq .CaptchaType "hcaptcha")}}
 						<div class="inline field required">
-							<div class="h-captcha" data-sitekey="{{ .HcaptchaSitekey }}"></div>
+							<div class="h-captcha" data-sitekey="{{.HcaptchaSitekey}}"></div>
 						</div>
 					{{end}}
 					{{if and .EnableCaptcha (eq .CaptchaType "mcaptcha")}}
 						<div class="inline field required">
-							<div class="m-captcha" data-sitekey="{{ .McaptchaSitekey }}" data-instance-url="{{ .McaptchaURL }}"></div>
+							<div class="m-captcha" data-sitekey="{{.McaptchaSitekey}}" data-instance-url="{{.McaptchaURL}}"></div>
 						</div>
 					{{end}}
 					<div class="inline field">
 						<label for="openid">OpenID URI</label>
-						<input id="openid" value="{{ .OpenID }}" readonly>
+						<input id="openid" value="{{.OpenID}}" readonly>
 					</div>
 					<div class="inline field">
 						<label></label>
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl
index 95e2239257..1862f32b6b 100644
--- a/templates/user/dashboard/feeds.tmpl
+++ b/templates/user/dashboard/feeds.tmpl
@@ -23,38 +23,38 @@
 								{{$.locale.Tr "action.create_branch" (.GetRepoLink|Escape) (.GetRefLink|Escape) (Escape .GetBranch) (.ShortRepoPath|Escape) | Str2html}}
 							{{end}}
 						{{else if eq .GetOpType 6}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.create_issue" ((printf "%s/issues/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 7}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.create_pull_request" ((printf "%s/pulls/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 8}}
 							{{$.locale.Tr "action.transfer_repo" .GetContent (.GetRepoLink|Escape) (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 9}}
 							{{$.locale.Tr "action.push_tag" (.GetRepoLink|Escape) (.GetRefLink|Escape) (.GetTag|Escape) (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 10}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.comment_issue" ((printf "%s/issues/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 11}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.merge_pull_request" ((printf "%s/pulls/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 12}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.close_issue" ((printf "%s/issues/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 13}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.reopen_issue" ((printf "%s/issues/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 14}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.close_pull_request" ((printf "%s/pulls/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 15}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.reopen_pull_request" ((printf "%s/pulls/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 16}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.delete_tag" (.GetRepoLink|Escape) (.GetTag|Escape) (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 17}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.delete_branch" (.GetRepoLink|Escape) (.GetBranch|Escape) (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 18}}
 							{{$.locale.Tr "action.mirror_sync_push" (.GetRepoLink|Escape) (.GetRefLink|Escape) (.GetBranch|Escape) (.ShortRepoPath|Escape) | Str2html}}
@@ -63,30 +63,30 @@
 						{{else if eq .GetOpType 20}}
 							{{$.locale.Tr "action.mirror_sync_delete" (.GetRepoLink|Escape) (.GetBranch|Escape) (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 21}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.approve_pull_request" ((printf "%s/pulls/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 22}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.reject_pull_request" ((printf "%s/pulls/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 23}}
-							{{ $index := index .GetIssueInfos 0}}
+							{{$index := index .GetIssueInfos 0}}
 							{{$.locale.Tr "action.comment_pull" ((printf "%s/pulls/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) | Str2html}}
 						{{else if eq .GetOpType 24}}
-							{{ $linkText := .Content | RenderEmoji }}
+							{{$linkText := .Content | RenderEmoji}}
 							{{$.locale.Tr "action.publish_release" (.GetRepoLink|Escape) ((printf "%s/releases/tag/%s" .GetRepoLink .GetTag)|Escape) (.ShortRepoPath|Escape) $linkText | Str2html}}
 						{{else if eq .GetOpType 25}}
-							{{ $index := index .GetIssueInfos 0}}
-							{{ $reviewer := index .GetIssueInfos 1}}
+							{{$index := index .GetIssueInfos 0}}
+							{{$reviewer := index .GetIssueInfos 1}}
 							{{$.locale.Tr "action.review_dismissed" ((printf "%s/pulls/%s" .GetRepoLink $index) |Escape) $index (.ShortRepoPath|Escape) $reviewer | Str2html}}
 						{{end}}
 					</p>
 					{{if or (eq .GetOpType 5) (eq .GetOpType 18)}}
 						<div class="content">
 							<ul>
-								{{ $push := ActionContent2Commits .}}
-								{{ $repoLink := .GetRepoLink}}
+								{{$push := ActionContent2Commits .}}
+								{{$repoLink := .GetRepoLink}}
 								{{range $push.Commits}}
-									{{ $commitLink := printf "%s/commit/%s" $repoLink .Sha1}}
+									{{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}}
 									<li>
 										{{avatarHTML ($push.AvatarLink .AuthorEmail) 16 "mr-2" .AuthorName}}
 										<a class="commit-id mr-2" href="{{$commitLink}}">{{ShortSha .Sha1}}</a>
diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl
index 9044c7a2a4..248d37b2e4 100644
--- a/templates/user/dashboard/milestones.tmpl
+++ b/templates/user/dashboard/milestones.tmpl
@@ -91,7 +91,7 @@
 								</div>
 							</div>
 							<div class="meta">
-								{{ $closedDate:= TimeSinceUnix .ClosedDateUnix $.locale }}
+								{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}}
 								{{if .IsClosed}}
 									{{svg "octicon-clock"}} {{$.locale.Tr "repo.milestones.closed" $closedDate|Str2html}}
 								{{else}}
diff --git a/templates/user/notification/notification_div.tmpl b/templates/user/notification/notification_div.tmpl
index 6dce7f751b..192652d06b 100644
--- a/templates/user/notification/notification_div.tmpl
+++ b/templates/user/notification/notification_div.tmpl
@@ -2,7 +2,7 @@
 	<div class="ui container">
 		<h1 class="ui dividing header">{{.locale.Tr "notification.notifications"}}</h1>
 		<div class="ui top attached tabular menu">
-			{{ $notificationUnreadCount := call .NotificationUnreadCount}}
+			{{$notificationUnreadCount := call .NotificationUnreadCount}}
 			<a href="{{AppSubUrl}}/notifications?q=unread" class="{{if eq .Status 1}}active{{end}} item">
 				{{.locale.Tr "notification.unread"}}
 				<div class="ui label {{if not $notificationUnreadCount}}hidden{{end}}">{{$notificationUnreadCount}}</div>
diff --git a/templates/user/settings/account.tmpl b/templates/user/settings/account.tmpl
index 53fd25313a..3070e8889c 100644
--- a/templates/user/settings/account.tmpl
+++ b/templates/user/settings/account.tmpl
@@ -139,9 +139,9 @@
 		<div class="ui attached error segment">
 			<div class="ui red message">
 				<p class="text left">{{svg "octicon-alert"}} {{.locale.Tr "settings.delete_prompt" | Str2html}}</p>
-				{{ if .UserDeleteWithComments }}
+				{{if .UserDeleteWithComments}}
 				<p class="text left" style="font-weight: bold;">{{.locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime | Str2html}}</p>
-				{{ end }}
+				{{end}}
 			</div>
 			<form class="ui form ignore-dirty" id="delete-form" action="{{AppSubUrl}}/user/settings/account/delete" method="post">
 				{{template "base/disable_form_autofill"}}
diff --git a/templates/user/settings/applications_oauth2.tmpl b/templates/user/settings/applications_oauth2.tmpl
index 424060d2e0..5e53ed00ca 100644
--- a/templates/user/settings/applications_oauth2.tmpl
+++ b/templates/user/settings/applications_oauth2.tmpl
@@ -29,7 +29,7 @@
 </div>
 <div class="ui attached bottom segment">
 	<h5 class="ui top header">
-		{{.locale.Tr "settings.create_oauth2_application" }}
+		{{.locale.Tr "settings.create_oauth2_application"}}
 	</h5>
 	<form class="ui form ignore-dirty" action="{{.Link}}/oauth2" method="post">
 		{{.CsrfTokenHtml}}
diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl
index 7e0158a5f1..bcab968d59 100644
--- a/templates/user/settings/keys_ssh.tmpl
+++ b/templates/user/settings/keys_ssh.tmpl
@@ -1,7 +1,7 @@
 <h4 class="ui top attached header">
 	{{.locale.Tr "settings.manage_ssh_keys"}}
 	<div class="ui right">
-		{{if not .DisableSSH }}
+		{{if not .DisableSSH}}
 			<div id="add-ssh-button" class="ui primary tiny show-panel button" data-panel="#add-ssh-key-panel">
 				{{.locale.Tr "settings.add_key"}}
 			</div>
diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl
index aedff91de9..54ea7ad2e1 100644
--- a/templates/user/settings/repos.tmpl
+++ b/templates/user/settings/repos.tmpl
@@ -11,7 +11,7 @@
 				{{if .Dirs}}
 					<div class="ui middle aligned divided list">
 						{{range $dirI, $dir := .Dirs}}
-							{{ $repo := index $.ReposMap $dir}}
+							{{$repo := index $.ReposMap $dir}}
 							<div class="item">
 								<div class="content">
 									{{if $repo}}
diff --git a/templates/user/settings/security/twofa.tmpl b/templates/user/settings/security/twofa.tmpl
index 3d2f78ed0d..a4da947628 100644
--- a/templates/user/settings/security/twofa.tmpl
+++ b/templates/user/settings/security/twofa.tmpl
@@ -4,7 +4,7 @@
 <div class="ui attached segment">
 	<p>{{.locale.Tr "settings.twofa_desc"}}</p>
 	{{if .TOTPEnrolled}}
-	<p>{{$.locale.Tr "settings.twofa_is_enrolled" | Str2html }}</p>
+	<p>{{$.locale.Tr "settings.twofa_is_enrolled" | Str2html}}</p>
 	<form class="ui form" action="{{AppSubUrl}}/user/settings/security/two_factor/regenerate_scratch" method="post" enctype="multipart/form-data">
 		{{.CsrfTokenHtml}}
 		<p>{{.locale.Tr "settings.regenerate_scratch_token_desc"}}</p>