ranguli/ioccheck

View on GitHub

Showing 8 of 8 total issues

Function urls has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def urls(self) -> Optional[List[dict]]:
        """URLs regarding the IOC"""
        urls = [{"service": "MalwareBazaar", "url": self.investigation_url}]

        vendor_intel = self._response_data.get("vendor_intel")
Severity: Minor
Found in ioccheck/services/malwarebazaar.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 behavior has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def behavior(self) -> List:
        """Behavior of samples detected by sandboxes"""
        behaviors: List = []

        if not self.vendor_intel:
Severity: Minor
Found in ioccheck/services/malwarebazaar.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 tags has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def tags(self) -> Set[str]:
        """User-submitted tags for the sample from the MalwareBazaar website"""
        tags: Set[str] = set()

        if self._response_data is None:
Severity: Minor
Found in ioccheck/services/malwarebazaar.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 run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def run(ioc, config, report):
    """Entrypoint for the ioccheck CLI"""

    printed_ioc = colored(ioc, HEADING_COLOR)
    print(f"Checking IOC {printed_ioc}.\n")
Severity: Minor
Found in ioccheck/cli/__init__.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 make_text has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def make_text(self) -> Optional[str]:
        table = [["Vendor", "Behaviour", "Threat"]]

        for result in self.ioc.behavior:  # type: ignore
            if result.threat is None:
Severity: Minor
Found in ioccheck/cli/printers.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 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Minor
Found in ioccheck/cli/printers.py - About 35 mins to fix

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

        def _get_cross_report_value(reports: list, attribute: str):
            result = []
    
            for report in reports:
                if report is not None and hasattr(report, attribute):
    Severity: Minor
    Found in ioccheck/iocs/ioc.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 detections has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def detections(self):
            """Detections with specific formatting applied for HTML reports"""
            detections = []
            for detection, result in self.ioc.detections.items():
                malicious = False
    Severity: Minor
    Found in ioccheck/reports/html_report.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