edgewall/trac

View on GitHub
trac/wiki/web_ui.py

Summary

Maintainability
F
1 wk
Test Coverage

File web_ui.py has 690 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2023 Edgewall Software
# Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2004-2005 Christopher Lenz <cmlenz@gmx.de>
Severity: Major
Found in trac/wiki/web_ui.py - About 1 day to fix

    Function _render_view has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

        def _render_view(self, req, page):
            version = page.resource.version
    
            # Add registered converters
            if page.exists:
    Severity: Minor
    Found in trac/wiki/web_ui.py - About 7 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _render_editor has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def _render_editor(self, req, page, action='edit', has_collision=False):
            if has_collision:
                if action == 'merge':
                    page = WikiPage(self.env, page.name)
                    req.perm(page.resource).require('WIKI_VIEW')
    Severity: Minor
    Found in trac/wiki/web_ui.py - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function process_request has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_request(self, req):
            action = req.args.get('action', 'view')
            pagename = req.args.get('page', self.START_PAGE)
            version = None
            if req.args.get('version'):  # Allow version to be empty
    Severity: Minor
    Found in trac/wiki/web_ui.py - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _render_diff has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def _render_diff(self, req, page):
            if not page.exists:
                raise TracError(_("Version %(num)s of page \"%(name)s\" does not "
                                  "exist",
                                  num=req.args.get('version'), name=page.name))
    Severity: Minor
    Found in trac/wiki/web_ui.py - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    WikiModule has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class WikiModule(Component):
    
        implements(IContentConverter, INavigationContributor,
                   IPermissionRequestor, IRequestHandler, ITimelineEventProvider,
                   ISearchSource, ITemplateProvider)
    Severity: Minor
    Found in trac/wiki/web_ui.py - About 3 hrs to fix

      Function _render_confirm_delete has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def _render_confirm_delete(self, req, page):
              req.perm(page.resource).require('WIKI_DELETE')
      
              version = None
              if 'delete_version' in req.args:
      Severity: Minor
      Found in trac/wiki/web_ui.py - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function _do_delete has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _do_delete(self, req, page):
              req.perm(page.resource).require('WIKI_DELETE')
      
              if 'cancel' in req.args:
                  req.redirect(get_resource_url(self.env, page.resource, req.href))
      Severity: Minor
      Found in trac/wiki/web_ui.py - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function _do_rename has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _do_rename(self, req, page):
              req.perm(page.resource).require('WIKI_RENAME')
      
              if 'cancel' in req.args:
                  req.redirect(get_resource_url(self.env, page.resource, req.href))
      Severity: Minor
      Found in trac/wiki/web_ui.py - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function render_timeline_event has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def render_timeline_event(self, context, field, event):
              wiki_page, comment = event[3]
              if field == 'url':
                  return context.href.wiki(wiki_page.id, version=wiki_page.version)
              elif field == 'title':
      Severity: Minor
      Found in trac/wiki/web_ui.py - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Avoid deeply nested control flow statements.
      Open

                              if v < version:
                                  if not prev_version:
                                      prev_version = v
                                      break
                              else:
      Severity: Major
      Found in trac/wiki/web_ui.py - About 45 mins to fix

        Function get_timeline_events has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_timeline_events(self, req, start, stop, filters):
                if 'wiki' in filters:
                    wiki_realm = Resource(self.realm)
                    for ts, name, comment, author, version in self.env.db_query("""
                            SELECT time, name, comment, author, version FROM wiki
        Severity: Minor
        Found in trac/wiki/web_ui.py - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function _prepare_diff has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _prepare_diff(self, req, page, old_text, new_text,
        Severity: Minor
        Found in trac/wiki/web_ui.py - About 45 mins to fix

          Function _validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _validate(self, req, page):
                  valid = True
          
                  # Validate page size
                  if len(req.args.get('text', '')) > self.max_size:
          Severity: Minor
          Found in trac/wiki/web_ui.py - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function check_permission has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_permission(self, action, username, resource, perm):
                  if resource and resource.realm == self.realm:
                      if action == 'WIKI_CHANGE_READONLY':
                          return 'WIKI_ADMIN' in perm(resource)
                      if action in ('WIKI_DELETE', 'WIKI_MODIFY', 'WIKI_RENAME'):
          Severity: Minor
          Found in trac/wiki/web_ui.py - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Avoid too many return statements within this function.
          Open

                      return self._render_diff(req, versioned_page)
          Severity: Major
          Found in trac/wiki/web_ui.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return self._render_history(req, versioned_page)
            Severity: Major
            Found in trac/wiki/web_ui.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return self._render_editor(req, page)
              Severity: Major
              Found in trac/wiki/web_ui.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return self._render_view(req, versioned_page)
                Severity: Major
                Found in trac/wiki/web_ui.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return self._render_edit_comment(req, versioned_page)
                  Severity: Major
                  Found in trac/wiki/web_ui.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return self._render_confirm_rename(req, page)
                    Severity: Major
                    Found in trac/wiki/web_ui.py - About 30 mins to fix

                      Function _prepare_diff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _prepare_diff(self, req, page, old_text, new_text,
                                            old_version, new_version):
                              diff_style, diff_options, diff_data = get_diff_options(req)
                              diff_context = 3
                              for option in diff_options:
                      Severity: Minor
                      Found in trac/wiki/web_ui.py - About 25 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              for manipulator in self.page_manipulators:
                                  for field, message in manipulator.validate_wiki_page(req, page):
                                      valid = False
                                      if field:
                                          add_warning(req, tag_("The Wiki page field %(field)s"
                      Severity: Major
                      Found in trac/wiki/web_ui.py and 1 other location - About 4 hrs to fix
                      trac/attachment.py on lines 414..425

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 75.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if not page.exists:
                                  req.perm(page.resource).require('WIKI_CREATE')
                              else:
                                  req.perm(page.resource).require('WIKI_MODIFY')
                      Severity: Major
                      Found in trac/wiki/web_ui.py and 1 other location - About 1 hr to fix
                      trac/wiki/web_ui.py on lines 359..362

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 45.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if not page.exists:
                                  req.perm(page.resource).require('WIKI_CREATE')
                              else:
                                  req.perm(page.resource).require('WIKI_MODIFY')
                      Severity: Major
                      Found in trac/wiki/web_ui.py and 1 other location - About 1 hr to fix
                      trac/wiki/web_ui.py on lines 509..512

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 45.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if 'WIKI_VIEW' in req.perm('wiki', self.TITLE_INDEX_PAGE):
                                  add_ctxtnav(req, _("Index"), req.href.wiki(self.TITLE_INDEX_PAGE))
                      Severity: Major
                      Found in trac/wiki/web_ui.py and 1 other location - About 1 hr to fix
                      trac/wiki/web_ui.py on lines 742..743

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 42.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if 'WIKI_VIEW' in req.perm('wiki', self.START_PAGE):
                                  add_ctxtnav(req, _("Start Page"), req.href.wiki(self.START_PAGE))
                      Severity: Major
                      Found in trac/wiki/web_ui.py and 1 other location - About 1 hr to fix
                      trac/wiki/web_ui.py on lines 744..745

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 42.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if next_version:
                                  add_link(req, 'next', req.href.wiki(page.name, action='diff',
                                                                      version=next_version),
                                           _("Version %(num)s", num=next_version))
                      Severity: Major
                      Found in trac/wiki/web_ui.py and 1 other location - About 1 hr to fix
                      trac/wiki/web_ui.py on lines 475..478

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 39.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if prev_version:
                                  add_link(req, 'prev', req.href.wiki(page.name, action='diff',
                                                                      version=prev_version),
                                           _("Version %(num)s", num=prev_version))
                      Severity: Major
                      Found in trac/wiki/web_ui.py and 1 other location - About 1 hr to fix
                      trac/wiki/web_ui.py on lines 481..484

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 39.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if prev_version:
                                  add_link(req, 'prev',
                                           req.href.wiki(page.name, version=prev_version),
                                           _("Version %(num)s", num=prev_version))
                      Severity: Minor
                      Found in trac/wiki/web_ui.py and 1 other location - About 50 mins to fix
                      trac/wiki/web_ui.py on lines 704..707

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 36.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if next_version:
                                  add_link(req, 'next',
                                           req.href.wiki(page.name, version=next_version),
                                           _('Version %(num)s', num=next_version))
                      Severity: Minor
                      Found in trac/wiki/web_ui.py and 1 other location - About 50 mins to fix
                      trac/wiki/web_ui.py on lines 690..693

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 36.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if 'cancel' in req.args:
                                  req.redirect(get_resource_url(self.env, page.resource, req.href))
                      Severity: Minor
                      Found in trac/wiki/web_ui.py and 1 other location - About 35 mins to fix
                      trac/wiki/web_ui.py on lines 315..316

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 33.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if 'cancel' in req.args:
                                  req.redirect(get_resource_url(self.env, page.resource, req.href))
                      Severity: Minor
                      Found in trac/wiki/web_ui.py and 1 other location - About 35 mins to fix
                      trac/wiki/web_ui.py on lines 282..283

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 33.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      There are no issues that match your filters.

                      Category
                      Status