netdata/netdata

View on GitHub
src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py

Summary

Maintainability
F
4 days
Test Coverage

File nvidia_smi.chart.py has 525 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# Description: nvidia-smi netdata python.d module
# Original Author: Steven Noonan (tycho)
# Author: Ilya Mashchenko (ilyam8)
# User Memory Stat Author: Guido Scatena (scatenag)
Severity: Major
Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py - About 1 day to fix

    GPU has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class GPU:
        def __init__(self, num, root, exclude_zero_memory_users=False):
            self.num = num
            self.root = root
            self.exclude_zero_memory_users = exclude_zero_memory_users
    Severity: Minor
    Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py - About 3 hrs to fix

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

          def data(self):
              data = {
                  'rx_util': self.rx_util(),
                  'tx_util': self.tx_util(),
                  'fan_speed': self.fan_speed(),
      Severity: Minor
      Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py - About 2 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def update_processes_user_mem_chart(self, gpu):
              ps = gpu.processes()
              if not ps:
                  return
              chart = self.charts['gpu{0}_{1}'.format(gpu.num, USER_MEM)]
      Severity: Minor
      Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.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 update_processes_mem_chart has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_processes_mem_chart(self, gpu):
              ps = gpu.processes()
              if not ps:
                  return
              chart = self.charts['gpu{0}_{1}'.format(gpu.num, PROCESSES_MEM)]
      Severity: Minor
      Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py - About 35 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Avoid too many return statements within this function.
      Open

              return True
      Severity: Major
      Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py - About 30 mins to fix

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

            def get_data(self):
                if self.loop_mode:
                    last_data = self.get_data_loop_mode()
                else:
                    last_data = self.get_data_normal_mode()
        Severity: Minor
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.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

                        data['rx_util_percent'] = str(int(int(self.rx_util()) * 100 / self.pci_bw_max()))
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 502..502

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

        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

                        data['tx_util_percent'] = str(int(int(self.tx_util()) * 100 / self.pci_bw_max()))
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 501..501

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

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

            @handle_attr_error
            def fb_memory_used(self):
                return self.root.find('fb_memory_usage').find('used').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def fb_memory_free(self):
                return self.root.find('fb_memory_usage').find('free').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def sm_clock(self):
                return self.root.find('clocks').find('sm_clock').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def bar1_memory_used(self):
                return self.root.find('bar1_memory_usage').find('used').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def memory_util(self):
                return self.root.find('utilization').find('memory_util').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def decoder_util(self):
                return self.root.find('utilization').find('decoder_util').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def temperature(self):
                return self.root.find('temperature').find('gpu_temp').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def gpu_util(self):
                return self.root.find('utilization').find('gpu_util').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def encoder_util(self):
                return self.root.find('utilization').find('encoder_util').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def mem_clock(self):
                return self.root.find('clocks').find('mem_clock').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435

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

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

            @handle_attr_error
            def tx_util(self):
                return self.root.find('pci').find('tx_util').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def graphics_clock(self):
                return self.root.find('clocks').find('graphics_clock').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def rx_util(self):
                return self.root.find('pci').find('rx_util').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def bar1_memory_free(self):
                return self.root.find('bar1_memory_usage').find('free').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 429..431
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

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

            @handle_attr_error
            def video_clock(self):
                return self.root.find('clocks').find('video_clock').text.split()[0]
        Severity: Major
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 14 other locations - About 55 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 377..379
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 381..383
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 389..391
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 393..395
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 397..399
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 401..403
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 405..407
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 409..411
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 413..415
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 417..419
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 421..423
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 425..427
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 433..435
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 437..439

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

        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

                for dim in chart:
                    if dim.id not in active_dim_ids:
                        chart.del_dimension(dim.id, hide=False)
        Severity: Minor
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 1 other location - About 35 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 587..589

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

                for dim in chart:
                    if dim.id not in active_dim_ids:
                        chart.del_dimension(dim.id, hide=False)
        Severity: Minor
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 1 other location - About 35 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 605..607

        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

        def handle_value_error(method):
            def on_call(*args, **kwargs):
                try:
                    return method(*args, **kwargs)
                except ValueError:
        Severity: Minor
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 1 other location - About 30 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 271..278

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 32.

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

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

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

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

        Refactorings

        Further Reading

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

        def handle_attr_error(method):
            def on_call(*args, **kwargs):
                try:
                    return method(*args, **kwargs)
                except AttributeError:
        Severity: Minor
        Found in src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py and 1 other location - About 30 mins to fix
        src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py on lines 281..288

        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