GoVanguard/legion

View on GitHub

Showing 217 of 217 total issues

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

        self.MainTabWidget.setTabText(self.MainTabWidget.indexOf(self.BruteTab),
                                      QtWidgets.QApplication.translate("MainWindow", "Brute", 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 400..401
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/vmware-big.jpg")
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.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

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

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

            return
Severity: Major
Found in controller/controller.py - About 30 mins to fix

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

        self.ServicesTabWidget.setTabText(self.ServicesTabWidget.indexOf(self.NotesTab),
                                          QtWidgets.QApplication.translate("MainWindow", "Notes", 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 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.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

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

def isWsl():
    release = str(platform.uname().release).lower()
    return "microsoft" in release
Severity: Minor
Found in app/auxiliary.py and 1 other location - About 30 mins to fix
app/auxiliary.py on lines 52..54

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

def isKali():
    release = str(platform.uname().release).lower()
    return "kali" in release
Severity: Minor
Found in app/auxiliary.py and 1 other location - About 30 mins to fix
app/auxiliary.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 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

Function getTempFolder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def getTempFolder():
    if isWsl():
        tempPathWin = "{0}\\legion\\tmp".format(getAppdataTemp())
        tempPath = winPath2Unix(tempPathWin)
        if not os.path.isdir(os.path.expanduser(tempPath)):
Severity: Minor
Found in app/auxiliary.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 contextMenuProcessesTableView has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def contextMenuProcessesTableView(self, pos):
        if self.ui.ProcessesTableView.selectionModel() and self.ui.ProcessesTableView.selectionModel().selectedRows():
    
            menu = self.controller.getContextMenuForProcess()
            menu.aboutToShow.connect(self.setVisible)
Severity: Minor
Found in ui/view.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 backupAndSave has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def backupAndSave(self, newSettings, saveBackup=True):
        # Backup and save
        if saveBackup:
            log.info('Backing up old settings and saving new settings...')
            os.rename(os.path.expanduser('~/.local/share/legion/legion.conf'), os.path.expanduser("~/.local/share/legion/backup/") + getTimestamp() + '-legion.conf')
Severity: Minor
Found in app/settings.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 validateUniqueToolName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validateUniqueToolName(self, widget, tablerow, text):
        if tablerow != -1:
            for row in [i for i in range(widget.rowCount()) if i not in [tablerow]]:
                if widget.item(row,0).text() == text:
                    return False
Severity: Minor
Found in ui/settingsDialog.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 getCves has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def getCves(self):
        cveOutput = self.output
        cveObjects = []

        if len(cveOutput) > 0:
Severity: Minor
Found in parsers/Script.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 updateSettings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def updateSettings(self):
         # LEO: reorganised stuff in a more logical way but no changes were made yet :)
        # update GENERAL tab settings
        self.settings.general_default_terminal = str(self.terminalComboBox.currentText())
        self.settings.general_max_fast_processes = str(self.fastProcessesComboBox.currentText())
Severity: Minor
Found in ui/settingsDialog.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

Severity
Category
Status
Source
Language