diff --git a/rhodecode/templates/admin/auth/auth_settings.mako b/rhodecode/templates/admin/auth/auth_settings.mako
--- a/rhodecode/templates/admin/auth/auth_settings.mako
+++ b/rhodecode/templates/admin/auth/auth_settings.mako
@@ -93,7 +93,7 @@
     var auth_plugins_input = $('#auth_plugins');
     var notEmpty = function(element, index, array) {
       return (element != "");
-    }
+    };
     var elems = auth_plugins_input.val().split(',').filter(notEmpty);
     var cur_button = e.currentTarget;
     var plugin_id = $(cur_button).attr('plugin_id');
diff --git a/rhodecode/templates/admin/integrations/list.mako b/rhodecode/templates/admin/integrations/list.mako
--- a/rhodecode/templates/admin/integrations/list.mako
+++ b/rhodecode/templates/admin/integrations/list.mako
@@ -243,7 +243,7 @@
         }
       });
     };
-  }
+  };
 
   $('.delete_integration_entry').on('click', function(e){
     e.preventDefault();
diff --git a/rhodecode/templates/admin/notifications/notifications.mako b/rhodecode/templates/admin/notifications/notifications.mako
--- a/rhodecode/templates/admin/notifications/notifications.mako
+++ b/rhodecode/templates/admin/notifications/notifications.mako
@@ -49,12 +49,12 @@ var run = function(){
   $('#notification_data').on('click','.delete-notification',function(e){
     var notification_id = e.currentTarget.id;
     deleteNotification(url_action,notification_id)
-  })
+  });
   $('#notification_data').on('click','.read-notification',function(e){
     var notification_id = e.currentTarget.id;
     readNotification(url_action,notification_id)
   })
-}
+};
 run();
 $('#mark_all_read').on('click',function(e){
     //set notifications as read
@@ -68,7 +68,7 @@ run();
         .fail(function(data, textStatus, errorThrown){
             alert("Error while saving notifications.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
         });
-})
+});
 
 var current_filter = $("${c.current_filter}");
 if (current_filter.length){
diff --git a/rhodecode/templates/admin/settings/settings_global.mako b/rhodecode/templates/admin/settings/settings_global.mako
--- a/rhodecode/templates/admin/settings/settings_global.mako
+++ b/rhodecode/templates/admin/settings/settings_global.mako
@@ -258,8 +258,7 @@ var post_old = post_cm.getValue();
 var get_data = function(type, old){
     var get_tmpl = function(tmpl_name){
         // unescape some stuff
-        var html = htmlEnDeCode.htmlDecode($('#'+tmpl_name+'_tmpl').html());
-        return html;
+        return htmlEnDeCode.htmlDecode($('#'+tmpl_name+'_tmpl').html());
     };
     return {
         '#': old,
diff --git a/rhodecode/templates/admin/users/user_add.mako b/rhodecode/templates/admin/users/user_add.mako
--- a/rhodecode/templates/admin/users/user_add.mako
+++ b/rhodecode/templates/admin/users/user_add.mako
@@ -136,9 +136,9 @@
         $('#username').focus();
 
         $('#generate_password').on('click', function(e){
-            var tmpl = "(${_('generated password:')} {0})"
-            var new_passwd = generatePassword(12)
-            $('#generate_password_preview').html(tmpl.format(new_passwd))
+            var tmpl = "(${_('generated password:')} {0})";
+            var new_passwd = generatePassword(12);
+            $('#generate_password_preview').html(tmpl.format(new_passwd));
             $('#password').val(new_passwd);
             $('#password_confirmation').val(new_passwd);
         })
diff --git a/rhodecode/templates/admin/users/user_edit_emails.mako b/rhodecode/templates/admin/users/user_edit_emails.mako
--- a/rhodecode/templates/admin/users/user_edit_emails.mako
+++ b/rhodecode/templates/admin/users/user_edit_emails.mako
@@ -10,7 +10,7 @@
             <tr>
             <td class="td-user">
                 ${base.gravatar(c.user.email, 16)}
-                <span class="user email">${c.user.email}
+                <span class="user email">${c.user.email}</span>
             </td>
             <td class="td-tags">
                 <span class="tag">${_('Primary')}</span>
diff --git a/rhodecode/templates/changelog/changelog.mako b/rhodecode/templates/changelog/changelog.mako
--- a/rhodecode/templates/changelog/changelog.mako
+++ b/rhodecode/templates/changelog/changelog.mako
@@ -47,8 +47,8 @@
                                 target_repo=c.repo_name,
                                 target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],
                                 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
-                                merge=1)
-                            }">
+                                merge=1)}"
+                        >
                                 <i class="icon-loop"></i>
                                 ${_('Compare fork with Parent (%s)' % c.rhodecode_db_repo.fork.repo_name)}
                         </a>
