torvalds/linux

View on GitHub
tools/testing/selftests/bpf/test_offload.py

Summary

Maintainability
F
1 wk
Test Coverage

File test_offload.py has 1133 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3

# Copyright (C) 2017 Netronome Systems, Inc.
# Copyright (c) 2019 Mellanox Technologies. All rights reserved
#
Severity: Major
Found in tools/testing/selftests/bpf/test_offload.py - About 2 days to fix

    Function test_multi_prog has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def test_multi_prog(simdev, sim, obj, modename, modeid):
        start_test("Test multi-attachment XDP - %s + offload..." %
                   (modename or "default", ))
        sim.set_xdp(obj, "offload")
        xdp = sim.ip_link_show(xdp=True)["xdp"]
    Severity: Minor
    Found in tools/testing/selftests/bpf/test_offload.py - About 1 hr to fix

      Function _debugfs_dir_read has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _debugfs_dir_read(self, path):
              dfs = {}
      
              log("DebugFS state for %s" % (path), "")
              log_level_inc(add=2)
      Severity: Minor
      Found in tools/testing/selftests/bpf/test_offload.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 cls_bpf_add_filter has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def cls_bpf_add_filter(self, bpf, op="add", prio=None, handle=None,
      Severity: Major
      Found in tools/testing/selftests/bpf/test_offload.py - About 1 hr to fix

        Function tc_show_ingress has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def tc_show_ingress(self, expected=None):
                # No JSON support, oh well...
                flags = ["skip_sw", "skip_hw", "in_hw"]
                named = ["protocol", "pref", "chain", "handle", "id", "tag"]
        
        
        Severity: Minor
        Found in tools/testing/selftests/bpf/test_offload.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 cls_filter_op has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def cls_filter_op(self, op, qdisc="ingress", prio=None, handle=None,
        Severity: Major
        Found in tools/testing/selftests/bpf/test_offload.py - About 1 hr to fix

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

          def tool(name, args, flags, JSON=True, ns="", fail=True, include_stderr=False):
              params = ""
              if JSON:
                  params += "%s " % (flags["json"])
          
          
          Severity: Minor
          Found in tools/testing/selftests/bpf/test_offload.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 tool has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def tool(name, args, flags, JSON=True, ns="", fail=True, include_stderr=False):
          Severity: Major
          Found in tools/testing/selftests/bpf/test_offload.py - About 50 mins to fix

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

                def set_xdp(self, bpf, mode, force=False, JSON=True, verbose=False,
            Severity: Major
            Found in tools/testing/selftests/bpf/test_offload.py - About 50 mins to fix

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

              def bpftool_prog_load(sample, file_name, maps=[], prog_type="xdp", dev=None,
              Severity: Major
              Found in tools/testing/selftests/bpf/test_offload.py - About 50 mins to fix

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

                    def __init__(self, port_count=1):
                        addr = 0
                        while True:
                            try:
                                self.ctrl_write("new_device", "%u %u" % (addr, port_count))
                Severity: Minor
                Found in tools/testing/selftests/bpf/test_offload.py - About 45 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

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

                def ip(args, force=False, JSON=True, ns="", fail=True, include_stderr=False):
                Severity: Minor
                Found in tools/testing/selftests/bpf/test_offload.py - About 45 mins to fix

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

                  def test_multi_prog(simdev, sim, obj, modename, modeid):
                  Severity: Minor
                  Found in tools/testing/selftests/bpf/test_offload.py - About 35 mins to fix

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

                    def bpftool(args, JSON=True, ns="", fail=True, include_stderr=False):
                    Severity: Minor
                    Found in tools/testing/selftests/bpf/test_offload.py - About 35 mins to fix

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

                      def check_dev_info(other_ns, ns, prog_file=None, map_file=None, removed=False):
                      Severity: Minor
                      Found in tools/testing/selftests/bpf/test_offload.py - About 35 mins to fix

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

                        def cmd(cmd, shell=True, include_stderr=False, background=False, fail=True):
                        Severity: Minor
                        Found in tools/testing/selftests/bpf/test_offload.py - About 35 mins to fix

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

                          def tc(args, JSON=True, ns="", fail=True, include_stderr=False):
                          Severity: Minor
                          Found in tools/testing/selftests/bpf/test_offload.py - About 35 mins to fix

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

                                def unset_xdp(self, mode, force=False, JSON=True,
                            Severity: Minor
                            Found in tools/testing/selftests/bpf/test_offload.py - About 35 mins to fix

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

                                  def wait_for_netdevs(self, port_count):
                                      timeout = 5
                                      timeout_start = time.time()
                              
                                      while True:
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.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 bpftool_prog_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def bpftool_prog_list(expected=None, ns="", exclude_orphaned=True):
                                  _, progs = bpftool("prog show", JSON=True, ns=ns, fail=True)
                                  # Remove the base progs
                                  for p in base_progs:
                                      if p in progs:
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.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 cmd_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def cmd_result(proc, include_stderr=False, fail=False):
                                  stdout, stderr = proc.communicate()
                                  stdout = stdout.decode("utf-8")
                                  stderr = stderr.decode("utf-8")
                                  proc.stdout.close()
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py - About 25 mins to fix

                              Cognitive Complexity

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

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

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

                              Further reading

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

                              def log(header, data, level=None):
                                  """
                                  Output to an optional log.
                                  """
                                  if logfile is None:
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py - About 25 mins to fix

                              Cognitive Complexity

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

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

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

                              Further reading

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

                              def bpftool_map_list_wait(expected=0, n_retry=20):
                                  for i in range(n_retry):
                                      nmaps = len(bpftool_map_list())
                                      if nmaps == expected:
                                          return
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 3 hrs to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 196..202

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

                              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 bpftool_prog_list_wait(expected=0, n_retry=20):
                                  for i in range(n_retry):
                                      nprogs = len(bpftool_prog_list())
                                      if nprogs == expected:
                                          return
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 3 hrs to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 204..210

                              Duplicated Code

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

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

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

                              Tuning

                              This issue has a mass of 67.

                              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

                                  for m in maps:
                                      for i in range(2):
                                          bpftool("map update id %d key %s value %s exist" %
                                                  (m["id"], int2str("I", i), int2str("Q", i * 3)))
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 2 hrs to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1212..1215

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

                              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

                                  for m in maps:
                                      for i in range(2):
                                          bpftool("map update id %d key %s value %s" %
                                                  (m["id"], int2str("I", i), int2str("Q", i * 3)))
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 2 hrs to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1224..1227

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

                              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

                                      ret, err = bpftool("map update id %d key %s value %s exist" %
                                                         (m["id"], int2str("I", 3), int2str("Q", 3 * 3)),
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1218..1219

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

                              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

                                      ret, _ = bpftool("map update id %d key %s value %s" %
                                                       (m["id"], int2str("I", 3), int2str("Q", 3 * 3)),
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1230..1231

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

                              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 expected is not None:
                                          if len(progs) != expected:
                                              fail(True, "%d BPF programs bound, expected %d" %
                                                   (len(progs), expected))
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 2 other locations - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 180..183
                              tools/testing/selftests/bpf/test_offload.py on lines 190..193

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

                              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 expected is not None:
                                      if len(maps) != expected:
                                          fail(True, "%d BPF maps loaded, expected %d" %
                                               (len(maps), expected))
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 2 other locations - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 180..183
                              tools/testing/selftests/bpf/test_offload.py on lines 411..414

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

                              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 expected is not None:
                                      if len(progs) != expected:
                                          fail(True, "%d BPF programs loaded, expected %d" %
                                               (len(progs), expected))
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 2 other locations - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 190..193
                              tools/testing/selftests/bpf/test_offload.py on lines 411..414

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

                              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

                                  fail(ipl["xdp"]["prog"]["id"] != progs[0]["id"],
                                       "Loaded program has wrong ID")
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1001..1002

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

                              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

                                  fail(ipl["xdp"]["prog"]["id"] != progs[0]["id"],
                                       "Loaded program has wrong ID")
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 987..988

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

                              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 len(stderr) > 0 and stderr[-1] == "\n":
                                          stderr = stderr[:-1]
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              scripts/checkkconfigsymbols.py on lines 296..297

                              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

                                  array = maps[0] if maps[0]["type"] == "array" else maps[1]
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1211..1211

                              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

                              def tc(args, JSON=True, ns="", fail=True, include_stderr=False):
                                  return tool("tc", args, {"json":"-p"}, JSON=JSON, ns=ns,
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 168..169

                              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

                                  ret, _, err = bpftool_prog_load("sample_map_ret0.bpf.o", "/sys/fs/bpf/nsimB_",
                                                                  dev=simB1['ifname'],
                                                                  maps=["idx 0 id %d" % (mapA)],
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1356..1358

                              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

                                  htab = maps[0] if maps[0]["type"] == "hash" else maps[1]
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1210..1210

                              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

                              def bpftool(args, JSON=True, ns="", fail=True, include_stderr=False):
                                  return tool("bpftool", args, {"json":"-p"}, JSON=JSON, ns=ns,
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 233..234

                              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

                                  ret, _, err = bpftool_prog_load("sample_map_ret0.bpf.o", "/sys/fs/bpf/nsimA_",
                                                                  dev=simA['ifname'],
                                                                  maps=["idx 0 id %d" % (mapB)],
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1364..1366

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

                                  fail(err["error"].find("No such device") == -1,
                                       "Showing map with removed device expected ENODEV, error is %s" %
                                       (err["error"]))
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 4 other locations - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1234..1235
                              tools/testing/selftests/bpf/test_offload.py on lines 1244..1245
                              tools/testing/selftests/bpf/test_offload.py on lines 1268..1269
                              tools/testing/selftests/bpf/test_offload.py on lines 1280..1281

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

                                      fail(err["error"].find("No such file or directory") == -1,
                                           "expected ENOENT, error is '%s'" % (err["error"]))
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 4 other locations - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 624..626
                              tools/testing/selftests/bpf/test_offload.py on lines 1234..1235
                              tools/testing/selftests/bpf/test_offload.py on lines 1244..1245
                              tools/testing/selftests/bpf/test_offload.py on lines 1268..1269

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

                                      fail(err["error"].find("No such file or directory") == -1,
                                           "expected ENOENT, error is '%s'" % (err["error"]))
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 4 other locations - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 624..626
                              tools/testing/selftests/bpf/test_offload.py on lines 1244..1245
                              tools/testing/selftests/bpf/test_offload.py on lines 1268..1269
                              tools/testing/selftests/bpf/test_offload.py on lines 1280..1281

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

                                      fail(err["error"].find("File exists") == -1,
                                           "expected EEXIST, error is '%s'" % (err["error"]))
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 4 other locations - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 624..626
                              tools/testing/selftests/bpf/test_offload.py on lines 1234..1235
                              tools/testing/selftests/bpf/test_offload.py on lines 1268..1269
                              tools/testing/selftests/bpf/test_offload.py on lines 1280..1281

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

                                      fail(err["error"].find("No such file or directory") == -1,
                                           "expected ENOENT, error is '%s'" % (err["error"]))
                              Severity: Major
                              Found in tools/testing/selftests/bpf/test_offload.py and 4 other locations - About 1 hr to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 624..626
                              tools/testing/selftests/bpf/test_offload.py on lines 1234..1235
                              tools/testing/selftests/bpf/test_offload.py on lines 1244..1245
                              tools/testing/selftests/bpf/test_offload.py on lines 1280..1281

                              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

                                      ret, stdout, stderr = cmd(ns + name + " " + params + args,
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 50 mins to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 155..155

                              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

                                      ret, stdout = cmd(ns + name + " " + params + args,
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 50 mins to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 152..152

                              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

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

                                  ifnameB = bpftool("prog show %s" % (progB))[1]["dev"]["ifname"]
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py and 2 other locations - About 35 mins to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1378..1378
                              tools/testing/selftests/bpf/test_offload.py on lines 1384..1384

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

                              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

                                  ifnameB = bpftool("prog show %s" % (progB))[1]["dev"]["ifname"]
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py and 2 other locations - About 35 mins to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1378..1378
                              tools/testing/selftests/bpf/test_offload.py on lines 1389..1389

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

                              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

                                  ifnameB = bpftool("prog show %s" % (progB))[1]["dev"]["ifname"]
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py and 2 other locations - About 35 mins to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1384..1384
                              tools/testing/selftests/bpf/test_offload.py on lines 1389..1389

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

                              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

                                  mapB = bpftool("prog show %s" % (progB))[1]["map_ids"][0]
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 35 mins to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1346..1346

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

                              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

                                  mapA = bpftool("prog show %s" % (progA))[1]["map_ids"][0]
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py and 1 other location - About 35 mins to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 1347..1347

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

                              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

                                  fail(xdp["attached"][0] not in two_xdps["attached"],
                                       "Offload program not reported after other activated")
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py and 2 other locations - About 30 mins to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 704..705
                              tools/testing/selftests/bpf/test_offload.py on lines 740..741

                              Duplicated Code

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

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

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

                              Tuning

                              This issue has a mass of 32.

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

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

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

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

                              Refactorings

                              Further Reading

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

                                  fail(xdp["attached"][0] not in two_xdps["attached"],
                                       "Other program not reported after offload activated")
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py and 2 other locations - About 30 mins to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 704..705
                              tools/testing/selftests/bpf/test_offload.py on lines 730..731

                              Duplicated Code

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

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

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

                              Tuning

                              This issue has a mass of 32.

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

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

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

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

                              Refactorings

                              Further Reading

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

                                  fail(xdp["attached"][0] not in two_xdps["attached"],
                                       "Offload program not reported after other activated")
                              Severity: Minor
                              Found in tools/testing/selftests/bpf/test_offload.py and 2 other locations - About 30 mins to fix
                              tools/testing/selftests/bpf/test_offload.py on lines 730..731
                              tools/testing/selftests/bpf/test_offload.py on lines 740..741

                              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