edgewall/trac

View on GitHub

Showing 1,372 of 1,372 total issues

Function extensionpoints_role has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def extensionpoints_role(name, rawtext, text, lineno, inliner, options={},
Severity: Major
Found in doc/conf.py - About 50 mins to fix

    Function teo_role has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def teo_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
    Severity: Major
    Found in doc/conf.py - About 50 mins to fix

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

                  return tag.a(label, class_='changeset',
                               title=shorten_line(changeset.message),
                               href=formatter.href.changeset(sha, repos.reponame))
      Severity: Minor
      Found in tracopt/versioncontrol/git/git_fs.py and 1 other location - About 50 mins to fix
      tracopt/versioncontrol/git/git_fs.py on lines 440..442

      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 leading:
              lines[::2] = (_ws_leading_re.sub('', line) for line in lines[::2])
      Severity: Minor
      Found in trac/util/text.py and 1 other location - About 50 mins to fix
      trac/util/text.py on lines 191..192

      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 3 locations. Consider refactoring.
      Open

          def __init__(self, filename, mode='r', bufsize=-1, encoding='utf-8',
                       errors='strict'):
              self.filename = filename
              self.mode = mode
              self.bufsize = bufsize
      Severity: Major
      Found in trac/util/__init__.py and 2 other locations - About 50 mins to fix
      trac/db/schema.py on lines 47..53
      trac/notification/api.py on lines 205..210

      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

      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 3 locations. Consider refactoring.
      Open

          def __init__(self, realm, category, target, time, author=""):
              self.realm = realm
              self.category = category
              self.target = target
              self.time = time
      Severity: Major
      Found in trac/notification/api.py and 2 other locations - About 50 mins to fix
      trac/db/schema.py on lines 47..53
      trac/util/__init__.py on lines 590..596

      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 trailing:
              lines[::2] = (_ws_trailing_re.sub('', line) for line in lines[::2])
      Severity: Minor
      Found in trac/util/text.py and 1 other location - About 50 mins to fix
      trac/util/text.py on lines 189..190

      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 3 locations. Consider refactoring.
      Open

          def __init__(self, name, type='text', size=None, key_size=None,
                       auto_increment=False):
              self.name = name
              self.type = type
              self.size = size
      Severity: Major
      Found in trac/db/schema.py and 2 other locations - About 50 mins to fix
      trac/notification/api.py on lines 205..210
      trac/util/__init__.py on lines 590..596

      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

                      return tag.a(label, class_='changeset',
                                   title=shorten_line(cset.message),
                                   href=context.href.changeset(sha, repos.reponame))
      Severity: Minor
      Found in tracopt/versioncontrol/git/git_fs.py and 1 other location - About 50 mins to fix
      tracopt/versioncontrol/git/git_fs.py on lines 286..288

      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

      Avoid deeply nested control flow statements.
      Open

                          if prev:
                              prev = 'equal', prev[1], i2, prev[3], j2
                          else:
                              prev = 'equal', i1, i2, j1, j2
                          continue
      Severity: Major
      Found in trac/versioncontrol/diff.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            for line in tolines[j1:j2]:
                                yield '+' + line
        
        
        Severity: Major
        Found in trac/versioncontrol/diff.py - About 45 mins to fix

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

              def annotate_row(self, context, row, lineno, line, blame_annotator):
          Severity: Minor
          Found in trac/versioncontrol/web_ui/browser.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if 'svn:executable' in props:
                                    kwargs['executable'] = True
                            elif node.isdir and path:
            Severity: Major
            Found in trac/versioncontrol/web_ui/util.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  with content_closing(
                                          node.get_processed_content(eol_hint='CRLF')) \
                                          as content:
                                      data = content.read()
                                  props = node.get_properties()
              Severity: Major
              Found in trac/versioncontrol/web_ui/util.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if ($('em', cells[2]).length) oldTag = newTag = "\\";
                Severity: Major
                Found in trac/htdocs/js/diff.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (value is not None
                                              or field in ('hidden', 'sync_per_request')) \
                                                  and value != info.get(field):
                                              changes[field] = value
                                      if 'dir' in changes and not \
                  Severity: Major
                  Found in trac/versioncontrol/admin.py - About 45 mins to fix

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

                        def get_repositories(self):
                            """Retrieve repositories specified in the repository DB table."""
                            repos = {}
                            for id, name, value in self.env.db_query(
                                    "SELECT id, name, value FROM repository WHERE name IN (%s)"
                    Severity: Minor
                    Found in trac/versioncontrol/api.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

                                            for name in sel:
                                                db_provider.remove_repository(name)
                                            add_notice(req, _('The selected repositories have '
                    Severity: Major
                    Found in trac/versioncontrol/admin.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language