SylvainDe/DidYouMean-Python

View on GitHub

Showing 113 of 142 total issues

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

    def test_unhashable_type(self):
        """Test UNHASHABLE_RE."""
        msgs = [
            # Python 2.6/2.7/3.2/3.3/3.4/3.5
            "unhashable type: 'list'",
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 3 other locations - About 2 hrs to fix
didyoumean/didyoumean_re_tests.py on lines 243..254
didyoumean/didyoumean_re_tests.py on lines 436..447
didyoumean/didyoumean_re_tests.py on lines 763..774

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

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

    def test_no_module_named(self):
        """Test NOMODULE_RE."""
        msgs = [
            # Python 2.6/2.7/3.2/PyPy/PyPy3
            "No module named fake_module",
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 3 other locations - About 2 hrs to fix
didyoumean/didyoumean_re_tests.py on lines 387..398
didyoumean/didyoumean_re_tests.py on lines 436..447
didyoumean/didyoumean_re_tests.py on lines 763..774

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

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_keyword(self):
        """Should be 'pass'."""
        typo, good = 'passs', 'pass'
        sugg = "'{0}' (keyword)".format(good)
        self.throws(typo, NAMEERROR, sugg)
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 2 other locations - About 2 hrs to fix
didyoumean/didyoumean_sugg_tests.py on lines 528..533
didyoumean/didyoumean_sugg_tests.py on lines 553..558

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 test_name(self):
        """Should be '__name__'."""
        typo, good = '__name_', '__name__'
        sugg = "'{0}' (global)".format(good)
        self.throws(typo, NAMEERROR, sugg)
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 2 other locations - About 2 hrs to fix
didyoumean/didyoumean_sugg_tests.py on lines 528..533
didyoumean/didyoumean_sugg_tests.py on lines 535..540

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

    def test_ellipsis(self):
        """Triple dot (...) aka Ellipsis can be used anywhere in Python 3."""
        before, after = before_and_after((3, 0))
        code = '...'
        self.throws(code, INVALIDSYNTAX, [], before)
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 4 other locations - About 2 hrs to fix
didyoumean/didyoumean_sugg_tests.py on lines 2309..2315
didyoumean/didyoumean_sugg_tests.py on lines 2401..2407
didyoumean/didyoumean_sugg_tests.py on lines 2421..2427
didyoumean/didyoumean_sugg_tests.py on lines 2487..2492

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

    def test_nonlocal(self):
        """nonlocal keyword is added in Python 3."""
        # NICE_TO_HAVE
        before, after = before_and_after((3, 0))
        code = 'def func():\n\tfoo = 1\n\tdef nested():\n\t\tnonlocal foo'
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 4 other locations - About 2 hrs to fix
didyoumean/didyoumean_sugg_tests.py on lines 2309..2315
didyoumean/didyoumean_sugg_tests.py on lines 2401..2407
didyoumean/didyoumean_sugg_tests.py on lines 2487..2492
didyoumean/didyoumean_sugg_tests.py on lines 2494..2499

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

    def test_walrus_operator(self):
        """Operator := introduced in Python 3.8."""
        # NICE_TO_HAVE
        before, after = before_and_after((3, 8))
        code = "if a := 42:\n\tpass"
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 4 other locations - About 2 hrs to fix
didyoumean/didyoumean_sugg_tests.py on lines 2401..2407
didyoumean/didyoumean_sugg_tests.py on lines 2421..2427
didyoumean/didyoumean_sugg_tests.py on lines 2487..2492
didyoumean/didyoumean_sugg_tests.py on lines 2494..2499

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 test_builtin(self):
        """Should be 'max'."""
        typo, good = 'maxi', 'max'
        sugg = "'{0}' (builtin)".format(good)
        self.throws(typo, NAMEERROR, sugg)
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 2 other locations - About 2 hrs to fix
didyoumean/didyoumean_sugg_tests.py on lines 535..540
didyoumean/didyoumean_sugg_tests.py on lines 553..558

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

    def test_unpack(self):
        """Extended tuple unpacking does not work prior to Python 3."""
        # NICE_TO_HAVE
        before, after = before_and_after((3, 0))
        code = 'a, *b = (1, 2, 3)'
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 4 other locations - About 2 hrs to fix
didyoumean/didyoumean_sugg_tests.py on lines 2309..2315
didyoumean/didyoumean_sugg_tests.py on lines 2421..2427
didyoumean/didyoumean_sugg_tests.py on lines 2487..2492
didyoumean/didyoumean_sugg_tests.py on lines 2494..2499

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

    def test_extended_unpacking(self):
        """Extended iterable unpacking is added with Python 3."""
        before, after = before_and_after((3, 0))
        code = '(a, *rest, b) = range(5)'
        self.throws(code, INVALIDSYNTAX, [], before)
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 4 other locations - About 2 hrs to fix
didyoumean/didyoumean_sugg_tests.py on lines 2309..2315
didyoumean/didyoumean_sugg_tests.py on lines 2401..2407
didyoumean/didyoumean_sugg_tests.py on lines 2421..2427
didyoumean/didyoumean_sugg_tests.py on lines 2494..2499

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 test_dict_del(self):
        """Del can be replaces by dict.pop with a default argument."""
        # NICE_TO_HAVE
        code = 'd = dict()\n{0}'
        bad_code, good_code = format_str(code, "del d[42]", "d.pop(42, None)")
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 2 other locations - About 1 hr to fix
didyoumean/didyoumean_sugg_tests.py on lines 2193..2199
didyoumean/didyoumean_sugg_tests.py on lines 2201..2207

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

    def test_keyword_arg_class_method(self):
        """Should be the same as previous test but on a class method."""
        code = 'class MyClass:\n\t@classmethod\n\tdef func(cls, a):' \
               '\n\t\tpass\nMyClass.func({0}=1)'
        bad_code, good_code = format_str(code, 'babar', 'a')
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 5 other locations - About 1 hr to fix
didyoumean/didyoumean_sugg_tests.py on lines 1572..1578
didyoumean/didyoumean_sugg_tests.py on lines 1649..1659
didyoumean/didyoumean_sugg_tests.py on lines 2283..2289
didyoumean/didyoumean_sugg_tests.py on lines 2291..2297
didyoumean/didyoumean_sugg_tests.py on lines 2317..2323

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

    def test_missing_colon(self):
        """Missing colon is a classic mistake."""
        # NICE_TO_HAVE
        code = "if True{0}\n\tpass"
        bad_code, good_code = format_str(code, "", ":")
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 5 other locations - About 1 hr to fix
didyoumean/didyoumean_sugg_tests.py on lines 1572..1578
didyoumean/didyoumean_sugg_tests.py on lines 1592..1598
didyoumean/didyoumean_sugg_tests.py on lines 1649..1659
didyoumean/didyoumean_sugg_tests.py on lines 2291..2297
didyoumean/didyoumean_sugg_tests.py on lines 2317..2323

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

    def test_missing_colon2(self):
        """Missing colon is a classic mistake."""
        # NICE_TO_HAVE
        code = "class MyClass{0}\n\tpass"
        bad_code, good_code = format_str(code, "", ":")
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 5 other locations - About 1 hr to fix
didyoumean/didyoumean_sugg_tests.py on lines 1572..1578
didyoumean/didyoumean_sugg_tests.py on lines 1592..1598
didyoumean/didyoumean_sugg_tests.py on lines 1649..1659
didyoumean/didyoumean_sugg_tests.py on lines 2283..2289
didyoumean/didyoumean_sugg_tests.py on lines 2317..2323

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

    def test_keyword_arg_other_objects_with_name(self):
        """Mix of previous tests but with more objects defined.

        Non-function object with same same as the function tested are defined
        to ensure that things do work fine.
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 5 other locations - About 1 hr to fix
didyoumean/didyoumean_sugg_tests.py on lines 1572..1578
didyoumean/didyoumean_sugg_tests.py on lines 1592..1598
didyoumean/didyoumean_sugg_tests.py on lines 2283..2289
didyoumean/didyoumean_sugg_tests.py on lines 2291..2297
didyoumean/didyoumean_sugg_tests.py on lines 2317..2323

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

    def test_dict_pop(self):
        """Dict.pop takes a default argument."""
        # NICE_TO_HAVE
        code = 'd = dict()\nd.pop(42{0})'
        bad_code, good_code = format_str(code, "", ", None")
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 2 other locations - About 1 hr to fix
didyoumean/didyoumean_sugg_tests.py on lines 2193..2199
didyoumean/didyoumean_sugg_tests.py on lines 2209..2215

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

    def test_keyword_arg_method(self):
        """Should be the same as previous test but on a method."""
        code = 'class MyClass:\n\tdef func(self, a):' \
               '\n\t\tpass\nMyClass().func({0}=1)'
        bad_code, good_code = format_str(code, 'babar', 'a')
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 5 other locations - About 1 hr to fix
didyoumean/didyoumean_sugg_tests.py on lines 1592..1598
didyoumean/didyoumean_sugg_tests.py on lines 1649..1659
didyoumean/didyoumean_sugg_tests.py on lines 2283..2289
didyoumean/didyoumean_sugg_tests.py on lines 2291..2297
didyoumean/didyoumean_sugg_tests.py on lines 2317..2323

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

    def test_keyword_as_identifier(self):
        """Using a keyword as a variable name."""
        # NICE_TO_HAVE
        code = '{0} = 1'
        bad_code, good_code = format_str(code, "from", "from_")
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 5 other locations - About 1 hr to fix
didyoumean/didyoumean_sugg_tests.py on lines 1572..1578
didyoumean/didyoumean_sugg_tests.py on lines 1592..1598
didyoumean/didyoumean_sugg_tests.py on lines 1649..1659
didyoumean/didyoumean_sugg_tests.py on lines 2283..2289
didyoumean/didyoumean_sugg_tests.py on lines 2291..2297

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

    def test_set_remove(self):
        """Set.remove throws when key is not found."""
        # NICE_TO_HAVE
        code = 's = set()\ns.{0}(42)'
        bad_code, good_code = format_str(code, "remove", "discard")
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 2 other locations - About 1 hr to fix
didyoumean/didyoumean_sugg_tests.py on lines 2201..2207
didyoumean/didyoumean_sugg_tests.py on lines 2209..2215

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

        for func, msg in msgs:
            groups = (func, )
            named_groups = {'func': func}
            results = (groups, named_groups)
            self.re_matches(msg, re.FUNC_TAKES_NO_KEYWORDARG_RE, results)
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 1 other location - About 1 hr to fix
didyoumean/didyoumean_re_tests.py on lines 503..507

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

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