f213/education-backend

View on GitHub

Showing 13 of 13 total issues

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

Severity: Major
Found in src/apps/amocrm/models/amocrm_course.py and 1 other location - About 2 hrs to fix
src/apps/amocrm/models/amocrm_product_group.py on lines 0..12

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

if not keys["private"]:
    with open(path.join(path.dirname(__file__), "/private.pem"), "rb") as fp:
        keys["private"] = fp.read()
Severity: Major
Found in src/core/conf/auth.py and 1 other location - About 2 hrs to fix
src/core/conf/auth.py on lines 38..40

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

Severity: Major
Found in src/apps/amocrm/models/amocrm_product_group.py and 1 other location - About 2 hrs to fix
src/apps/amocrm/models/amocrm_course.py on lines 0..12

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

if not keys["public"]:
    with open(path.join(path.dirname(__file__), "/public.pem"), "rb") as fp:
        keys["public"] = fp.read()
Severity: Major
Found in src/core/conf/auth.py and 1 other location - About 2 hrs to fix
src/core/conf/auth.py on lines 42..44

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

Severity: Minor
Found in src/apps/amocrm/models/amocrm_order_transaction.py and 1 other location - About 35 mins to fix
src/apps/amocrm/models/amocrm_order_lead.py on lines 0..11

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

Severity: Minor
Found in src/apps/amocrm/models/amocrm_order_lead.py and 1 other location - About 35 mins to fix
src/apps/amocrm/models/amocrm_order_transaction.py on lines 0..11

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

Avoid too many return statements within this function.
Open

    return "—"
Severity: Major
Found in src/apps/orders/human_readable.py - About 30 mins to fix

    Merge this if statement with the enclosing one.
    Open

                if obj.expires is None or obj.expires >= timezone.now():

    Merging collapsible if statements increases the code's readability.

    Noncompliant Code Example

    if condition1:
        if condition2:
            # ...
    

    Compliant Solution

    if condition1 and condition2:
        # ...
    

    Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
    Open

        assert response.status_code == 200, "TG should return 200"
    Severity: Info
    Found in src/core/integrations/tg.py by bandit

    Use of extra potential SQL attack vector.
    Open

                return self.with_tree_fields().extra(where=[f'tree_path[1] in ({",".join(roots_of_accessed_answers)})'])
    Severity: Minor
    Found in src/apps/homework/models/answer.py by bandit

    Merge this if statement with the enclosing one.
    Open

                    if getattr(self, f"{field.name}_id", None) is not None:

    Merging collapsible if statements increases the code's readability.

    Noncompliant Code Example

    if condition1:
        if condition2:
            # ...
    

    Compliant Solution

    if condition1 and condition2:
        # ...
    

    Merge this if statement with the enclosing one.
    Open

                if answer.author != self.request.user:

    Merging collapsible if statements increases the code's readability.

    Noncompliant Code Example

    if condition1:
        if condition2:
            # ...
    

    Compliant Solution

    if condition1 and condition2:
        # ...
    

    Use of insecure MD2, MD4, MD5, or SHA1 hash function.
    Open

        hashsum = md5(fetched).hexdigest()
    Severity: Minor
    Found in src/apps/notion/assets.py by bandit
    Severity
    Category
    Status
    Source
    Language