xchem/XChemExplorer

View on GitHub
xce/helpers/prepare_for_zenodo_upload.py

Summary

Maintainability
C
1 day
Test Coverage

Function edit_index_html has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def edit_index_html(htmlDir, uploadID):
    os.chdir(os.path.join(htmlDir, "zenodo"))

    out = ""
    for line in open("../index.html"):
Severity: Minor
Found in xce/helpers/prepare_for_zenodo_upload.py - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function edit_icb_html_files has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def edit_icb_html_files(htmlDir, uploadID):
    # https://zenodo.org/record/48768/files/README.txt
    os.chdir(os.path.join(htmlDir, "zenodo"))
    for file in glob.glob("*event*html"):
        out = ""
Severity: Minor
Found in xce/helpers/prepare_for_zenodo_upload.py - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

        if "css/" in line:
            line = line.replace(
                "css/", "https://zenodo.org/record/" + uploadID + "/files/"
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 42..44
xce/helpers/prepare_for_zenodo_upload.py on lines 46..48
xce/helpers/prepare_for_zenodo_upload.py on lines 50..52
xce/helpers/prepare_for_zenodo_upload.py on lines 54..56
xce/helpers/prepare_for_zenodo_upload.py on lines 58..60
xce/helpers/prepare_for_zenodo_upload.py on lines 62..64
xce/helpers/prepare_for_zenodo_upload.py on lines 70..72
xce/helpers/prepare_for_zenodo_upload.py on lines 93..95
xce/helpers/prepare_for_zenodo_upload.py on lines 97..100
xce/helpers/prepare_for_zenodo_upload.py on lines 102..107

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

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

            if ' act.projectFile = "' in line:
                line = line.replace(
                    ' act.projectFile = "',
                    ' act.projectFile = "https://zenodo.org/record/'
                    + uploadID
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 42..44
xce/helpers/prepare_for_zenodo_upload.py on lines 46..48
xce/helpers/prepare_for_zenodo_upload.py on lines 50..52
xce/helpers/prepare_for_zenodo_upload.py on lines 54..56
xce/helpers/prepare_for_zenodo_upload.py on lines 58..60
xce/helpers/prepare_for_zenodo_upload.py on lines 62..64
xce/helpers/prepare_for_zenodo_upload.py on lines 66..68
xce/helpers/prepare_for_zenodo_upload.py on lines 70..72
xce/helpers/prepare_for_zenodo_upload.py on lines 93..95
xce/helpers/prepare_for_zenodo_upload.py on lines 97..100

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

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

        if "compoundImages/" in line:
            line = line.replace(
                "compoundImages/", "https://zenodo.org/record/" + uploadID + "/files/"
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 46..48
xce/helpers/prepare_for_zenodo_upload.py on lines 50..52
xce/helpers/prepare_for_zenodo_upload.py on lines 54..56
xce/helpers/prepare_for_zenodo_upload.py on lines 58..60
xce/helpers/prepare_for_zenodo_upload.py on lines 62..64
xce/helpers/prepare_for_zenodo_upload.py on lines 66..68
xce/helpers/prepare_for_zenodo_upload.py on lines 70..72
xce/helpers/prepare_for_zenodo_upload.py on lines 93..95
xce/helpers/prepare_for_zenodo_upload.py on lines 97..100
xce/helpers/prepare_for_zenodo_upload.py on lines 102..107

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

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

        if "pdbs/" in line:
            line = line.replace(
                "pdbs/", "https://zenodo.org/record/" + uploadID + "/files/"
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 42..44
xce/helpers/prepare_for_zenodo_upload.py on lines 50..52
xce/helpers/prepare_for_zenodo_upload.py on lines 54..56
xce/helpers/prepare_for_zenodo_upload.py on lines 58..60
xce/helpers/prepare_for_zenodo_upload.py on lines 62..64
xce/helpers/prepare_for_zenodo_upload.py on lines 66..68
xce/helpers/prepare_for_zenodo_upload.py on lines 70..72
xce/helpers/prepare_for_zenodo_upload.py on lines 93..95
xce/helpers/prepare_for_zenodo_upload.py on lines 97..100
xce/helpers/prepare_for_zenodo_upload.py on lines 102..107

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

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

        if "maps/" in line:
            line = line.replace(
                "maps/", "https://zenodo.org/record/" + uploadID + "/files/"
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 42..44
xce/helpers/prepare_for_zenodo_upload.py on lines 46..48
xce/helpers/prepare_for_zenodo_upload.py on lines 54..56
xce/helpers/prepare_for_zenodo_upload.py on lines 58..60
xce/helpers/prepare_for_zenodo_upload.py on lines 62..64
xce/helpers/prepare_for_zenodo_upload.py on lines 66..68
xce/helpers/prepare_for_zenodo_upload.py on lines 70..72
xce/helpers/prepare_for_zenodo_upload.py on lines 93..95
xce/helpers/prepare_for_zenodo_upload.py on lines 97..100
xce/helpers/prepare_for_zenodo_upload.py on lines 102..107

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

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

            if "../mapImages/" in line:
                line = line.replace(
                    "../mapImages/", "https://zenodo.org/record/" + uploadID + "/files/"
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 42..44
xce/helpers/prepare_for_zenodo_upload.py on lines 46..48
xce/helpers/prepare_for_zenodo_upload.py on lines 50..52
xce/helpers/prepare_for_zenodo_upload.py on lines 54..56
xce/helpers/prepare_for_zenodo_upload.py on lines 58..60
xce/helpers/prepare_for_zenodo_upload.py on lines 62..64
xce/helpers/prepare_for_zenodo_upload.py on lines 66..68
xce/helpers/prepare_for_zenodo_upload.py on lines 70..72
xce/helpers/prepare_for_zenodo_upload.py on lines 97..100
xce/helpers/prepare_for_zenodo_upload.py on lines 102..107

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

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

        if "js/" in line:
            line = line.replace(
                "js/", "https://zenodo.org/record/" + uploadID + "/files/"
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 42..44
xce/helpers/prepare_for_zenodo_upload.py on lines 46..48
xce/helpers/prepare_for_zenodo_upload.py on lines 50..52
xce/helpers/prepare_for_zenodo_upload.py on lines 54..56
xce/helpers/prepare_for_zenodo_upload.py on lines 58..60
xce/helpers/prepare_for_zenodo_upload.py on lines 62..64
xce/helpers/prepare_for_zenodo_upload.py on lines 66..68
xce/helpers/prepare_for_zenodo_upload.py on lines 93..95
xce/helpers/prepare_for_zenodo_upload.py on lines 97..100
xce/helpers/prepare_for_zenodo_upload.py on lines 102..107

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

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

        if "residueplots/" in line:
            line = line.replace(
                "residueplots/", "https://zenodo.org/record/" + uploadID + "/files/"
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 42..44
xce/helpers/prepare_for_zenodo_upload.py on lines 46..48
xce/helpers/prepare_for_zenodo_upload.py on lines 50..52
xce/helpers/prepare_for_zenodo_upload.py on lines 58..60
xce/helpers/prepare_for_zenodo_upload.py on lines 62..64
xce/helpers/prepare_for_zenodo_upload.py on lines 66..68
xce/helpers/prepare_for_zenodo_upload.py on lines 70..72
xce/helpers/prepare_for_zenodo_upload.py on lines 93..95
xce/helpers/prepare_for_zenodo_upload.py on lines 97..100
xce/helpers/prepare_for_zenodo_upload.py on lines 102..107

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

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

        if "icbs/" in line:
            line = line.replace(
                "icbs/", "https://zenodo.org/record/" + uploadID + "/files/"
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 42..44
xce/helpers/prepare_for_zenodo_upload.py on lines 46..48
xce/helpers/prepare_for_zenodo_upload.py on lines 50..52
xce/helpers/prepare_for_zenodo_upload.py on lines 54..56
xce/helpers/prepare_for_zenodo_upload.py on lines 58..60
xce/helpers/prepare_for_zenodo_upload.py on lines 66..68
xce/helpers/prepare_for_zenodo_upload.py on lines 70..72
xce/helpers/prepare_for_zenodo_upload.py on lines 93..95
xce/helpers/prepare_for_zenodo_upload.py on lines 97..100
xce/helpers/prepare_for_zenodo_upload.py on lines 102..107

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

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

        if "mapImages/" in line:
            line = line.replace(
                "mapImages/", "https://zenodo.org/record/" + uploadID + "/files/"
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 42..44
xce/helpers/prepare_for_zenodo_upload.py on lines 46..48
xce/helpers/prepare_for_zenodo_upload.py on lines 50..52
xce/helpers/prepare_for_zenodo_upload.py on lines 54..56
xce/helpers/prepare_for_zenodo_upload.py on lines 62..64
xce/helpers/prepare_for_zenodo_upload.py on lines 66..68
xce/helpers/prepare_for_zenodo_upload.py on lines 70..72
xce/helpers/prepare_for_zenodo_upload.py on lines 93..95
xce/helpers/prepare_for_zenodo_upload.py on lines 97..100
xce/helpers/prepare_for_zenodo_upload.py on lines 102..107

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

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

            if "../compoundImages/" in line:
                line = line.replace(
                    "../compoundImages/",
                    "https://zenodo.org/record/" + uploadID + "/files/",
Severity: Major
Found in xce/helpers/prepare_for_zenodo_upload.py and 10 other locations - About 40 mins to fix
xce/helpers/prepare_for_zenodo_upload.py on lines 42..44
xce/helpers/prepare_for_zenodo_upload.py on lines 46..48
xce/helpers/prepare_for_zenodo_upload.py on lines 50..52
xce/helpers/prepare_for_zenodo_upload.py on lines 54..56
xce/helpers/prepare_for_zenodo_upload.py on lines 58..60
xce/helpers/prepare_for_zenodo_upload.py on lines 62..64
xce/helpers/prepare_for_zenodo_upload.py on lines 66..68
xce/helpers/prepare_for_zenodo_upload.py on lines 70..72
xce/helpers/prepare_for_zenodo_upload.py on lines 93..95
xce/helpers/prepare_for_zenodo_upload.py on lines 102..107

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

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

There are no issues that match your filters.

Category
Status