hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py

Summary

Maintainability
F
1 wk
Test Coverage

Function complete has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

    def complete(self):
        self.indentsize = 1
        stack = []
        todo = []
        thisid = ''
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py - About 1 day 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

File pindent.py has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/env python

# This file contains a class and a main program that perform three
# related (though complimentary) formatting operations on Python
# programs.  When called as "pindent -c", it takes a valid Python
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py - About 4 hrs to fix

    Function test has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def test():
        import getopt
        try:
            opts, args = getopt.getopt(sys.argv[1:], 'cdrs:t:e')
        except getopt.error, msg:
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.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

    Function reformat has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def reformat(self):
            stack = []
            while 1:
                line = self.getline()
                if not line: break      # EOF
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.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 delete has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def delete(self):
            begin_counter = 0
            end_counter = 0
            while 1:
                line = self.getline()
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.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

    Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, fpi = sys.stdin, fpo = sys.stdout,
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py - About 35 mins to fix

      Function complete_filter has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def complete_filter(input = sys.stdin, output = sys.stdout,
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py - About 35 mins to fix

        Function reformat_filter has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def reformat_filter(input = sys.stdin, output = sys.stdout,
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py - About 35 mins to fix

          Function delete_filter has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def delete_filter(input= sys.stdin, output = sys.stdout,
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py - About 35 mins to fix

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

            def reformat_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
                source = open(filename, 'r').read()
                result = reformat_string(source, stepsize, tabsize, expandtabs)
                if source == result: return 0
                # end if
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 423..435
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 438..450

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

            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 delete_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
                source = open(filename, 'r').read()
                result = delete_string(source, stepsize, tabsize, expandtabs)
                if source == result: return 0
                # end if
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 423..435
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 453..465

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

            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 complete_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
                source = open(filename, 'r').read()
                result = complete_string(source, stepsize, tabsize, expandtabs)
                if source == result: return 0
                # end if
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 438..450
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 453..465

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

            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 delete_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
                input = StringReader(source)
                output = StringWriter()
                pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
                pi.delete()
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 399..404
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 415..420

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

            def complete_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
                input = StringReader(source)
                output = StringWriter()
                pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
                pi.complete()
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 407..412
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 415..420

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

            def reformat_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
                input = StringReader(source)
                output = StringWriter()
                pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
                pi.reformat()
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 399..404
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 407..412

            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

                    while line[-2:] == '\\\n':
                        line2 = self.readline()
                        if not line2: break
                        # end if
                        line = line + line2
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/ifdef.py on lines 59..62

            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 complete_filter(input = sys.stdin, output = sys.stdout,
                                stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
                pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
                pi.complete()
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 343..346
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 349..352

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

            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 delete_filter(input= sys.stdin, output = sys.stdout,
                                    stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
                pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
                pi.delete()
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 337..340
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 349..352

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

            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 reformat_filter(input = sys.stdin, output = sys.stdout,
                                stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS):
                pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs)
                pi.reformat()
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 337..340
            AppPkg/Applications/Python/Python-2.7.2/Tools/scripts/pindent.py on lines 343..346

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

            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