@@ -285,7 +285,7 @@
             $commitCheckboxes.on('click', checkboxRangeSelector);
 
             $commitRangeClear.on('click',function(e) {
-                $commitCheckboxes.attr('checked', false)
+                $commitCheckboxes.attr('checked', false);
                 checkboxRangeSelector();
                 e.preventDefault();
             });
diff --git a/rhodecode/templates/changeset/changeset.mako b/rhodecode/templates/changeset/changeset.mako
--- a/rhodecode/templates/changeset/changeset.mako
+++ b/rhodecode/templates/changeset/changeset.mako
@@ -243,7 +243,7 @@
                                   .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
                                   .replace('__title__', data.results[0].message)
                                   .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id}));
-                          _html +=' | '
+                          _html +=' | ';
                           _html +='<a title="__title__" href="__url__">__rev__</a> '
                                   .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
                                   .replace('__title__', data.results[1].message)
@@ -279,7 +279,7 @@
                                   .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
                                   .replace('__title__', data.results[0].message)
                                   .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id}));
-                          _html +=' | '
+                          _html +=' | ';
                           _html +='<a title="__title__" href="__url__">Parent __rev__</a>'
                                   .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
                                   .replace('__title__', data.results[1].message)
diff --git a/rhodecode/templates/changeset/changeset_file_comment.mako b/rhodecode/templates/changeset/changeset_file_comment.mako
--- a/rhodecode/templates/changeset/changeset_file_comment.mako
+++ b/rhodecode/templates/changeset/changeset_file_comment.mako
@@ -170,8 +170,7 @@
                              ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
                                ('<span  class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
                            )
-                        )|n
-                       }
+                        )|n}
                     </div>
                 </div>
             </div>
diff --git a/rhodecode/templates/changeset/diff_block.mako b/rhodecode/templates/changeset/diff_block.mako
--- a/rhodecode/templates/changeset/diff_block.mako
+++ b/rhodecode/templates/changeset/diff_block.mako
@@ -12,14 +12,14 @@
 
 <%def name="diff_block_changeset_table(change)">
  <div class="diff-container" id="${'diff-container-%s' % (id(change))}">
-  %for FID,(cs1, cs2, change, filenode_path, diff, stats, file) in change.iteritems():
+  %for FID,(cs1, cs2, change, filenode_path, diff, stats, file_data) in change.iteritems():
     <div id="${h.FID('',filenode_path)}_target" ></div>
     <div id="${h.FID('',filenode_path)}" class="diffblock margined comm">
       <div class="code-body">
         <div class="full_f_path" path="${h.safe_unicode(filenode_path)}" style="display: none"></div>
         ${diff|n}
