CORE-POS/IS4C

View on GitHub
fannie/classlib2.0/data/DataLoad.php

Summary

Maintainability
B
6 hrs
Test Coverage
C
76%

Method loadSampleData has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function loadSampleData($sql, $table, $search_dir='') 
    {
        $loaded = 0;
        $success = true;
        if (empty($search_dir)) {
Severity: Minor
Found in fannie/classlib2.0/data/DataLoad.php - About 1 hr to fix

    Function loadLinesFromCsv has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function loadLinesFromCsv($table, $file, $sql)
        {
            $fptr = fopen($file, 'r');
            $stmt = false;
            $ret = true;
    Severity: Minor
    Found in fannie/classlib2.0/data/DataLoad.php - 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 loadSampleData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function loadSampleData($sql, $table, $search_dir='') 
        {
            $loaded = 0;
            $success = true;
            if (empty($search_dir)) {
    Severity: Minor
    Found in fannie/classlib2.0/data/DataLoad.php - 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

    Method loadLinesFromCsv has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function loadLinesFromCsv($table, $file, $sql)
        {
            $fptr = fopen($file, 'r');
            $stmt = false;
            $ret = true;
    Severity: Minor
    Found in fannie/classlib2.0/data/DataLoad.php - About 1 hr to fix

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

          private static function loadFromSql($table, $file, $sql, &$loaded=null)
          {
              echo " from $table.sql<br>\n";
              $fptr = fopen($file, 'r');
              $ret = true;
      Severity: Minor
      Found in fannie/classlib2.0/data/DataLoad.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

      There are no issues that match your filters.

      Category
      Status