MAXakaWIZARD/xls-writer

View on GitHub

Showing 58 of 58 total issues

Consider simplifying this complex logical expression.
Open

        if (($red < 0 || $red > 255)
            || ($green < 0 || $green > 255)
            || ($blue < 0 || $blue > 255)
        ) {
            throw new \Exception("Color component outside range: 0 <= color <= 255");
Severity: Major
Found in src/Palette.php - About 40 mins to fix

    Method getData has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function getData($x, $y, $rowTop, $colLeft, $activePane)
    Severity: Minor
    Found in src/Record/Pane.php - About 35 mins to fix

      Method writeUrl has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function writeUrl($row, $col, $url, $label = '', $format = null)
      Severity: Minor
      Found in src/Worksheet.php - About 35 mins to fix

        Method setValidation has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function setValidation($row1, $col1, $row2, $col2, $validator)
        Severity: Minor
        Found in src/Worksheet.php - About 35 mins to fix

          Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  $rowFrom = 0,
                  $colFrom = 0,
                  $rowTo = null,
                  $colTo = null,
                  $normalize = true
          Severity: Minor
          Found in src/Range.php - About 35 mins to fix

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

                protected function calcSize($list)
                {
                    $iSBcnt = 0;
                    $iBBcnt = 0;
                    foreach ($list as $item) {
            Severity: Minor
            Found in src/OLE/PpsRoot.php - 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 fact has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function fact()
                {
                    if ($this->currentToken == Token::TOKEN_OPEN) {
                        $this->advance(); // eat the "("
            
            
            Severity: Minor
            Found in src/FormulaParser.php - 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

            Avoid too many return statements within this method.
            Open

                        return '';
            Severity: Major
            Found in src/FormulaParser.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $result;
              Severity: Major
              Found in src/FormulaParser.php - About 30 mins to fix

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

                    public function printRepeatRows($firstRow, $lastRow = null)
                    {
                        if (!isset($lastRow)) {
                            $lastRow = $firstRow;
                        }
                Severity: Minor
                Found in src/PrintSetup.php and 1 other location - About 30 mins to fix
                src/PrintSetup.php on lines 191..210

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

                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 method.
                Open

                            return $this->convertRange3d($token);
                Severity: Major
                Found in src/FormulaParser.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return pack("C", Ptg::get($token));
                  Severity: Major
                  Found in src/FormulaParser.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return $this->convertRange2d($token);
                    Severity: Major
                    Found in src/FormulaParser.php - About 30 mins to fix

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

                          public function printRepeatColumns($firstCol, $lastCol = null)
                          {
                              if (!isset($lastCol)) {
                                  $lastCol = $firstCol;
                              }
                      Severity: Minor
                      Found in src/PrintSetup.php and 1 other location - About 30 mins to fix
                      src/PrintSetup.php on lines 162..181

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

                      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 method.
                      Open

                              return null;
                      Severity: Major
                      Found in src/Worksheet.php - About 30 mins to fix

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

                            protected function storeAllNumFormats()
                            {
                                $map = array();
                                $index = 164;
                        
                        
                        Severity: Minor
                        Found in src/Workbook.php - 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 calculateActivePane has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function calculateActivePane($x, $y)
                            {
                                if ($x != 0 && $y != 0) {
                                    return 0; // Bottom right
                                } elseif ($x != 0 && $y == 0) {
                        Severity: Minor
                        Found in src/Worksheet.php - 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 positionImage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function positionImage($colStart, $rowStart, $x1, $y1, $width, $height)
                            {
                                // Initialise end cell to the same as the start cell
                                $colEnd = $colStart; // Col containing lower right corner of object
                                $rowEnd = $rowStart; // Row containing bottom right corner of object
                        Severity: Minor
                        Found in src/Worksheet.php - 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