Hackman238/legion

View on GitHub

Showing 217 of 217 total issues

Avoid deeply nested control flow statements.
Open

                        if tool[0] == a[1]:
                            tabTitle = a[1] + " (" + port + "/" + protocol + ")"
                            # Cheese
                            outputfile = self.logic.activeProject.properties.runningFolder + "/" + \
                                         re.sub("[^0-9a-zA-Z]", "", str(tool[0])) + \
Severity: Major
Found in controller/controller.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                           if len(nmapOptionValueSplit) > 1:
                               nmapOptionValue = nmapOptionValueSplit[1].replace(']','')
                               nmapOptions.append(nmapOptionValue)
                    nmapOptions.append(str(self.adddialog.txtCustomOptList.text()))
    Severity: Major
    Found in ui/view.py - About 45 mins to fix

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

          def __init__(self, name, host, product='', version='', extrainfo='', fingerprint=''):
      Severity: Minor
      Found in db/entities/service.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if len(tool) == 4:
                                    servicesList = tool[3].split(',')
                                    self.terminalServicesActiveTable.setRowCount(len(servicesList))
                                    for i in range(len(servicesList)):
                                        self.terminalServicesActiveTable.setItem(i, 0, QtWidgets.QTableWidgetItem())
        Severity: Major
        Found in ui/settingsDialog.py - About 45 mins to fix

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

          def sortArrayWithArray(array, arrayToSort):
              for i in range(0, len(array) - 1):
                  swap_test = False
                  for j in range(0, len(array) - i - 1):
                      if array[j] > array[j + 1]:
          Severity: Minor
          Found in app/auxiliary.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

          Avoid deeply nested control flow statements.
          Open

                                  if isWsl():
                                      command = "{0} -oA {1}".format(command, unixPath2Win(outputfile))
                                  else:
                                      command = "{0} -oA {1}".format(command, outputfile)
          
          
          Severity: Major
          Found in controller/controller.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if host in targets:
                                        targets.remove(host)
                            
            Severity: Major
            Found in ui/view.py - About 45 mins to fix

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

                  def restoreToolTabsForHost(self, ip):
                      if (self.viewState.hostTabs) and (ip in self.viewState.hostTabs):
                          tabs = self.viewState.hostTabs[ip]    # use the ip as a key to retrieve its list of tooltabs
                          for tab in tabs:
                              # do not display hydra and nmap tabs when restoring for that host
              Severity: Minor
              Found in ui/view.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

              Avoid deeply nested control flow statements.
              Open

                                      if len(tool) == 4:
                                          servicesList = tool[3].split(',')
                                          self.terminalServicesActiveTable.setRowCount(len(servicesList))
                                          for i in range(len(servicesList)):
                                              self.terminalServicesActiveTable.setItem(i, 0, QtWidgets.QTableWidgetItem())
              Severity: Major
              Found in ui/settingsDialog.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if p[1] == "Waiting":
                                            if str(self.logic.activeProject.repositoryContainer.processRepository.getStatusByProcessId(
                                                    p[2])) == 'Running':
                                                self.killProcess(self.view.ProcessesTableModel.getProcessPidForId(p[2]), p[2])
                                            self.logic.activeProject.repositoryContainer.processRepository.storeProcessCancelStatus(
                Severity: Major
                Found in controller/controller.py - About 45 mins to fix

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

                      def restoreToolTabs(self):
                          # false means we are fetching processes with display flag=False, which is the case for every process once
                          # a project is closed.
                          tools = self.controller.getProcessesFromDB(self.viewState.filters, showProcesses=False)
                          nbr = len(tools)  # show a progress bar because this could take long
                  Severity: Minor
                  Found in ui/view.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(self, name='', product='', version='', extrainfo='', fingerprint='', cpe=''):
                  Severity: Minor
                  Found in db/entities/app.py - About 45 mins to fix

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

                        def checkProcessQueue(self):
                            log.debug('Queue maximum concurrent processes: {0}'.format(str(self.settings.general_max_fast_processes)))
                            log.debug('Queue processes running: {0}'.format(str(self.fastProcessesRunning)))
                            log.debug('Queue processes waiting: {0}'.format(str(self.fastProcessQueue.qsize())))
                    
                    
                    Severity: Minor
                    Found in controller/controller.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

                    Avoid deeply nested control flow statements.
                    Open

                                            if not (s is None):
                                                self.runToolsFor(s.name, h.hostname, h.ip, p.portId, p.protocol)
                    
                    
                    Severity: Major
                    Found in controller/controller.py - About 45 mins to fix

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

                      def clearLayout(layout):
                          if layout != None:
                              while layout.count():
                                  item = layout.takeAt(0)
                                  widget = item.widget()
                      Severity: Minor
                      Found in app/auxiliary.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

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

                              if not self.portsUdp.isChecked() == filters[7]:
                                  self.portsUdp.toggle()
                      Severity: Major
                      Found in ui/dialogs.py and 7 other locations - About 45 mins to fix
                      ui/dialogs.py on lines 486..487
                      ui/dialogs.py on lines 489..490
                      ui/dialogs.py on lines 492..493
                      ui/dialogs.py on lines 495..496
                      ui/dialogs.py on lines 498..499
                      ui/dialogs.py on lines 501..502
                      ui/dialogs.py on lines 504..505

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

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

                              self.searchIcon.addPixmap(QtGui.QPixmap(_fromUtf8("./images/search.png")), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
                      Severity: Major
                      Found in ui/gui.py and 4 other locations - About 45 mins to fix
                      ui/addHostDialog.py on lines 262..262
                      ui/addHostDialog.py on lines 269..270
                      ui/gui.py on lines 99..100
                      ui/gui.py on lines 107..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 35.

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

                              if not self.portsClosed.isChecked() == filters[5]:
                                  self.portsClosed.toggle()
                      Severity: Major
                      Found in ui/dialogs.py and 7 other locations - About 45 mins to fix
                      ui/dialogs.py on lines 486..487
                      ui/dialogs.py on lines 489..490
                      ui/dialogs.py on lines 492..493
                      ui/dialogs.py on lines 495..496
                      ui/dialogs.py on lines 498..499
                      ui/dialogs.py on lines 504..505
                      ui/dialogs.py on lines 507..508

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

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

                              self.cancelIcon.addPixmap(QtGui.QPixmap(_fromUtf8("./images/minus-black.png")), QtGui.QIcon.Mode.Normal,
                                                        QtGui.QIcon.State.Off)
                      Severity: Major
                      Found in ui/addHostDialog.py and 4 other locations - About 45 mins to fix
                      ui/addHostDialog.py on lines 262..262
                      ui/gui.py on lines 92..92
                      ui/gui.py on lines 99..100
                      ui/gui.py on lines 107..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 35.

                      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

                              self.rdoModeOptHard.clicked.connect(lambda: flipState(targetState = self.rdoModeOptHard.isChecked(),
                      Severity: Minor
                      Found in ui/addHostDialog.py and 1 other location - About 45 mins to fix
                      ui/addHostDialog.py on lines 306..306

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language