SylvainDe/DidYouMean-Python

View on GitHub

Showing 113 of 142 total issues

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

    def test_invalid_syntax(self):
        """Test INVALID_SYNTAX_RE."""
        msgs = [
            # Python 2.6/2.7/3.2/3.3/3.4/3.5/PyPy3
            "invalid syntax",
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 606..623

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

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

        for msg, typ in msgs.items():
            results = ((typ,), dict())
            self.re_matches(msg, re.INDICES_MUST_BE_INT_RE, results)
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 406..408
didyoumean/didyoumean_re_tests.py on lines 417..419

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

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

    def test_op_not_supported_between_instances(self):
        """Test OP_NOT_SUPP_BETWEEN_INSTANCES_RE."""
        msgs = [
            # Python 3.6
            "'<' not supported between instances of 'int' and 'NoneType'",
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 6 other locations - About 50 mins to fix
didyoumean/didyoumean_re_tests.py on lines 376..385
didyoumean/didyoumean_re_tests.py on lines 509..518
didyoumean/didyoumean_re_tests.py on lines 577..586
didyoumean/didyoumean_re_tests.py on lines 848..857
didyoumean/didyoumean_re_tests.py on lines 859..869
didyoumean/didyoumean_re_tests.py on lines 893..902

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

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

    def test_exception_group_parenthesized(self):
        """Test EXC_GROUP_PARENTH_RE."""
        msgs = [
            # Python 3.10 alpha & beta.1
            "exception group must be parenthesized",
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 6 other locations - About 50 mins to fix
didyoumean/didyoumean_re_tests.py on lines 376..385
didyoumean/didyoumean_re_tests.py on lines 509..518
didyoumean/didyoumean_re_tests.py on lines 577..586
didyoumean/didyoumean_re_tests.py on lines 859..869
didyoumean/didyoumean_re_tests.py on lines 883..891
didyoumean/didyoumean_re_tests.py on lines 893..902

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

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

    def test_too_many_values(self):
        """Test TOO_MANY_VALUES_UNPACK_RE."""
        msgs = [
            # Python 2.6/2.7
            "too many values to unpack",
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 6 other locations - About 50 mins to fix
didyoumean/didyoumean_re_tests.py on lines 509..518
didyoumean/didyoumean_re_tests.py on lines 577..586
didyoumean/didyoumean_re_tests.py on lines 848..857
didyoumean/didyoumean_re_tests.py on lines 859..869
didyoumean/didyoumean_re_tests.py on lines 883..891
didyoumean/didyoumean_re_tests.py on lines 893..902

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

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

    def test_future_first(self):
        """Test FUTURE_FIRST_RE."""
        msgs = [
            # Python 2.6/2.7/3.2/3.3/3.4/3.5
            "from __future__ imports must occur at the beginning of the file",
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 6 other locations - About 50 mins to fix
didyoumean/didyoumean_re_tests.py on lines 376..385
didyoumean/didyoumean_re_tests.py on lines 509..518
didyoumean/didyoumean_re_tests.py on lines 848..857
didyoumean/didyoumean_re_tests.py on lines 859..869
didyoumean/didyoumean_re_tests.py on lines 883..891
didyoumean/didyoumean_re_tests.py on lines 893..902

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

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

    def test_exc_must_derive_from(self):
        """Test EXC_MUST_DERIVE_FROM_RE."""
        msgs = [
            # Python 2.7
            "exceptions must be old-style classes or derived from "
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 6 other locations - About 50 mins to fix
didyoumean/didyoumean_re_tests.py on lines 376..385
didyoumean/didyoumean_re_tests.py on lines 509..518
didyoumean/didyoumean_re_tests.py on lines 577..586
didyoumean/didyoumean_re_tests.py on lines 848..857
didyoumean/didyoumean_re_tests.py on lines 883..891
didyoumean/didyoumean_re_tests.py on lines 893..902

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

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

    def test_max_recursion_depth(self):
        """Test MAX_RECURSION_DEPTH_RE."""
        msgs = [
            # Most versions
            'maximum recursion depth exceeded',
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 6 other locations - About 50 mins to fix
didyoumean/didyoumean_re_tests.py on lines 376..385
didyoumean/didyoumean_re_tests.py on lines 509..518
didyoumean/didyoumean_re_tests.py on lines 577..586
didyoumean/didyoumean_re_tests.py on lines 848..857
didyoumean/didyoumean_re_tests.py on lines 859..869
didyoumean/didyoumean_re_tests.py on lines 883..891

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

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

    def test_need_more_values_to_unpack(self):
        """Test NEED_MORE_VALUES_RE."""
        msgs = [
            # Python 2.6/2.7/3.2/3.3/3.4/3.5(?)/PyPy3
            "need more than 2 values to unpack",
Severity: Major
Found in didyoumean/didyoumean_re_tests.py and 6 other locations - About 50 mins to fix
didyoumean/didyoumean_re_tests.py on lines 376..385
didyoumean/didyoumean_re_tests.py on lines 577..586
didyoumean/didyoumean_re_tests.py on lines 848..857
didyoumean/didyoumean_re_tests.py on lines 859..869
didyoumean/didyoumean_re_tests.py on lines 883..891
didyoumean/didyoumean_re_tests.py on lines 893..902

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

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_api_no_suggestion(self):
        """Check the case with no suggestion."""
        type_ = NameError
        sugg = ""
        code = 'babar = 0\nfdjhflsdsqfjlkqs'
Severity: Minor
Found in didyoumean/didyoumean_api_tests.py and 1 other location - About 45 mins to fix
didyoumean/didyoumean_api_tests.py on lines 84..89

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

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_api_suggestion(self):
        """Check the case with a suggestion."""
        type_ = NameError
        sugg = ". Did you mean 'babar' (local)?"
        code = 'babar = 0\nbaba'
Severity: Minor
Found in didyoumean/didyoumean_api_tests.py and 1 other location - About 45 mins to fix
didyoumean/didyoumean_api_tests.py on lines 91..96

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

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_cls(self):
        """Should be cls.this_is_cls_mthd."""
        code = 'FoobarClass().nameerror_cls()'
        suggs = ["'FoobarClass.this_is_cls_mthd'", "'cls.this_is_cls_mthd'"]
        self.throws(code, NAMEERROR, suggs)
Severity: Minor
Found in didyoumean/didyoumean_sugg_tests.py and 1 other location - About 35 mins to fix
didyoumean/didyoumean_sugg_tests.py on lines 865..869

Duplicated Code

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

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

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

Tuning

This issue has a mass of 33.

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

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

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

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

Refactorings

Further Reading

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

    def test_self2(self):
        """Should be self.this_is_cls_mthd."""
        code = 'FoobarClass().nameerror_self2()'
        suggs = ["'FoobarClass.this_is_cls_mthd'", "'self.this_is_cls_mthd'"]
        self.throws(code, NAMEERROR, suggs)
Severity: Minor
Found in didyoumean/didyoumean_sugg_tests.py and 1 other location - About 35 mins to fix
didyoumean/didyoumean_sugg_tests.py on lines 871..875

Duplicated Code

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

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

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

Tuning

This issue has a mass of 33.

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

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

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

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

Refactorings

Further Reading

Severity
Category
Status
Source
Language