jacometoss/PyEWS

View on GitHub
electricalwiresizes/distributioncu.py

Summary

Maintainability
F
4 days
Test Coverage

Function redbtcu has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

def  redbtcu(network=None,conductors=None,view=None):

    if(network==None or conductors==None  or view==None):
        t = time.localtime()
        print('''
Severity: Minor
Found in electricalwiresizes/distributioncu.py - About 3 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

Avoid deeply nested control flow statements.
Open

                    if (network[i][2]==iDAlm[k]):
                        #Zpu se complementa
                        dtb[i].append(conductors[j][k])
                        #print (datos[j][k])
    #print ("-------------------------------------")                     
Severity: Major
Found in electricalwiresizes/distributioncu.py - About 45 mins to fix

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

        for i in range(len(network)):  
             for j in range(len(iDCal)):
                if (iDCal[j]==network[i][1]):
                    for k in range(len(iDAlm)):
                        if (network[i][2]==iDAlm[k]):
    Severity: Major
    Found in electricalwiresizes/distributioncu.py and 1 other location - About 1 day to fix
    electricalwiresizes/distributional.py on lines 37..43

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

    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

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

        for i in range(len(dtb)-1,-1,-1):
            #print ("Valor sumado: ",dtb[i][9]*dtb[i][11], "Index_",i)
            Isuma = (dtb[i][12]/(dtb[i][6]*dtb[i][7]))
            dtb[i].append(round(Isuma,3))    
    Severity: Major
    Found in electricalwiresizes/distributioncu.py and 1 other location - About 5 hrs to fix
    electricalwiresizes/distributional.py on lines 88..91

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

    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

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

        if view==1:
            print(tabulate(dtb,headers=["Punto","Cal.", "Fases", "D[m]", "P[W]","Fp", "T[V]", "Kcable", "In", "Psum+", "Dsum", "Is", "[Is][D]", "%Vd","%Vd+-"],tablefmt="psql"))
        elif view==2:
            print(dtb)
        else:
    Severity: Major
    Found in electricalwiresizes/distributioncu.py and 1 other location - About 4 hrs to fix
    electricalwiresizes/distributional.py on lines 100..105

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

    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

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

        for i in range(len(dtb)-1, -1, -1):
            #print ("Valor sumado: ",dtb[i][8], "Index_",i)
            Isuma += (dtb[i][13])
            dtb[i].append(round(Isuma,3))
    Severity: Major
    Found in electricalwiresizes/distributioncu.py and 1 other location - About 2 hrs to fix
    electricalwiresizes/distributional.py on lines 94..97

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

    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

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

        for i in range(len(dtb)):
            #print ("Valor sumado: ",dtb[i][9]*dtb[i][11], "Index_",i)
            dtb[i].append(dtb[i][11]*dtb[i][3])
    Severity: Major
    Found in electricalwiresizes/distributioncu.py and 1 other location - About 2 hrs to fix
    electricalwiresizes/distributional.py on lines 82..84

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

    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

        for i in range(len(dtb)-1, -1, -1):
            #print ("Valor sumado: ",dtb[i][3], "Index_",i)
            Isuma += (dtb[i][3])
            dtb[i].append(Isuma)
    Severity: Major
    Found in electricalwiresizes/distributioncu.py and 5 other locations - About 2 hrs to fix
    electricalwiresizes/distributional.py on lines 60..63
    electricalwiresizes/distributional.py on lines 68..71
    electricalwiresizes/distributional.py on lines 76..79
    electricalwiresizes/distributioncu.py on lines 60..63
    electricalwiresizes/distributioncu.py on lines 76..79

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

    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

        for i in range(len(dtb)-1, -1, -1):
            #print ("Valor sumado: ",dtb[i][8], "Index_",i)
            Isuma += (dtb[i][8])
            dtb[i].append(Isuma)
    Severity: Major
    Found in electricalwiresizes/distributioncu.py and 5 other locations - About 2 hrs to fix
    electricalwiresizes/distributional.py on lines 60..63
    electricalwiresizes/distributional.py on lines 68..71
    electricalwiresizes/distributional.py on lines 76..79
    electricalwiresizes/distributioncu.py on lines 60..63
    electricalwiresizes/distributioncu.py on lines 68..71

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

    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

        for i in range(len(dtb)-1, -1, -1):
            #print ("Valor sumado: ",dtb[i][4], "Index_",i)
            Isuma += (dtb[i][4])
            dtb[i].append(Isuma)
    Severity: Major
    Found in electricalwiresizes/distributioncu.py and 5 other locations - About 2 hrs to fix
    electricalwiresizes/distributional.py on lines 60..63
    electricalwiresizes/distributional.py on lines 68..71
    electricalwiresizes/distributional.py on lines 76..79
    electricalwiresizes/distributioncu.py on lines 68..71
    electricalwiresizes/distributioncu.py on lines 76..79

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

    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(network==None or conductors==None  or view==None):
            t = time.localtime()
            print('''
                     :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                                    
    Severity: Major
    Found in electricalwiresizes/distributioncu.py and 1 other location - About 1 hr to fix
    electricalwiresizes/distributional.py on lines 8..27

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

    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

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

        for i in range(len(network)):
            #Agregamos la corriente a la tabla
            dtb[i].append(sistemaIn(network,i))
    Severity: Minor
    Found in electricalwiresizes/distributioncu.py and 1 other location - About 40 mins to fix
    electricalwiresizes/distributional.py on lines 47..49

    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