netdata/netdata

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

Summary

Maintainability
F
4 days
Test Coverage

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

# -*- coding: utf-8 -*-
# Description: ceph netdata python.d module
# Author: Luis Eduardo (lets00)
# SPDX-License-Identifier: GPL-3.0-or-later

Severity: Minor
Found in src/collectors/python.d.plugin/ceph/ceph.chart.py - About 4 hrs to fix

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

        def check(self):
            """
            Checks module
            :return:
            """
    Severity: Minor
    Found in src/collectors/python.d.plugin/ceph/ceph.chart.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

    Avoid too many return statements within this function.
    Open

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

      Avoid too many return statements within this function.
      Open

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

        Avoid too many return statements within this function.
        Open

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

          Avoid too many return statements within this function.
          Open

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

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

                def _get_osd_perf(self):
                    """
                    Get ceph osd performance
                    :return: ceph osd perf --format json
                    """
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 2 other locations - About 2 hrs to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 326..334
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 356..366

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

            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

                def _get_df(self):
                    """
                    Get ceph df output
                    :return: ceph df --format json
                    """
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 2 other locations - About 2 hrs to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 346..354
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 356..366

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

            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

                def _get_osd_pool_stats(self):
                    """
                    Get ceph osd pool status.
                    This command is used to get information about both
                    read/write operation and bytes per second on each pool
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 2 other locations - About 2 hrs to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 326..334
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 346..354

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

            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

                        self.definitions['pool_write_bytes']['lines'].append(['write_{0}'.format(pool['name']),
                                                                              pool['name'],
                                                                              'absolute', 1, 1024])
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 1 other location - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 179..181

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

            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

                        self.definitions['pool_read_bytes']['lines'].append(['read_{0}'.format(pool['name']),
                                                                             pool['name'],
                                                                             'absolute', 1, 1024])
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 1 other location - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 182..184

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

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

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

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

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

            Refactorings

            Further Reading

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

                        self.definitions['osd_commit_latency']['lines'].append(['commit_latency_{0}'.format(osd['name']),
                                                                                osd['name'],
                                                                                'absolute'])
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 5 other locations - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 176..178
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 185..187
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 188..190
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 197..199
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 200..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 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 6 locations. Consider refactoring.
            Open

                        self.definitions['pool_read_operations']['lines'].append(['read_operations_{0}'.format(pool['name']),
                                                                                  pool['name'],
                                                                                  'absolute'])
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 5 other locations - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 176..178
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 188..190
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 197..199
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 200..202
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 203..205

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

                        self.definitions['osd_size']['lines'].append(['size_{0}'.format(osd['name']),
                                                                       osd['name'],
                                                                       'absolute'])
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 5 other locations - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 176..178
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 185..187
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 188..190
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 200..202
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 203..205

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

                        self.definitions['pool_write_operations']['lines'].append(['write_operations_{0}'.format(pool['name']),
                                                                                   pool['name'],
                                                                                   'absolute'])
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 5 other locations - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 176..178
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 185..187
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 197..199
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 200..202
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 203..205

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

                        self.definitions['osd_apply_latency']['lines'].append(['apply_latency_{0}'.format(osd['name']),
                                                                               osd['name'],
                                                                               'absolute'])
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 5 other locations - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 176..178
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 185..187
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 188..190
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 197..199
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 203..205

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

                        self.definitions['pool_objects']['lines'].append(["obj_{0}".format(pool['name']),
                                                                          pool['name'],
                                                                          'absolute'])
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 5 other locations - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 185..187
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 188..190
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 197..199
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 200..202
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 203..205

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

                        for pool in df['pools']:
                            data.update(self._get_pool_usage(pool))
                            data.update(self._get_pool_objects(pool))
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 1 other location - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 226..228

            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

                        for osd in osd_df['nodes']:
                            data.update(self._get_osd_usage(osd))
                            data.update(self._get_osd_size(osd))
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 1 other location - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 221..223

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

                    if not (os.access(self.config_file, os.R_OK)):
                        self.error('Ceph plugin does not read {0}, define read permission.'.format(self.config_file))
                        return False
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 3 other locations - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 143..145
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 146..148
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 152..154

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 39.

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

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

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

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

            Refactorings

            Further Reading

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

                    if not (os.access(self.keyring_file, os.R_OK)):
                        self.error('Ceph plugin does not read {0}, define read permission.'.format(self.keyring_file))
                        return False
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 3 other locations - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 143..145
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 146..148
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 149..151

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 39.

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

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

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

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

            Refactorings

            Further Reading

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

                    if not (os.access(self.keyring_file, os.F_OK)):
                        self.error('{0} does not exist'.format(self.keyring_file))
                        return False
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 3 other locations - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 143..145
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 149..151
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 152..154

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 39.

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

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

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

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

            Refactorings

            Further Reading

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

                        self.definitions['pool_usage']['lines'].append([pool['name'],
                                                                        pool['name'],
                                                                        'absolute'])
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 1 other location - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 194..196

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 39.

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

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

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

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

            Refactorings

            Further Reading

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

                    if not (os.access(self.config_file, os.F_OK)):
                        self.error('{0} does not exist'.format(self.config_file))
                        return False
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 3 other locations - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 146..148
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 149..151
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 152..154

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 39.

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

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

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

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

            Refactorings

            Further Reading

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

                        self.definitions['osd_usage']['lines'].append([osd['name'],
                                                                       osd['name'],
                                                                       'absolute'])
            Severity: Major
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 1 other location - About 1 hr to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 173..175

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 39.

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

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

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

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

            Refactorings

            Further Reading

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

                    for pool in sorted(self._get_df()['pools'], key=lambda x: sorted(x.keys())):
            Severity: Minor
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 1 other location - About 35 mins to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 193..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 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

                    for osd in sorted(self._get_osd_df()['nodes'], key=lambda x: sorted(x.keys())):
            Severity: Minor
            Found in src/collectors/python.d.plugin/ceph/ceph.chart.py and 1 other location - About 35 mins to fix
            src/collectors/python.d.plugin/ceph/ceph.chart.py on lines 172..172

            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

            There are no issues that match your filters.

            Category
            Status