wikimedia/pywikibot

View on GitHub

Showing 616 of 616 total issues

Function setup_soft_redirect has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring.
Open

    def setup_soft_redirect(self):
        """Setup soft redirect task."""
        pywikibot.info(f'\nChecking {self.cat.categoryinfo["subcats"]}'
                       ' category redirect pages')
        self.load_record()
Severity: Minor
Found in scripts/category_redirect.py - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function read_file_content has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring.
Open

    def read_file_content(self, file_url: str):
        """Return name of temp file in which remote file is saved."""
        pywikibot.info('Reading file ' + file_url)

        handle, tempname = tempfile.mkstemp()
Severity: Minor
Found in pywikibot/specialbots/_upload.py - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function __init__ has 18 arguments (exceeds 7 allowed). Consider refactoring.
Open

    def __init__(self, oldcat,
Severity: Major
Found in scripts/category.py - About 1 hr to fix

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

            'fa': lambda m: multi(m, [
                (lambda v: dh_constVal(v, 20, 'سده ۲۰ (میلادی)'),
                 lambda p: p == 20),
                # This is a dummy value, just to avoid validation testing.
                # Later, it should be replaced with a proper 'fa' titles
    Severity: Major
    Found in pywikibot/date.py and 5 other locations - About 1 hr to fix
    pywikibot/date.py on lines 980..983
    pywikibot/date.py on lines 1048..1051
    pywikibot/date.py on lines 1121..1126
    pywikibot/date.py on lines 1240..1243
    pywikibot/date.py on lines 1350..1352

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

    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 FileLinksGenerator(
        referredFilePage: pywikibot.page.FilePage,  # noqa: N803
        total: int | None = None,
        content: bool = False
    ) -> Iterable[pywikibot.page.Page]:
    Severity: Major
    Found in pywikibot/pagegenerators/_generators.py and 2 other locations - About 1 hr to fix
    pywikibot/pagegenerators/_generators.py on lines 310..316
    pywikibot/pagegenerators/_generators.py on lines 387..402

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

    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 test_charset_not_last(self):
            """Test charset not last part of content-type header."""
            resp = CharsetTestCase._create_response(
                headers={
                    'content-type': (
    Severity: Major
    Found in tests/http_tests.py and 2 other locations - About 1 hr to fix
    tests/http_tests.py on lines 347..353
    tests/http_tests.py on lines 355..361

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

    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

            'ro': lambda m: multi(m, [
                (lambda v: dh_constVal(v, 1, 'Secolul I î.Hr.'), lambda p: p == 1),
                (lambda v: dh_centuryBC(v, 'Secolul al %R-lea î.Hr.'),
                 alwaysTrue)]),
    Severity: Major
    Found in pywikibot/date.py and 5 other locations - About 1 hr to fix
    pywikibot/date.py on lines 980..983
    pywikibot/date.py on lines 1048..1051
    pywikibot/date.py on lines 1104..1110
    pywikibot/date.py on lines 1121..1126
    pywikibot/date.py on lines 1350..1352

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

    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 LinkedPageGenerator(
        linkingPage: pywikibot.page.Page,  # noqa: N803
        total: int | None = None,
        content: bool = False
    ) -> Iterable[pywikibot.page.BasePage]:
    Severity: Major
    Found in pywikibot/pagegenerators/_generators.py and 2 other locations - About 1 hr to fix
    pywikibot/pagegenerators/_generators.py on lines 301..307
    pywikibot/pagegenerators/_generators.py on lines 310..316

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

    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 test_content_type_sparql_json_without_charset(self):
            """Test decoding without explicit charset but JSON content."""
            resp = CharsetTestCase._create_response(
                headers={'content-type': 'application/sparql-results+json'},
                data=CharsetTestCase.UTF8_BYTES)
    Severity: Major
    Found in tests/http_tests.py and 2 other locations - About 1 hr to fix
    tests/http_tests.py on lines 347..353
    tests/http_tests.py on lines 386..397

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

    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

            'hi': lambda m: multi(m, [
                (lambda v: dh_constVal(v, 20, 'बीसवी शताब्दी'), lambda p: p == 20),
                # This is a dummy value, just to avoid validation testing.
                # Later, it should be replaced with a proper 'fa' titles
                (lambda v: dh_centuryAD(v, '%dth century'),
    Severity: Major
    Found in pywikibot/date.py and 5 other locations - About 1 hr to fix
    pywikibot/date.py on lines 980..983
    pywikibot/date.py on lines 1048..1051
    pywikibot/date.py on lines 1104..1110
    pywikibot/date.py on lines 1240..1243
    pywikibot/date.py on lines 1350..1352

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

    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

            'ro': lambda m: multi(m, [
                (lambda v: dh_constVal(v, 0, 'Primul deceniu d.Hr.'),
                 lambda p: p == 0),
                (lambda v: dh_decAD(v, 'Anii %d'), alwaysTrue)]),
    Severity: Major
    Found in pywikibot/date.py and 5 other locations - About 1 hr to fix
    pywikibot/date.py on lines 1048..1051
    pywikibot/date.py on lines 1104..1110
    pywikibot/date.py on lines 1121..1126
    pywikibot/date.py on lines 1240..1243
    pywikibot/date.py on lines 1350..1352

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

    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

            'ro': lambda m: multi(m, [
                (lambda v: dh_constVal(v, 0, 'Primul deceniu î.Hr.'),
                 lambda p: p == 0),
                (lambda v: dh_decBC(v, 'Anii %d î.Hr.'), alwaysTrue)]),
    Severity: Major
    Found in pywikibot/date.py and 5 other locations - About 1 hr to fix
    pywikibot/date.py on lines 980..983
    pywikibot/date.py on lines 1104..1110
    pywikibot/date.py on lines 1121..1126
    pywikibot/date.py on lines 1240..1243
    pywikibot/date.py on lines 1350..1352

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

    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 test_content_type_application_json_without_charset(self):
            """Test decoding without explicit charset but JSON content."""
            resp = CharsetTestCase._create_response(
                headers={'content-type': 'application/json'},
                data=CharsetTestCase.UTF8_BYTES)
    Severity: Major
    Found in tests/http_tests.py and 2 other locations - About 1 hr to fix
    tests/http_tests.py on lines 355..361
    tests/http_tests.py on lines 386..397

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

    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

            'ur': lambda m: multi(m, [
                (lambda v: dh_constVal(v, 0, '0000مبم'), lambda p: p == 0),
                (lambda v: dh_millenniumAD(v, '%d000مبم'), alwaysTrue)]),
    Severity: Major
    Found in pywikibot/date.py and 5 other locations - About 1 hr to fix
    pywikibot/date.py on lines 980..983
    pywikibot/date.py on lines 1048..1051
    pywikibot/date.py on lines 1104..1110
    pywikibot/date.py on lines 1121..1126
    pywikibot/date.py on lines 1240..1243

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

    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 ImagesPageGenerator(
        pageWithImages: pywikibot.page.Page,  # noqa: N803
        total: int | None = None,
        content: bool = False
    ) -> Iterable[pywikibot.page.Page]:
    Severity: Major
    Found in pywikibot/pagegenerators/_generators.py and 2 other locations - About 1 hr to fix
    pywikibot/pagegenerators/_generators.py on lines 301..307
    pywikibot/pagegenerators/_generators.py on lines 387..402

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

    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

    Function parse has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring.
    Open

        def parse(self):
            """Parse wikitext of the link.
    
            Called internally when accessing attributes.
            """
    Severity: Minor
    Found in pywikibot/page/_links.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function __init__ has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring.
    Open

        def __init__(self, generator, templates: dict, **kwargs) -> None:
            """Initializer.
    
            :param generator: the pages to work on
            :type generator: iterable
    Severity: Minor
    Found in scripts/template.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

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

            'fr': lambda m: multi(m, [
                (lambda v: dh_centuryBC(v, '%Rer siècle av. J.-C.'),
                 lambda p: p == 1),
                (lambda v: dh_centuryBC(v, '%Re siècle av. J.-C.'),
                 alwaysTrue)]),
    Severity: Major
    Found in pywikibot/date.py and 4 other locations - About 1 hr to fix
    pywikibot/date.py on lines 876..878
    pywikibot/date.py on lines 1096..1098
    pywikibot/date.py on lines 1113..1115
    pywikibot/date.py on lines 1302..1305

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 55.

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

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

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

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

    Refactorings

    Further Reading

    Function recentchanges has 17 arguments (exceeds 7 allowed). Consider refactoring.
    Open

        def recentchanges(
    Severity: Major
    Found in pywikibot/site/_generators.py - About 1 hr to fix

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

              'fr': lambda m: multi(m, [
                  (lambda v: dh_millenniumAD(v, '%Rer millénaire'),
                   lambda p: p == 1),
                  (lambda v: dh_millenniumAD(v, '%Re millénaire'), alwaysTrue)]),
      Severity: Major
      Found in pywikibot/date.py and 4 other locations - About 1 hr to fix
      pywikibot/date.py on lines 876..878
      pywikibot/date.py on lines 1096..1098
      pywikibot/date.py on lines 1113..1115
      pywikibot/date.py on lines 1218..1222

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 55.

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

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

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

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

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language