edgewall/trac

View on GitHub
trac/ticket/roadmap.py

Summary

Maintainability
F
1 wk
Test Coverage

File roadmap.py has 952 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# Copyright (C) 2004-2023 Edgewall Software
# Copyright (C) 2004-2005 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2006-2007 Christian Boos <cboos@edgewall.org>
Severity: Major
Found in trac/ticket/roadmap.py - About 2 days to fix

    Function _render_ics has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        def _render_ics(self, req, milestones):
            req.send_response(200)
            req.send_header('Content-Type', 'text/calendar;charset=utf-8')
            buf = io.StringIO()
    
    
    Severity: Minor
    Found in trac/ticket/roadmap.py - About 6 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 save_milestone has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def save_milestone(self, req, milestone):
            # Instead of raising one single error, check all the constraints
            # and let the user fix them by going back to edit mode and showing
            # the warnings
            warnings = []
    Severity: Minor
    Found in trac/ticket/roadmap.py - About 4 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 get_ticket_group_stats has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_ticket_group_stats(self, ticket_ids):
            total_cnt = len(ticket_ids)
            all_statuses = set(TicketSystem(self.env).get_all_status())
            status_cnt = {}
            for s in all_statuses:
    Severity: Minor
    Found in trac/ticket/roadmap.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

    Function grouped_stats_data has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def grouped_stats_data(env, stats_provider, tickets, by, per_group_stats_data):
        """Get the `tickets` stats data grouped by ticket field `by`.
    
        `per_group_stats_data(gstat, group_name)` should return a data dict to
        include for the group with field value `group_name`.
    Severity: Minor
    Found in trac/ticket/roadmap.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

    Function _render_link has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def _render_link(self, context, name, label, extra=''):
            if not (name or extra):
                return tag()
            try:
                milestone = Milestone(self.env, name)
    Severity: Minor
    Found in trac/ticket/roadmap.py - About 2 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

    MilestoneModule has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MilestoneModule(Component):
        """View and edit individual milestones."""
    
        implements(INavigationContributor, IPermissionRequestor, IRequestHandler,
                   IResourceManager, ISearchSource, ITimelineEventProvider,
    Severity: Minor
    Found in trac/ticket/roadmap.py - About 2 hrs to fix

      Function get_search_results has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_search_results(self, req, terms, filters):
              if 'milestone' not in filters:
                  return
              term_regexps = search_to_regexps(terms)
              milestone_realm = Resource(self.realm)
      Severity: Minor
      Found in trac/ticket/roadmap.py - About 2 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 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_request(self, req):
              milestone_id = req.args.get('id')
              action = req.args.get('action', 'view')
              if not milestone_id and action == 'view':
                  req.redirect(req.href.roadmap())
      Severity: Minor
      Found in trac/ticket/roadmap.py - About 2 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_view has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def _render_view(self, req, milestone):
              milestone_groups = []
              available_groups = []
              default_group_by_available = False
              ticket_fields = TicketSystem(self.env).get_ticket_fields()
      Severity: Minor
      Found in trac/ticket/roadmap.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 get_timeline_events has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_timeline_events(self, req, start, stop, filters):
              if 'milestone' in filters:
                  milestone_realm = Resource(self.realm)
                  for name, due, completed, description \
                          in MilestoneCache(self.env).milestones.values():
      Severity: Minor
      Found in trac/ticket/roadmap.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 _render_ics has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _render_ics(self, req, milestones):
              req.send_response(200)
              req.send_header('Content-Type', 'text/calendar;charset=utf-8')
              buf = io.StringIO()
      
      
      Severity: Minor
      Found in trac/ticket/roadmap.py - About 1 hr to fix

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

        def milestone_stats_data(env, req, stat, name, grouped_by='component',
        Severity: Minor
        Found in trac/ticket/roadmap.py - About 45 mins to fix

          Function add_interval has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def add_interval(self, title, count, qry_args, css_class,
          Severity: Minor
          Found in trac/ticket/roadmap.py - About 35 mins to fix

            Function grouped_stats_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def grouped_stats_data(env, stats_provider, tickets, by, per_group_stats_data):
            Severity: Minor
            Found in trac/ticket/roadmap.py - About 35 mins to fix

              Function _get_ticket_groups has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _get_ticket_groups(self):
                      """Returns a list of dict describing the ticket groups
                      in the expected order of appearance in the milestone progress bars.
                      """
                      if 'milestone-groups' in self.config:
              Severity: Minor
              Found in trac/ticket/roadmap.py - About 35 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 ''
              Severity: Major
              Found in trac/ticket/roadmap.py - About 30 mins to fix

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

                    def process_request(self, req):
                        req.perm.require('ROADMAP_VIEW')
                
                        show = req.args.getlist('show')
                        if 'all' in show:
                Severity: Minor
                Found in trac/ticket/roadmap.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

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

                def group_milestones(milestones, include_completed):
                    """Group milestones into "open with due date", "open with no due date",
                    and possibly "completed". Return a list of (label, milestones) tuples."""
                    def category(m):
                        return 1 if m.is_completed else 2 if m.due else 3
                Severity: Minor
                Found in trac/ticket/roadmap.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

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

                    def refresh_calcs(self):
                        if self.count < 1:
                            return
                        total_percent = 0
                        self.done_percent = 0
                Severity: Minor
                Found in trac/ticket/roadmap.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 3 locations. Consider refactoring.
                Open

                            try:
                                NotificationSystem(self.env).notify(event)
                            except Exception as e:
                                self.log.error("Failure sending notification on ticket batch "
                                               "change: %s", exception_to_unicode(e))
                Severity: Major
                Found in trac/ticket/roadmap.py and 2 other locations - About 2 hrs to fix
                trac/ticket/batch.py on lines 224..232
                trac/ticket/roadmap.py on lines 868..877

                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 60.

                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

                                try:
                                    NotificationSystem(self.env).notify(event)
                                except Exception as e:
                                    self.log.error("Failure sending notification on ticket "
                                                   "batch change: %s",
                Severity: Major
                Found in trac/ticket/roadmap.py and 2 other locations - About 2 hrs to fix
                trac/ticket/batch.py on lines 224..232
                trac/ticket/roadmap.py on lines 927..935

                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 60.

                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

                    def match_request(self, req):
                        match = re.match(r'/milestone(?:/(.+))?$', req.path_info)
                        if match:
                            if match.group(1):
                                req.args['id'] = match.group(1)
                Severity: Major
                Found in trac/ticket/roadmap.py and 1 other location - About 2 hrs to fix
                trac/wiki/intertrac.py on lines 62..67

                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 57.

                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

                    def get_navigation_items(self, req):
                        if 'ROADMAP_VIEW' in req.perm:
                            yield ('mainnav', 'roadmap',
                                   tag.a(_('Roadmap'), href=req.href.roadmap(),
                                         accesskey=accesskey(req, 3)))
                Severity: Major
                Found in trac/ticket/roadmap.py and 1 other location - About 2 hrs to fix
                trac/search/web_ui.py on lines 69..73

                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 56.

                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

                            milestones = [m for m in Milestone.select(self.env)
                                          if m.name != milestone.name
                                          and 'MILESTONE_VIEW' in req.perm(m.resource)]
                Severity: Major
                Found in trac/ticket/roadmap.py and 1 other location - About 2 hrs to fix
                trac/ticket/roadmap.py on lines 953..955

                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 52.

                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

                        milestones = [m for m in Milestone.select(self.env)
                                      if m.name != milestone.name
                                      and 'MILESTONE_VIEW' in req.perm(m.resource)]
                Severity: Major
                Found in trac/ticket/roadmap.py and 1 other location - About 2 hrs to fix
                trac/ticket/roadmap.py on lines 978..980

                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 52.

                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

                                    elif milestone.is_late:
                                        title = _("%(duration)s late (%(date)s)",
                                                  duration=pretty_timedelta(milestone.due),
                                                  date=user_time(context.req, format_datetime,
                                                                 milestone.due))
                Severity: Minor
                Found in trac/ticket/roadmap.py and 2 other locations - About 30 mins to fix
                trac/ticket/roadmap.py on lines 1101..1106
                trac/ticket/roadmap.py on lines 1112..1116

                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 32.

                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

                                    elif milestone.due:
                                        title = _("Due in %(duration)s (%(date)s)",
                                                  duration=pretty_timedelta(milestone.due),
                                                  date=user_time(context.req, format_datetime,
                                                                 milestone.due))
                Severity: Minor
                Found in trac/ticket/roadmap.py and 2 other locations - About 30 mins to fix
                trac/ticket/roadmap.py on lines 1101..1106
                trac/ticket/roadmap.py on lines 1107..1111

                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 32.

                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

                                    if milestone.is_completed:
                                        title = _(
                                            "Completed %(duration)s ago (%(date)s)",
                                            duration=pretty_timedelta(milestone.completed),
                                            date=user_time(context.req, format_datetime,
                Severity: Minor
                Found in trac/ticket/roadmap.py and 2 other locations - About 30 mins to fix
                trac/ticket/roadmap.py on lines 1107..1111
                trac/ticket/roadmap.py on lines 1112..1116

                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 32.

                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

                            elif action == 'edit':
                                return self._do_save(req, milestone)
                            elif action == 'delete':
                                self._do_delete(req, milestone)
                            else:
                Severity: Minor
                Found in trac/ticket/roadmap.py and 1 other location - About 30 mins to fix
                trac/attachment.py on lines 216..221

                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 32.

                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