-          % if file["is_limited_diff"]:
-            % if file["exceeds_limit"]:
+          % if file_data["is_limited_diff"]:
+            % if file_data["exceeds_limit"]:
                 ${self.file_message()}
               % else:
                 <h5>${_('Diff was truncated. File content available only in full diff.')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5>
@@ -33,14 +33,14 @@
 
 <%def name="diff_block_simple(change)">
  <div class="diff-container" id="${'diff-container-%s' % (id(change))}">
-  %for op,filenode_path,diff,file in change:
+  %for op,filenode_path,diff,file_data in change:
     <div id="${h.FID('',filenode_path)}_target" ></div>
     <div id="${h.FID('',filenode_path)}" class="diffblock margined comm" >
         <div class="code-body">
             <div class="full_f_path" path="${h.safe_unicode(filenode_path)}" style="display: none;"></div>
             ${diff|n}
-           % if file["is_limited_diff"]:
-              % if file["exceeds_limit"]:
+           % if file_data["is_limited_diff"]:
+              % if file_data["exceeds_limit"]:
                   ${self.file_message()}
                 % else:
                   <h5>${_('Diff was truncated. File content available only in full diff.')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5>
diff --git a/rhodecode/templates/codeblocks/diffs.mako b/rhodecode/templates/codeblocks/diffs.mako
--- a/rhodecode/templates/codeblocks/diffs.mako
+++ b/rhodecode/templates/codeblocks/diffs.mako
@@ -2,26 +2,32 @@
 return '%s_%s_%i' % (h.safeid(filename), type, line)
 %></%def>
 
-<%def name="action_class(action)"><%
+<%def name="action_class(action)">
+<%
     return {
         '-': 'cb-deletion',
         '+': 'cb-addition',
         ' ': 'cb-context',
         }.get(action, 'cb-empty')
-%></%def>
+%>
+</%def>
 
-<%def name="op_class(op_id)"><%
+<%def name="op_class(op_id)">
+<%
     return {
         DEL_FILENODE: 'deletion', # file deleted
         BIN_FILENODE: 'warning' # binary diff hidden
     }.get(op_id, 'addition')
-%></%def>
+%>
+</%def>
 
-<%def name="link_for(**kw)"><%
+<%def name="link_for(**kw)">
+<%
 new_args = request.GET.mixed()
 new_args.update(kw)
 return h.url('', **new_args)
-%></%def>
+%>
+</%def>
 
 <%def name="render_diffset(diffset, commit=None,
 
@@ -83,8 +89,7 @@ return h.url('', **new_args)
                              ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
                                ('<span  class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
                            )
-                        )|n
-                       }
+                        )|n}
                     </div>
                 </div>
             </div>
@@ -370,8 +375,9 @@ from rhodecode.lib.diffs import NEW_FILE
 %>
     <span class="pill">
         %if filediff.source_file_path and filediff.target_file_path:
-            %if filediff.source_file_path != filediff.target_file_path: # file was renamed
-                  <strong>${filediff.target_file_path}</strong> ⬅ <del>${filediff.source_file_path}</del>
+            %if filediff.source_file_path != filediff.target_file_path:
+                 ## file was renamed
+                 <strong>${filediff.target_file_path}</strong> ⬅ <del>${filediff.source_file_path}</del>
             %else:
                 ## file was modified
                 <strong>${filediff.source_file_path}</strong>
diff --git a/rhodecode/templates/codeblocks/source.mako b/rhodecode/templates/codeblocks/source.mako
--- a/rhodecode/templates/codeblocks/source.mako
+++ b/rhodecode/templates/codeblocks/source.mako
@@ -42,9 +42,7 @@
         title="Author: ${annotation.author | entity}<br>Date: ${annotation.date}<br>Message: ${annotation.message | entity}"
     >
       ${h.gravatar_with_user(annotation.author, 16) | n}
-      <strong class="cb-annotate-message">${
-          h.truncate(annotation.message, len(lines) * 30)
-      }</strong>
+      <strong class="cb-annotate-message">${h.truncate(annotation.message, len(lines) * 30)}</strong>
     </td>
     <td
       class="cb-annotate-revision"
diff --git a/rhodecode/templates/debug_style/code-block.html b/rhodecode/templates/debug_style/code-block.html
--- a/rhodecode/templates/debug_style/code-block.html
+++ b/rhodecode/templates/debug_style/code-block.html
@@ -1140,7 +1140,7 @@ with multiple lines</p>
         var val = e.currentTarget.checked;
         $('#compare').mergely('options', {ignorews: val});
         $('#compare').mergely('update');
