hackedteam/vector-edk

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

Summary

Maintainability
F
5 days
Test Coverage

File faqwiz.py has 741 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Generic FAQ Wizard.

This is a CGI program that maintains a user-editable FAQ.  It uses RCS
to keep track of changes to individual FAQ entries.  It is fully
configurable; everything you might want to change when using this
Severity: Major
Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.py - About 1 day to fix

    Function show has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def show(self, edit=1):
            emit(ENTRY_HEADER1, self)
            self.emit_marks()
            emit(ENTRY_HEADER2, self)
            pre = 0
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.py - About 5 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 do_search has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def do_search(self):
            query = self.ui.query
            if not query:
                self.error("Empty query string!")
                return
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.py - About 4 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

    FaqWizard has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class FaqWizard:
    
        def __init__(self):
            self.ui = UserInput()
            self.dir = FaqDir()
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.py - About 3 hrs to fix

      Function rlog has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def rlog(self, command, entry=None):
              output = os.popen(command).read()
              sys.stdout.write('<PRE>')
              athead = 0
              lines = output.split('\n')
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.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 format_index has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def format_index(self, files, add=0, localrefs=0):
              sec = 0
              for file in files:
                  try:
                      entry = self.dir.open(file)
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.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 translate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def translate(text, pre=0):
          global translate_prog
          if not translate_prog:
              translate_prog = prog = re.compile(
                  r'\b(http|ftp|https)://\S+(\b|/)|\b[-.\w]+@[-.\w]+')
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.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 do_review has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_review(self):
              send_my_cookie(self.ui)
              if self.ui.editversion == '*new*':
                  sec, num = self.dir.parse(self.ui.file)
                  entry = self.dir.new(section=sec)
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.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 do_recent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_recent(self):
              if not self.ui.days:
                  days = 1
              else:
                  days = float(self.ui.days)
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.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 commit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def commit(self, entry):
              file = entry.file
              # Normalize line endings in body
              if '\r' in self.ui.body:
                  self.ui.body = re.sub('\r\n?', '\n', self.ui.body)
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.py - About 1 hr to fix

        Function __getitem__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def __getitem__(self, key):
                for d in self.__d:
                    try:
                        value = d[key]
                        if value:
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.py - About 45 mins 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 format_all has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def format_all(self, files, edit=1, headers=1):
                sec = 0
                for file in files:
                    try:
                        entry = self.dir.open(file)
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.py - About 45 mins 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 commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def commit(self, entry):
                file = entry.file
                # Normalize line endings in body
                if '\r' in self.ui.body:
                    self.ui.body = re.sub('\r\n?', '\n', self.ui.body)
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.py - About 35 mins 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 last_changed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def last_changed(self, files):
                latest = 0
                for file in files:
                    entry = self.dir.open(file)
                    if entry:
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.py - About 25 mins 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 go has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def go(self):
                print 'Content-type: text/html'
                req = self.ui.req or 'home'
                mname = 'do_%s' % req
                try:
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqwiz.py - About 25 mins 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

        There are no issues that match your filters.

        Category
        Status