torvalds/linux

View on GitHub
tools/power/pm-graph/bootgraph.py

Summary

Maintainability
F
1 wk
Test Coverage

File bootgraph.py has 937 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-only
#
# Tool for analyzing boot timing
# Copyright (c) 2013, Intel Corporation.
Severity: Major
Found in tools/power/pm-graph/bootgraph.py - About 2 days to fix

    Function parseTraceLog has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

    def parseTraceLog(data):
        sysvals.vprint('Analyzing the ftrace data (%s)...' % \
            os.path.basename(sysvals.ftracefile))
        # if available, calculate cgfilter allowable ranges
        cgfilter = []
    Severity: Minor
    Found in tools/power/pm-graph/bootgraph.py - About 1 day 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 createBootGraph has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

    def createBootGraph(data):
        # html function templates
        html_srccall = '<div id={6} title="{5}" class="srccall" style="left:{1}%;top:{2}px;height:{3}px;width:{4}%;line-height:{3}px;">{0}</div>\n'
        html_timetotal = '<table class="time1">\n<tr>'\
            '<td class="blue">Init process starts @ <b>{0} ms</b></td>'\
    Severity: Minor
    Found in tools/power/pm-graph/bootgraph.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 parseKernelLog has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    def parseKernelLog():
        sysvals.vprint('Analyzing the dmesg data (%s)...' % \
            os.path.basename(sysvals.dmesgfile))
        phase = 'kernel'
        data = Data(0)
    Severity: Minor
    Found in tools/power/pm-graph/bootgraph.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 deviceMatch has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def deviceMatch(self, pid, cg):
            if cg.end - cg.start == 0:
                return ''
            for p in data.phases:
                list = self.dmesg[p]['list']
    Severity: Minor
    Found in tools/power/pm-graph/bootgraph.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 updateGrub has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def updateGrub(restore=False):
        # call update-grub on restore
        if restore:
            try:
                call(sysvals.blexec, stderr=PIPE, stdout=PIPE,
    Severity: Minor
    Found in tools/power/pm-graph/bootgraph.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 updateCron has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def updateCron(restore=False):
        if not restore:
            sysvals.rootUser(True)
        crondir = '/var/spool/cron/crontabs/'
        if not os.path.exists(crondir):
    Severity: Minor
    Found in tools/power/pm-graph/bootgraph.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 setGraphFilter has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def setGraphFilter(self, val):
            master = self.getBootFtraceFilterFunctions()
            fs = ''
            for i in val.split(','):
                func = i.strip()
    Severity: Minor
    Found in tools/power/pm-graph/bootgraph.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 createBootGraph has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def createBootGraph(data):
        # html function templates
        html_srccall = '<div id={6} title="{5}" class="srccall" style="left:{1}%;top:{2}px;height:{3}px;width:{4}%;line-height:{3}px;">{0}</div>\n'
        html_timetotal = '<table class="time1">\n<tr>'\
            '<td class="blue">Init process starts @ <b>{0} ms</b></td>'\
    Severity: Minor
    Found in tools/power/pm-graph/bootgraph.py - About 1 hr to fix

      Function blGrub has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def blGrub(self):
              blcmd = ''
              for cmd in ['update-grub', 'grub-mkconfig', 'grub2-mkconfig']:
                  if blcmd:
                      break
      Severity: Minor
      Found in tools/power/pm-graph/bootgraph.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 cgOverview has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def cgOverview(cg, minlen):
          stats = dict()
          large = []
          for l in cg.list:
              if l.fcall and l.depth == 1:
      Severity: Minor
      Found in tools/power/pm-graph/bootgraph.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 newAction has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def newAction(self, phase, name, pid, start, end, ret, ulen):
      Severity: Major
      Found in tools/power/pm-graph/bootgraph.py - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if 'ftraces' not in dev:
                                    dev['ftraces'] = []
                                dev['ftraces'].append(cg)
        Severity: Major
        Found in tools/power/pm-graph/bootgraph.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          if(not cgskip):
                              doError('%s does not exist' % cgskip)
                  elif(arg == '-bl'):
          Severity: Major
          Found in tools/power/pm-graph/bootgraph.py - About 45 mins to fix

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

                def cronjobCmdString(self):
                    cmdline = '%s -cronjob' % os.path.abspath(sys.argv[0])
                    args = iter(sys.argv[1:])
                    for arg in args:
                        if arg in ['-h', '-v', '-cronjob', '-reboot', '-verbose']:
            Severity: Minor
            Found in tools/power/pm-graph/bootgraph.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

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

                    elif(arg == '-ftrace'):
                        try:
                            val = next(args)
                        except:
                            doError('No ftrace file supplied', True)
            Severity: Major
            Found in tools/power/pm-graph/bootgraph.py and 1 other location - About 3 hrs to fix
            tools/power/pm-graph/bootgraph.py on lines 972..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 66.

            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(arg == '-dmesg'):
                        try:
                            val = next(args)
                        except:
                            doError('No dmesg file supplied', True)
            Severity: Major
            Found in tools/power/pm-graph/bootgraph.py and 1 other location - About 3 hrs to fix
            tools/power/pm-graph/bootgraph.py on lines 959..967

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

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

                        if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
            Severity: Major
            Found in tools/power/pm-graph/bootgraph.py and 2 other locations - About 1 hr to fix
            tools/power/pm-graph/sleepgraph.py on lines 3342..3342
            tools/power/pm-graph/sleepgraph.py on lines 3800..3800

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

            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

                        width = '%.6f' % (((dev['end']-dev['start'])*100)/tTotal)
            Severity: Major
            Found in tools/power/pm-graph/bootgraph.py and 1 other location - About 1 hr to fix
            tools/power/pm-graph/sleepgraph.py on lines 4834..4834

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

            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 sysvals.testlog and sysvals.logmsg:
                    hf.write('<div id="testlog" style="display:none;">\n'+sysvals.logmsg+'</div>\n')
            Severity: Minor
            Found in tools/power/pm-graph/bootgraph.py and 1 other location - About 50 mins to fix
            tools/power/pm-graph/sleepgraph.py on lines 4933..4934

            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

                    elif(arg == '-o'):
                        try:
                            val = next(args)
                        except:
                            doError('No subdirectory name supplied', True)
            Severity: Minor
            Found in tools/power/pm-graph/bootgraph.py and 1 other location - About 50 mins to fix
            tools/power/pm-graph/sleepgraph.py on lines 6958..6963

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

                        left = '%.6f' % (((dev['start']-t0)*100)/tTotal)
            Severity: Major
            Found in tools/power/pm-graph/bootgraph.py and 4 other locations - About 45 mins to fix
            tools/power/pm-graph/bootgraph.py on lines 560..560
            tools/power/pm-graph/sleepgraph.py on lines 4800..4800
            tools/power/pm-graph/sleepgraph.py on lines 4833..4833
            tools/power/pm-graph/sleepgraph.py on lines 4913..4913

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

            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

                        length = ' (%0.3f ms) ' % ((dev['end']-dev['start'])*1000)
            Severity: Minor
            Found in tools/power/pm-graph/bootgraph.py and 1 other location - About 45 mins to fix
            tools/power/pm-graph/sleepgraph.py on lines 4835..4835

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

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

                    left = '%.3f' % (((phase['start']-t0)*100.0)/tTotal)
            Severity: Major
            Found in tools/power/pm-graph/bootgraph.py and 4 other locations - About 45 mins to fix
            tools/power/pm-graph/bootgraph.py on lines 580..580
            tools/power/pm-graph/sleepgraph.py on lines 4800..4800
            tools/power/pm-graph/sleepgraph.py on lines 4833..4833
            tools/power/pm-graph/sleepgraph.py on lines 4913..4913

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

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

                    elif(arg == '-cgfilter'):
                        try:
                            val = next(args)
                        except:
                            doError('No callgraph functions supplied', True)
            Severity: Major
            Found in tools/power/pm-graph/bootgraph.py and 3 other locations - About 30 mins to fix
            tools/power/pm-graph/sleepgraph.py on lines 6912..6917
            tools/power/pm-graph/sleepgraph.py on lines 6918..6923
            tools/power/pm-graph/sleepgraph.py on lines 7010..7015

            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

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

                    if(start >= 0 and end >= 0):
                        length = end - start
            Severity: Minor
            Found in tools/power/pm-graph/bootgraph.py and 1 other location - About 30 mins to fix
            tools/power/pm-graph/sleepgraph.py on lines 1981..1982

            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