torvalds/linux

View on GitHub
tools/perf/scripts/python/task-analyzer.py

Summary

Maintainability
F
1 wk
Test Coverage

File task-analyzer.py has 769 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# task-analyzer.py - comprehensive perf tasks analysis
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022, Hagen Paul Pfeifer <hagen@jauu.net>
# Licensed under the terms of the GNU GPL License version 2
#
Severity: Major
Found in tools/perf/scripts/python/task-analyzer.py - About 1 day to fix

    Function _argument_prepare_check has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def _argument_prepare_check():
        global time_unit, fd_task, fd_sum
        if args.filter_tasks:
            args.filter_tasks = args.filter_tasks.split(",")
        if args.limit_to_tasks:
    Severity: Minor
    Found in tools/perf/scripts/python/task-analyzer.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 sched__sched_switch has 16 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def sched__sched_switch(event_name, context, common_cpu, common_secs, common_nsecs,
    Severity: Major
    Found in tools/perf/scripts/python/task-analyzer.py - About 2 hrs to fix

      Function _argument_filter_sanity_check has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def _argument_filter_sanity_check():
          if args.limit_to_tasks and args.filter_tasks:
              sys.exit("Error: Filter and Limit at the same time active.")
          if args.extended_times and args.summary_only:
              sys.exit("Error: Summary only and extended times active.")
      Severity: Minor
      Found in tools/perf/scripts/python/task-analyzer.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 _is_within_timelimit has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def _is_within_timelimit(time):
          """
          Check if a time limit was given by parameter, if so ignore the rest. If not,
          process the recorded trace in its entirety.
          """
      Severity: Minor
      Found in tools/perf/scripts/python/task-analyzer.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 _calc_alignments_summary has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _calc_alignments_summary(self, align_helper):
              # Length is being cut in 3 groups so that further addition is easier to handle.
              # The length of every argument from the alignment helper is being checked if it
              # is longer than the longest until now. In that case the length is being saved.
              for key in db["task_info"]:
      Severity: Minor
      Found in tools/perf/scripts/python/task-analyzer.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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def __init__(self, pid, tid, comm, runs, acc, mean,
      Severity: Major
      Found in tools/perf/scripts/python/task-analyzer.py - About 1 hr to fix

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

        def _limit_filtered(tid, pid, comm):
            if args.filter_tasks:
                if str(tid) in args.filter_tasks or comm in args.filter_tasks:
                    return True
                else:
        Severity: Minor
        Found in tools/perf/scripts/python/task-analyzer.py - About 55 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

        def _print_task_finish(task):
            """calculating every entry of a row and printing it immediately"""
            c_row_set = ""
            c_row_reset = ""
            out_in = -1
        Severity: Minor
        Found in tools/perf/scripts/python/task-analyzer.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

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

            def _task_stats(self):
                """calculates the stats of every task and constructs the printable summary"""
                for tid in sorted(db["tid"]):
                    color_one_sample = _COLORS["grey"]
                    color_reset = _COLORS["reset"]
        Severity: Minor
        Found in tools/perf/scripts/python/task-analyzer.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

        def _record_by_cpu(task):
            cpu = task.cpu
            if cpu not in db["cpu"]:
                db["cpu"][cpu] = []
            db["cpu"][cpu].append(task)
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 1 other location - About 5 hrs to fix
        tools/perf/scripts/python/task-analyzer.py on lines 700..705

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

        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 _record_by_tid(task):
            tid = task.tid
            if tid not in db["tid"]:
                db["tid"][tid] = []
            db["tid"][tid].append(task)
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 1 other location - About 5 hrs to fix
        tools/perf/scripts/python/task-analyzer.py on lines 708..713

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

        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 args.summary_extended:
                    for key in db["inter_times"]:
                        if len(str(getattr(align_helper, key))) > db["inter_times"][key]:
                            db["inter_times"][key] = len(str(getattr(align_helper, key)))
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 2 other locations - About 4 hrs to fix
        tools/perf/scripts/python/task-analyzer.py on lines 506..508
        tools/perf/scripts/python/task-analyzer.py on lines 509..511

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

        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

                for key in db["task_info"]:
                    if len(str(getattr(align_helper, key))) > db["task_info"][key]:
                        db["task_info"][key] = len(str(getattr(align_helper, key)))
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 2 other locations - About 4 hrs to fix
        tools/perf/scripts/python/task-analyzer.py on lines 509..511
        tools/perf/scripts/python/task-analyzer.py on lines 512..515

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

        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

                for key in db["runtime_info"]:
                    if len(str(getattr(align_helper, key))) > db["runtime_info"][key]:
                        db["runtime_info"][key] = len(str(getattr(align_helper, key)))
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 2 other locations - About 4 hrs to fix
        tools/perf/scripts/python/task-analyzer.py on lines 506..508
        tools/perf/scripts/python/task-analyzer.py on lines 512..515

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

        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 args.filter_tasks:
                if str(tid) in args.filter_tasks or comm in args.filter_tasks:
                    return True
                else:
                    return False
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 1 other location - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 783..787

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 42.

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

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

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

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

        Refactorings

        Further Reading

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

            if args.limit_to_tasks:
                if str(tid) in args.limit_to_tasks or comm in args.limit_to_tasks:
                    return False
                else:
                    return True
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 1 other location - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 778..782

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 42.

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

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

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

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

        Refactorings

        Further Reading

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

                fmt += " {{:^{}}}".format(
                    sum(db["runtime_info"].values()) - 2 * decimal_precision
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 1 other location - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 337..338

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 39.

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

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

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

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

        Refactorings

        Further Reading

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

                    fmt += " {{:^{}}}".format(
                        sum(db["inter_times"].values()) - 4 * decimal_precision
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 1 other location - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 331..332

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 39.

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

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

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

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

        Refactorings

        Further Reading

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

                    fmt += "{}{{:>{}}}".format(
                        separator,
                        (db["inter_times"]["out_in"] - decimal_precision) * fix_csv_align
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 7 other locations - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 361..362
        tools/perf/scripts/python/task-analyzer.py on lines 364..365
        tools/perf/scripts/python/task-analyzer.py on lines 367..368
        tools/perf/scripts/python/task-analyzer.py on lines 380..382
        tools/perf/scripts/python/task-analyzer.py on lines 384..386
        tools/perf/scripts/python/task-analyzer.py on lines 388..390
        tools/perf/scripts/python/task-analyzer.py on lines 392..394

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

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

                    fmt += "{}{{:>{}}}".format(
                        separator,
                        (db["inter_times"]["in_out"] - decimal_precision) * fix_csv_align
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 7 other locations - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 361..362
        tools/perf/scripts/python/task-analyzer.py on lines 364..365
        tools/perf/scripts/python/task-analyzer.py on lines 367..368
        tools/perf/scripts/python/task-analyzer.py on lines 376..378
        tools/perf/scripts/python/task-analyzer.py on lines 380..382
        tools/perf/scripts/python/task-analyzer.py on lines 384..386
        tools/perf/scripts/python/task-analyzer.py on lines 388..390

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

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

                fmt += "{}{{:>{}}}".format(
                    separator, (db["runtime_info"]["min"] - decimal_precision) * fix_csv_align
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 7 other locations - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 364..365
        tools/perf/scripts/python/task-analyzer.py on lines 367..368
        tools/perf/scripts/python/task-analyzer.py on lines 376..378
        tools/perf/scripts/python/task-analyzer.py on lines 380..382
        tools/perf/scripts/python/task-analyzer.py on lines 384..386
        tools/perf/scripts/python/task-analyzer.py on lines 388..390
        tools/perf/scripts/python/task-analyzer.py on lines 392..394

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

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

                    fmt += "{}{{:>{}}}".format(
                        separator,
                        (db["inter_times"]["in_in"] - decimal_precision) * fix_csv_align
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 7 other locations - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 361..362
        tools/perf/scripts/python/task-analyzer.py on lines 364..365
        tools/perf/scripts/python/task-analyzer.py on lines 367..368
        tools/perf/scripts/python/task-analyzer.py on lines 376..378
        tools/perf/scripts/python/task-analyzer.py on lines 380..382
        tools/perf/scripts/python/task-analyzer.py on lines 384..386
        tools/perf/scripts/python/task-analyzer.py on lines 392..394

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

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

                fmt += "{}{{}}{{:>{}}}{{}}".format(
                    separator, (db["runtime_info"]["max_at"] - time_precision) * fix_csv_align
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 7 other locations - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 361..362
        tools/perf/scripts/python/task-analyzer.py on lines 364..365
        tools/perf/scripts/python/task-analyzer.py on lines 376..378
        tools/perf/scripts/python/task-analyzer.py on lines 380..382
        tools/perf/scripts/python/task-analyzer.py on lines 384..386
        tools/perf/scripts/python/task-analyzer.py on lines 388..390
        tools/perf/scripts/python/task-analyzer.py on lines 392..394

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

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

                    fmt += "{}{{:>{}}}".format(
                        separator,
                        (db["inter_times"]["out_out"] - decimal_precision) * fix_csv_align
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 7 other locations - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 361..362
        tools/perf/scripts/python/task-analyzer.py on lines 364..365
        tools/perf/scripts/python/task-analyzer.py on lines 367..368
        tools/perf/scripts/python/task-analyzer.py on lines 376..378
        tools/perf/scripts/python/task-analyzer.py on lines 380..382
        tools/perf/scripts/python/task-analyzer.py on lines 388..390
        tools/perf/scripts/python/task-analyzer.py on lines 392..394

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

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

                    fmt += "{}{{}}{{:>{}}}{{}}".format(
                        separator,
                        (db["inter_times"]["inter_at"] - time_precision) * fix_csv_align
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 7 other locations - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 361..362
        tools/perf/scripts/python/task-analyzer.py on lines 364..365
        tools/perf/scripts/python/task-analyzer.py on lines 367..368
        tools/perf/scripts/python/task-analyzer.py on lines 376..378
        tools/perf/scripts/python/task-analyzer.py on lines 384..386
        tools/perf/scripts/python/task-analyzer.py on lines 388..390
        tools/perf/scripts/python/task-analyzer.py on lines 392..394

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

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

                fmt += "{}{{:>{}}}".format(
                    separator, (db["runtime_info"]["max"] - decimal_precision) * fix_csv_align
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 7 other locations - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 361..362
        tools/perf/scripts/python/task-analyzer.py on lines 367..368
        tools/perf/scripts/python/task-analyzer.py on lines 376..378
        tools/perf/scripts/python/task-analyzer.py on lines 380..382
        tools/perf/scripts/python/task-analyzer.py on lines 384..386
        tools/perf/scripts/python/task-analyzer.py on lines 388..390
        tools/perf/scripts/python/task-analyzer.py on lines 392..394

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

        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 time_in(self, unit="s"):
                """return time where a given task was scheduled in"""
                factor = time_uniter(unit)
                return self._time_in * decimal.Decimal(factor)
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 1 other location - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 551..554

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

        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 time_out(self, unit="s"):
                """return time where a given task was scheduled out"""
                factor = time_uniter(unit)
                return self._time_out * decimal.Decimal(factor)
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 1 other location - About 1 hr to fix
        tools/perf/scripts/python/task-analyzer.py on lines 556..559

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

        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 args.summary_extended:
                        self.out_in = None
                        self.inter_at = None
                        self.out_out = None
                        self.in_in = None
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 2 other locations - About 50 mins to fix
        tools/testing/selftests/damon/_damon_sysfs.py on lines 171..176
        tools/testing/selftests/damon/_damon_sysfs.py on lines 259..265

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

                fmt += "{}{{:>{}}}".format(separator, db["task_info"]["tid"] * fix_csv_align)
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 5 other locations - About 30 mins to fix
        tools/perf/scripts/python/task-analyzer.py on lines 354..354
        tools/perf/scripts/python/task-analyzer.py on lines 355..355
        tools/perf/scripts/python/task-analyzer.py on lines 356..356
        tools/perf/scripts/python/task-analyzer.py on lines 357..357
        tools/perf/scripts/python/task-analyzer.py on lines 358..359

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

                fmt += "{}{{:>{}}}".format(separator, db["runtime_info"]["runs"] * fix_csv_align)
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 5 other locations - About 30 mins to fix
        tools/perf/scripts/python/task-analyzer.py on lines 353..353
        tools/perf/scripts/python/task-analyzer.py on lines 354..354
        tools/perf/scripts/python/task-analyzer.py on lines 356..356
        tools/perf/scripts/python/task-analyzer.py on lines 357..357
        tools/perf/scripts/python/task-analyzer.py on lines 358..359

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

                fmt += "{}{{:>{}}}".format(separator, db["runtime_info"]["mean"] * fix_csv_align)
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 5 other locations - About 30 mins to fix
        tools/perf/scripts/python/task-analyzer.py on lines 353..353
        tools/perf/scripts/python/task-analyzer.py on lines 354..354
        tools/perf/scripts/python/task-analyzer.py on lines 355..355
        tools/perf/scripts/python/task-analyzer.py on lines 356..356
        tools/perf/scripts/python/task-analyzer.py on lines 358..359

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

                fmt += "{}{{:>{}}}".format(
                    separator, db["runtime_info"]["median"] * fix_csv_align
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 5 other locations - About 30 mins to fix
        tools/perf/scripts/python/task-analyzer.py on lines 353..353
        tools/perf/scripts/python/task-analyzer.py on lines 354..354
        tools/perf/scripts/python/task-analyzer.py on lines 355..355
        tools/perf/scripts/python/task-analyzer.py on lines 356..356
        tools/perf/scripts/python/task-analyzer.py on lines 357..357

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

                fmt += "{}{{:>{}}}".format(separator, db["task_info"]["comm"] * fix_csv_align)
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 5 other locations - About 30 mins to fix
        tools/perf/scripts/python/task-analyzer.py on lines 353..353
        tools/perf/scripts/python/task-analyzer.py on lines 355..355
        tools/perf/scripts/python/task-analyzer.py on lines 356..356
        tools/perf/scripts/python/task-analyzer.py on lines 357..357
        tools/perf/scripts/python/task-analyzer.py on lines 358..359

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

                fmt += "{}{{:>{}}}".format(separator, db["runtime_info"]["acc"] * fix_csv_align)
        Severity: Major
        Found in tools/perf/scripts/python/task-analyzer.py and 5 other locations - About 30 mins to fix
        tools/perf/scripts/python/task-analyzer.py on lines 353..353
        tools/perf/scripts/python/task-analyzer.py on lines 354..354
        tools/perf/scripts/python/task-analyzer.py on lines 355..355
        tools/perf/scripts/python/task-analyzer.py on lines 357..357
        tools/perf/scripts/python/task-analyzer.py on lines 358..359

        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