torvalds/linux

View on GitHub

Showing 1,570 of 1,570 total issues

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

    def SamplesMinTime(self, machine_id):
        return self.SelectValue("SELECT time"
                    " FROM samples"
                    " WHERE time != 0 AND machine_id = " + str(machine_id) +
Severity: Major
Found in tools/perf/scripts/python/exported-sql-viewer.py and 5 other locations - About 30 mins to fix
tools/perf/scripts/python/exported-sql-viewer.py on lines 4858..4861
tools/perf/scripts/python/exported-sql-viewer.py on lines 4864..4867
tools/perf/scripts/python/exported-sql-viewer.py on lines 4876..4879
tools/perf/scripts/python/exported-sql-viewer.py on lines 4882..4886
tools/perf/scripts/python/exported-sql-viewer.py on lines 4889..4893

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

        err = write_file(os.path.join(self.sysfs_dir(), 'nr_accesses', 'max'),
                self.nr_accesses[1])
Severity: Major
Found in tools/testing/selftests/damon/_damon_sysfs.py and 5 other locations - About 30 mins to fix
tools/testing/selftests/damon/_damon_sysfs.py on lines 59..60
tools/testing/selftests/damon/_damon_sysfs.py on lines 63..64
tools/testing/selftests/damon/_damon_sysfs.py on lines 67..68
tools/testing/selftests/damon/_damon_sysfs.py on lines 75..76
tools/testing/selftests/damon/_damon_sysfs.py on lines 79..80

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

Avoid too many return statements within this function.
Open

            return
Severity: Major
Found in tools/perf/scripts/python/exported-sql-viewer.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return True
    Severity: Major
    Found in tools/perf/scripts/python/exported-sql-viewer.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return
      Severity: Major
      Found in tools/perf/scripts/python/exported-sql-viewer.py - About 30 mins to fix

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

            def SamplesMaxTime(self, machine_id):
                return self.SelectValue("SELECT time"
                            " FROM samples"
                            " WHERE time != 0 AND machine_id = " + str(machine_id) +
        Severity: Major
        Found in tools/perf/scripts/python/exported-sql-viewer.py and 5 other locations - About 30 mins to fix
        tools/perf/scripts/python/exported-sql-viewer.py on lines 4858..4861
        tools/perf/scripts/python/exported-sql-viewer.py on lines 4864..4867
        tools/perf/scripts/python/exported-sql-viewer.py on lines 4870..4873
        tools/perf/scripts/python/exported-sql-viewer.py on lines 4882..4886
        tools/perf/scripts/python/exported-sql-viewer.py on lines 4889..4893

        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

                err = write_file(
                        os.path.join(self.sysfs_dir(), 'age', 'min'), self.age[0])
        Severity: Major
        Found in tools/testing/selftests/damon/_damon_sysfs.py and 5 other locations - About 30 mins to fix
        tools/testing/selftests/damon/_damon_sysfs.py on lines 59..60
        tools/testing/selftests/damon/_damon_sysfs.py on lines 63..64
        tools/testing/selftests/damon/_damon_sysfs.py on lines 67..68
        tools/testing/selftests/damon/_damon_sysfs.py on lines 71..72
        tools/testing/selftests/damon/_damon_sysfs.py on lines 79..80

        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

        Avoid too many return statements within this function.
        Open

                return None
        Severity: Major
        Found in tools/perf/scripts/python/exported-sql-viewer.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return
          Severity: Major
          Found in tools/perf/scripts/python/exported-sql-viewer.py - About 30 mins to fix

            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

                    err = write_file(
                            os.path.join(self.sysfs_dir(), 'sz', 'max'), self.size[1])
            Severity: Major
            Found in tools/testing/selftests/damon/_damon_sysfs.py and 5 other locations - About 30 mins to fix
            tools/testing/selftests/damon/_damon_sysfs.py on lines 59..60
            tools/testing/selftests/damon/_damon_sysfs.py on lines 67..68
            tools/testing/selftests/damon/_damon_sysfs.py on lines 71..72
            tools/testing/selftests/damon/_damon_sysfs.py on lines 75..76
            tools/testing/selftests/damon/_damon_sysfs.py on lines 79..80

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

                                _damon_sysfs.Damos(
                                    access_pattern=_damon_sysfs.DamosAccessPattern(
                                        # >= 25% access rate, >= 200ms age
                                        nr_accesses=[5, 20], age=[2, 2**64 - 1]),
            Severity: Major
            Found in tools/testing/selftests/damon/damos_apply_interval.py and 3 other locations - About 30 mins to fix
            tools/testing/selftests/damon/damos_apply_interval.py on lines 20..23
            tools/testing/selftests/damon/damos_quota.py on lines 21..24
            tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_wss_estimation.py on lines 17..20

            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

                def SwitchesMinTime(self, machine_id):
                    return self.SelectValue("SELECT time"
                                " FROM context_switches"
                                " WHERE time != 0 AND machine_id = " + str(machine_id) +
            Severity: Major
            Found in tools/perf/scripts/python/exported-sql-viewer.py and 5 other locations - About 30 mins to fix
            tools/perf/scripts/python/exported-sql-viewer.py on lines 4864..4867
            tools/perf/scripts/python/exported-sql-viewer.py on lines 4870..4873
            tools/perf/scripts/python/exported-sql-viewer.py on lines 4876..4879
            tools/perf/scripts/python/exported-sql-viewer.py on lines 4882..4886
            tools/perf/scripts/python/exported-sql-viewer.py on lines 4889..4893

            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

                def SwitchesMaxTime(self, machine_id):
                    return self.SelectValue("SELECT time"
                                " FROM context_switches"
                                " WHERE time != 0 AND machine_id = " + str(machine_id) +
            Severity: Major
            Found in tools/perf/scripts/python/exported-sql-viewer.py and 5 other locations - About 30 mins to fix
            tools/perf/scripts/python/exported-sql-viewer.py on lines 4858..4861
            tools/perf/scripts/python/exported-sql-viewer.py on lines 4870..4873
            tools/perf/scripts/python/exported-sql-viewer.py on lines 4876..4879
            tools/perf/scripts/python/exported-sql-viewer.py on lines 4882..4886
            tools/perf/scripts/python/exported-sql-viewer.py on lines 4889..4893

            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

            Avoid too many return statements within this function.
            Open

                        return None
            Severity: Major
            Found in tools/perf/scripts/python/exported-sql-viewer.py - About 30 mins to fix

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

                              schemes=[_damon_sysfs.Damos(
                                  access_pattern=_damon_sysfs.DamosAccessPattern(
                                      # >= 25% access rate, >= 200ms age
                                      nr_accesses=[5, 20], age=[2, 2**64 - 1]))] # schemes
              tools/testing/selftests/damon/damos_apply_interval.py on lines 20..23
              tools/testing/selftests/damon/damos_apply_interval.py on lines 27..30
              tools/testing/selftests/damon/damos_quota.py on lines 21..24

              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

              Avoid too many return statements within this function.
              Open

                          return
              Severity: Major
              Found in tools/perf/scripts/python/exported-sql-viewer.py - About 30 mins to fix

                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

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

                                    _damon_sysfs.Damos(
                                        access_pattern=_damon_sysfs.DamosAccessPattern(
                                            # >= 25% access rate, >= 200ms age
                                            nr_accesses=[5, 20], age=[2, 2**64 - 1]),
                Severity: Major
                Found in tools/testing/selftests/damon/damos_apply_interval.py and 3 other locations - About 30 mins to fix
                tools/testing/selftests/damon/damos_apply_interval.py on lines 27..30
                tools/testing/selftests/damon/damos_quota.py on lines 21..24
                tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_wss_estimation.py on lines 17..20

                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

                    def CallsMaxTime(self, machine_id):
                        return self.SelectValue("SELECT calls.return_time"
                                    " FROM calls"
                                    " INNER JOIN threads ON threads.thread_id = calls.thread_id"
                                    " WHERE calls.return_time != 0 AND threads.machine_id = " + str(machine_id) +
                Severity: Major
                Found in tools/perf/scripts/python/exported-sql-viewer.py and 5 other locations - About 30 mins to fix
                tools/perf/scripts/python/exported-sql-viewer.py on lines 4858..4861
                tools/perf/scripts/python/exported-sql-viewer.py on lines 4864..4867
                tools/perf/scripts/python/exported-sql-viewer.py on lines 4870..4873
                tools/perf/scripts/python/exported-sql-viewer.py on lines 4876..4879
                tools/perf/scripts/python/exported-sql-viewer.py on lines 4882..4886

                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

                Severity
                Category
                Status
                Source
                Language