Hackman238/legion

View on GitHub

Showing 217 of 217 total issues

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

    def establishSqliteConnection(self, user: str, passw: str, db: str, host='localhost', port=5432):
Severity: Minor
Found in db/postgresDbAdapter.py - About 35 mins to fix

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

        def createNewTabForHost(self, ip, tabTitle, restoring=False, content='', filename=''):
    Severity: Minor
    Found in ui/view.py - About 35 mins to fix

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

          def __init__(self, ip, port, service, settings, parent=None):
      Severity: Minor
      Found in ui/dialogs.py - About 35 mins to fix

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

            def __init__(self, portId, protocol, state, host, service=''):
        Severity: Minor
        Found in db/entities/port.py - About 35 mins to fix

          Function selectGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def selectGroup(self):
                  tabSelected = -1
                  
                  if self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex()) == 'Host Commands':
                      tabSelected = 1
          Severity: Minor
          Found in ui/settingsDialog.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 getAllHosts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def getAllHosts(self, status=None):
                  '''get a list of Host object'''
                  if status is None:
                      return self.__hosts.values()
          
          
          Severity: Minor
          Found in parsers/Parser.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 getContextMenuForServiceName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def getContextMenuForServiceName(self, serviceName='*', menu=None):
                  if menu == None:  # if no menu was given, create a new one
                      menu = QMenu()
          
                  if serviceName == '*' or serviceName in self.settings.general_web_services.split(","):
          Severity: Minor
          Found in controller/controller.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

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

          def winPath2Unix(windowsPath):
              windowsPath = windowsPath.replace("\\", "/")
              windowsPath = windowsPath.replace("C:", "/mnt/c")
              return windowsPath
          Severity: Minor
          Found in app/auxiliary.py and 1 other location - About 35 mins to fix
          app/auxiliary.py on lines 41..44

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

          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

          Function sort has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def sort(self, Ncol, order):
                  self.layoutAboutToBeChanged.emit()
                  array=[]
                  
                  if Ncol == 1:
          Severity: Minor
          Found in ui/models/scriptmodels.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

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

          def unixPath2Win(posixPath):
              posixPath = posixPath.replace("/", "\\")
              posixPath = posixPath.replace("\\mnt\\c", "C:")
              return posixPath
          Severity: Minor
          Found in app/auxiliary.py and 1 other location - About 35 mins to fix
          app/auxiliary.py on lines 35..38

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

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

                  self.HostsTabWidget.setTabText(self.HostsTabWidget.indexOf(self.ServicesLeftTab),
                                                 QtWidgets.QApplication.translate("MainWindow", "Services", None))
          Severity: Major
          Found in ui/gui.py and 11 other locations - About 30 mins to fix
          ui/gui.py on lines 382..383
          ui/gui.py on lines 388..389
          ui/gui.py on lines 390..391
          ui/gui.py on lines 392..393
          ui/gui.py on lines 394..395
          ui/gui.py on lines 396..397
          ui/gui.py on lines 398..399
          ui/gui.py on lines 400..401
          ui/gui.py on lines 402..403
          ui/gui.py on lines 404..405
          ui/gui.py on lines 406..407

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

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

                  self.HostsTabWidget.setTabText(self.HostsTabWidget.indexOf(self.ToolsTab),
                                                 QtWidgets.QApplication.translate("MainWindow", "Tools", None))
          Severity: Major
          Found in ui/gui.py and 11 other locations - About 30 mins to fix
          ui/gui.py on lines 382..383
          ui/gui.py on lines 384..385
          ui/gui.py on lines 390..391
          ui/gui.py on lines 392..393
          ui/gui.py on lines 394..395
          ui/gui.py on lines 396..397
          ui/gui.py on lines 398..399
          ui/gui.py on lines 400..401
          ui/gui.py on lines 402..403
          ui/gui.py on lines 404..405
          ui/gui.py on lines 406..407

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

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

                  self.ServicesTabWidget.setTabText(self.ServicesTabWidget.indexOf(self.InformationTab),
                                                    QtWidgets.QApplication.translate("MainWindow", "Information", None))
          Severity: Major
          Found in ui/gui.py and 11 other locations - About 30 mins to fix
          ui/gui.py on lines 382..383
          ui/gui.py on lines 384..385
          ui/gui.py on lines 388..389
          ui/gui.py on lines 390..391
          ui/gui.py on lines 392..393
          ui/gui.py on lines 394..395
          ui/gui.py on lines 398..399
          ui/gui.py on lines 400..401
          ui/gui.py on lines 402..403
          ui/gui.py on lines 404..405
          ui/gui.py on lines 406..407

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

          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

          Avoid too many return statements within this function.
          Open

                              return QtGui.QIcon("./images/question-icon.png")
          Severity: Major
          Found in ui/models/hostmodels.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                return QtGui.QIcon("./images/hp-icon.png")
            Severity: Major
            Found in ui/models/hostmodels.py - About 30 mins to fix

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

                      self.ServicesTabWidget.setTabText(self.ServicesTabWidget.indexOf(self.ScriptsTab),
                                                        QtWidgets.QApplication.translate("MainWindow", "Scripts", None))
              Severity: Major
              Found in ui/gui.py and 11 other locations - About 30 mins to fix
              ui/gui.py on lines 382..383
              ui/gui.py on lines 384..385
              ui/gui.py on lines 388..389
              ui/gui.py on lines 390..391
              ui/gui.py on lines 392..393
              ui/gui.py on lines 396..397
              ui/gui.py on lines 398..399
              ui/gui.py on lines 400..401
              ui/gui.py on lines 402..403
              ui/gui.py on lines 404..405
              ui/gui.py on lines 406..407

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

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

                      self.MainTabWidget.setTabText(self.MainTabWidget.indexOf(self.ScanTab),
                                                    QtWidgets.QApplication.translate("MainWindow", "Scan", None))
              Severity: Major
              Found in ui/gui.py and 11 other locations - About 30 mins to fix
              ui/gui.py on lines 382..383
              ui/gui.py on lines 384..385
              ui/gui.py on lines 388..389
              ui/gui.py on lines 390..391
              ui/gui.py on lines 392..393
              ui/gui.py on lines 394..395
              ui/gui.py on lines 396..397
              ui/gui.py on lines 398..399
              ui/gui.py on lines 402..403
              ui/gui.py on lines 404..405
              ui/gui.py on lines 406..407

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

              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

              Avoid too many return statements within this function.
              Open

                          return value
              Severity: Major
              Found in ui/models/hostmodels.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return QtGui.QIcon("./images/hp-icon.png")
                Severity: Major
                Found in ui/models/hostmodels.py - About 30 mins to fix

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

                          self.ServicesTabWidget.setTabText(self.ServicesTabWidget.indexOf(self.CvesRightTab),
                                                            QtWidgets.QApplication.translate("MainWindow", "CVEs", None))
                  Severity: Major
                  Found in ui/gui.py and 11 other locations - About 30 mins to fix
                  ui/gui.py on lines 382..383
                  ui/gui.py on lines 384..385
                  ui/gui.py on lines 388..389
                  ui/gui.py on lines 390..391
                  ui/gui.py on lines 394..395
                  ui/gui.py on lines 396..397
                  ui/gui.py on lines 398..399
                  ui/gui.py on lines 400..401
                  ui/gui.py on lines 402..403
                  ui/gui.py on lines 404..405
                  ui/gui.py on lines 406..407

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

                  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