Saibamen/Generate-Sort-Numbers

View on GitHub

Showing 6 of 6 total issues

Function generateAndSaveRandomNumbers has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public static function generateAndSaveRandomNumbers($min, $max, $decimalPlaces, $maxFileSize, $filename, $fileExtension = '.dat', $delimiter = ' ')
    {
        $range = $max - $min;

        $minMaxNumberSize = self::getMinMaxNumberSize($min, $max, $decimalPlaces);
Severity: Minor
Found in Includes/Generate.php - 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

Method generateAndSaveRandomNumbers has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function generateAndSaveRandomNumbers($min, $max, $decimalPlaces, $maxFileSize, $filename, $fileExtension = '.dat', $delimiter = ' ')
    {
        $range = $max - $min;

        $minMaxNumberSize = self::getMinMaxNumberSize($min, $max, $decimalPlaces);
Severity: Major
Found in Includes/Generate.php - About 2 hrs to fix

    Method getBytesFromString has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getBytesFromString($input, $notation = 1024)
        {
            $error = true;
            $bytes = 0;
    
    
    Severity: Minor
    Found in Includes/Input.php - About 1 hr to fix

      Method generateAndSaveRandomNumbers has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function generateAndSaveRandomNumbers($min, $max, $decimalPlaces, $maxFileSize, $filename, $fileExtension = '.dat', $delimiter = ' ')
      Severity: Major
      Found in Includes/Generate.php - About 50 mins to fix

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

            public static function getFileSize($message, $default = '1MB')
            {
                echo $message.' [Default: '.$default.']: ';
        
                do {
        Severity: Minor
        Found in Includes/Input.php - 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 getBytesFromString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getBytesFromString($input, $notation = 1024)
            {
                $error = true;
                $bytes = 0;
        
        
        Severity: Minor
        Found in Includes/Input.php - 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

        Severity
        Category
        Status
        Source
        Language