SylvainDe/DidYouMean-Python

View on GitHub

Showing 142 of 142 total issues

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

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

        for msg, func in msgs:
            groups = (func,)
            named_groups = {'func': func}
            results = (groups, named_groups)
            self.re_matches(msg, re.MISSING_POS_ARG_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 358..362

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

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

    def test_must_be_type1_not_type2(self):
        """Test MUST_BE_TYPE1_NOT_TYPE2_RE."""
        msg = "must be str, not int"
        groups = ('str', 'int')
        results = (groups, dict())
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 4 other locations - About 1 hr to fix
didyoumean/didyoumean_re_tests.py on lines 535..541
didyoumean/didyoumean_re_tests.py on lines 569..575
didyoumean/didyoumean_re_tests.py on lines 660..665
didyoumean/didyoumean_re_tests.py on lines 674..679

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

    def test_expected_length(self):
        """Test EXPECTED_LENGTH_RE."""
        # PyPy
        msg = "expected length 3, got 2"
        groups = ('3', '2')
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 4 other locations - About 1 hr to fix
didyoumean/didyoumean_re_tests.py on lines 535..541
didyoumean/didyoumean_re_tests.py on lines 660..665
didyoumean/didyoumean_re_tests.py on lines 667..672
didyoumean/didyoumean_re_tests.py on lines 674..679

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

Function test_attr_name has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def test_attr_name(self):
        """Test ATTR_NAME."""
        regex = r"^" + re.ATTR_NAME + r"$"
        # Tests based on hardcoded values
        attrs = ["do_stuff", "__magic__"]
Severity: Minor
Found in didyoumean/didyoumean_re_tests.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

    def test_invalid_literal(self):
        """Test INVALID_LITERAL_RE."""
        # Python 2.6/2.7/3.2/3.3/3.4/3.5/PyPy/PyPy3
        msg = "invalid literal for int() with base 10: 'toto'"
        groups = ('int', 'toto')
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 4 other locations - About 1 hr to fix
didyoumean/didyoumean_re_tests.py on lines 569..575
didyoumean/didyoumean_re_tests.py on lines 660..665
didyoumean/didyoumean_re_tests.py on lines 667..672
didyoumean/didyoumean_re_tests.py on lines 674..679

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

    def test_cant_convert(self):
        """Test CANT_CONVERT_RE."""
        msg = "Can't convert 'int' object to str implicitly"
        groups = ('int', 'str')
        results = (groups, dict())
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 4 other locations - About 1 hr to fix
didyoumean/didyoumean_re_tests.py on lines 535..541
didyoumean/didyoumean_re_tests.py on lines 569..575
didyoumean/didyoumean_re_tests.py on lines 667..672
didyoumean/didyoumean_re_tests.py on lines 674..679

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

    def test_cannot_concat(self):
        """Test CANNOT_CONCAT_RE."""
        msg = "cannot concatenate 'str' and 'int' objects"
        groups = ('str', 'int')
        results = (groups, dict())
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 4 other locations - About 1 hr to fix
didyoumean/didyoumean_re_tests.py on lines 535..541
didyoumean/didyoumean_re_tests.py on lines 569..575
didyoumean/didyoumean_re_tests.py on lines 660..665
didyoumean/didyoumean_re_tests.py on lines 667..672

Duplicated Code

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

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

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

Tuning

This issue has a mass of 45.

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

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

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

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

Refactorings

Further Reading

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

    def test_nobinding_nonlocal(self):
        """Test NO_BINDING_NONLOCAL_RE."""
        msg = "no binding for nonlocal 'foo' found"
        groups = ('foo',)
        results = (groups, dict())
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 2 other locations - About 1 hr to fix
didyoumean/didyoumean_re_tests.py on lines 588..594
didyoumean/didyoumean_re_tests.py on lines 740..745

Duplicated Code

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

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

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

Tuning

This issue has a mass of 44.

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

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

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

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

Refactorings

Further Reading

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

    def test_assignment_to_string(self):
        """Trying to assign to string does not work."""
        code = "s = 'abc'\ns[1] = 'd'"
        good_code = "s = 'abc'\nl = list(s)\nl[1] = 'd'\ns = ''.join(l)"
        sugg = 'convert to list to edit the list and use "join()" on the list'
Severity: Major
Found in didyoumean/didyoumean_sugg_tests.py and 1 other location - About 1 hr to fix
didyoumean/didyoumean_sugg_tests.py on lines 1953..1959

Duplicated Code

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

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

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

Tuning

This issue has a mass of 44.

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

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

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

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

Refactorings

Further Reading

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

    def test_future_feature_not_def(self):
        """Test FUTURE_FEATURE_NOT_DEF_RE."""
        # Python 2.6/2.7/3.2/3.3/3.4/3.5/PyPy/PyPy3
        msg = "future feature divisio is not defined"
        groups = ('divisio',)
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 2 other locations - About 1 hr to fix
didyoumean/didyoumean_re_tests.py on lines 740..745
didyoumean/didyoumean_re_tests.py on lines 806..811

Duplicated Code

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

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

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

Tuning

This issue has a mass of 44.

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

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

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

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

Refactorings

Further Reading

Severity
Category
Status
Source
Language