-    })
+    });
     $('#edit_mode').change(function(e){
         var val = !e.currentTarget.checked;
         $('#compare').mergely('cm', 'lhs').setOption('readOnly', val);
diff --git a/rhodecode/templates/debug_style/tables.html b/rhodecode/templates/debug_style/tables.html
--- a/rhodecode/templates/debug_style/tables.html
+++ b/rhodecode/templates/debug_style/tables.html
@@ -361,7 +361,7 @@
         </tbody>
       </table>
         <script type="text/javascript">
-            var cache = {}
+            var cache = {};
             $('.expand_commit').on('click',function(e){
               var target_expand = $(this);
               var cid = target_expand.data('commitId');
diff --git a/rhodecode/templates/email_templates/main.mako b/rhodecode/templates/email_templates/main.mako
--- a/rhodecode/templates/email_templates/main.mako
+++ b/rhodecode/templates/email_templates/main.mako
@@ -15,7 +15,7 @@
 ## BODY GOES BELOW
 <table style="text-align:left;vertical-align:top;">
     <tr><td style="padding-right:20px;padding-top:15px;white-space:pre-wrap">${body}</td></tr>
-</table
+</table>
 <p><a style="margin-top:15px;margin-left:1%;font-family:sans-serif;font-weight:100;font-size:11px;display:block;color:#666666;text-decoration:none;" href="${instance_url}">
     ${self.plaintext_footer()}
 </a></p>
\ No newline at end of file
diff --git a/rhodecode/templates/email_templates/user_registration.mako b/rhodecode/templates/email_templates/user_registration.mako
--- a/rhodecode/templates/email_templates/user_registration.mako
+++ b/rhodecode/templates/email_templates/user_registration.mako
@@ -19,7 +19,7 @@ A new user `${user.username}` has regist
 
 ## BODY GOES BELOW
 <table style="text-align:left;vertical-align:middle;">
-    <tr><td colspan="2" style="width:100%;padding-bottom:15px;border-bottom:1px solid #dbd9da;"><h4><a href="${h.url('user_profile', username=user.username, qualified=True)}" style="color:#427cc9;text-decoration:none;cursor:pointer">${_('New user %(user)s has registered on %(date)s') % {'user': user.username, 'date': h.format_date(date)}}</h4></td></tr>
+    <tr><td colspan="2" style="width:100%;padding-bottom:15px;border-bottom:1px solid #dbd9da;"><h4><a href="${h.url('user_profile', username=user.username, qualified=True)}" style="color:#427cc9;text-decoration:none;cursor:pointer">${_('New user %(user)s has registered on %(date)s') % {'user': user.username, 'date': h.format_date(date)}}</a></h4></td></tr>
     <tr><td style="padding-right:20px;padding-top:20px;">${_('Username')}</td><td style="line-height:1;padding-top:20px;"><img style="margin-bottom:-5px;text-align:left;border:1px solid #dbd9da" src="${h.gravatar_url(user.email, 16)}" height="16" width="16">&nbsp;${user.username}</td></tr>
     <tr><td style="padding-right:20px;">${_('Full Name')}</td><td>${user.firstname} ${user.lastname}</td></tr>
     <tr><td style="padding-right:20px;">${_('Email')}</td><td>${user.email}</td></tr>
diff --git a/rhodecode/templates/password_reset.mako b/rhodecode/templates/password_reset.mako
--- a/rhodecode/templates/password_reset.mako
+++ b/rhodecode/templates/password_reset.mako
@@ -56,7 +56,7 @@
                         %endif
     
                         %if captcha_active:
-                        <div class="login-captcha"
+                        <div class="login-captcha">
                             <label for="email">${_('Captcha')}:</label>
                             ${h.hidden('recaptcha_field')}
                             <div id="recaptcha"></div>
diff --git a/rhodecode/templates/pullrequests/pullrequest_show.mako b/rhodecode/templates/pullrequests/pullrequest_show.mako
--- a/rhodecode/templates/pullrequests/pullrequest_show.mako
+++ b/rhodecode/templates/pullrequests/pullrequest_show.mako
@@ -28,6 +28,7 @@
 </%def>
 
 <%def name="main()">
+
 <script type="text/javascript">
     // TODO: marcink switch this to pyroutes
     AJAX_COMMENT_DELETE_URL = "${url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}";
@@ -40,10 +41,9 @@
 
   ${self.breadcrumbs()}
 
-
   <div class="box pr-summary">
       <div class="summary-details block-left">
-        <%summary = lambda n:{False:'summary-short'}.get(n)%>
+        <% summary = lambda n:{False:'summary-short'}.get(n) %>
         <div class="pr-details-title">
             <a href="${h.url('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request #%s') % c.pull_request.pull_request_id}</a> ${_('From')} ${h.format_date(c.pull_request.created_on)}
             %if c.allowed_to_update:
@@ -432,7 +432,7 @@ Changed files:
                 </div>
               % if not c.missing_commits:
                 <%include file="/compare/compare_commits.mako" />
-              <div class="cs_files">
+                <div class="cs_files">
                 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
                 ${cbdiffs.render_diffset_menu()}
                 ${cbdiffs.render_diffset(
@@ -441,8 +441,9 @@ Changed files:
                   disable_new_comments=not c.allowed_to_comment,
                   deleted_files_comments=c.deleted_files_comments)}
 
+              </div>
+              % endif
           </div>
-              % endif
       </div>
 
       ## template for inline comment form
diff --git a/rhodecode/templates/search/search_content.mako b/rhodecode/templates/search/search_content.mako
--- a/rhodecode/templates/search/search_content.mako
+++ b/rhodecode/templates/search/search_content.mako
@@ -31,7 +31,7 @@ for line_number in matching_lines:
 %if len(matching_lines) > shown_matching_lines:
 <a href="${url}">
   ${len(matching_lines) - shown_matching_lines} ${_('more matches in this file')}
-</p>
+</a>
 %endif
 </%def>
 
diff --git a/rhodecode/templates/summary/components.mako b/rhodecode/templates/summary/components.mako
--- a/rhodecode/templates/summary/components.mako
+++ b/rhodecode/templates/summary/components.mako
@@ -88,7 +88,7 @@
           <div class="right-content">
 
               <div class="repo-size">
-                  <%commit_rev = c.rhodecode_db_repo.changeset_cache.get('revision')%>
+                  <% commit_rev = c.rhodecode_db_repo.changeset_cache.get('revision') %>
 
                   ## commits
                   % if commit_rev == -1:
diff --git a/rhodecode/templates/summary/summary.mako b/rhodecode/templates/summary/summary.mako
--- a/rhodecode/templates/summary/summary.mako
+++ b/rhodecode/templates/summary/summary.mako
@@ -14,11 +14,10 @@
     <ul class="links icon-only-links block-right">
       <li>
      %if c.rhodecode_user.username != h.DEFAULT_USER:
-       <a href="${h.url('atom_feed_home',repo_name=c.rhodecode_db_repo.repo_name,auth_token=c.rhodecode_user.feed_token)}" title="${_('RSS Feed')}">
+       <a href="${h.url('atom_feed_home',repo_name=c.rhodecode_db_repo.repo_name,auth_token=c.rhodecode_user.feed_token)}" title="${_('RSS Feed')}"><i class="icon-rss-sign"></i></a>
      %else:
-       <a href="${h.url('atom_feed_home',repo_name=c.rhodecode_db_repo.repo_name)}" title="${_('RSS Feed')}">
+       <a href="${h.url('atom_feed_home',repo_name=c.rhodecode_db_repo.repo_name)}" title="${_('RSS Feed')}"><i class="icon-rss-sign"></i></a>
      %endif
-       <i class="icon-rss-sign"></i></a>
       </li>
     </ul>
 </div>
@@ -97,9 +96,9 @@
         // format of Object {text: "v0.0.3", type: "tag", id: "rev"}
         var selected_cs = e.added;
         var fname= e.added.raw_id + ".zip";
-        var href = pyroutes.url('files_archive_home', {'repo_name': templateContext.repo_name, 'fname':fname})
+        var href = pyroutes.url('files_archive_home', {'repo_name': templateContext.repo_name, 'fname':fname});
         // set new label
-        $('#archive_link').html('<i class="icon-archive"></i> '+ e.added.text+".zip")
+        $('#archive_link').html('<i class="icon-archive"></i> '+ e.added.text+".zip");
 
         // set new url to button,
         $('#archive_link').attr('href', href)