laudis-technologies/fiscal

View on GitHub

Showing 9 of 11 total issues

File FiscalRepository.php has 324 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * This file is part of the Laudis Fiscal package.
 *
Severity: Minor
Found in src/FiscalRepository.php - About 3 hrs to fix

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

        private function sortAndSplitRanges(Vector $ranges): Vector
        {
            $ranges = $ranges
                ->filter($this->validRangePredicate())
                ->filter($this->duplicateRangePredicate())
    Severity: Minor
    Found in src/FiscalRepository.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 run has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function run(): void
        {
            $ivs = $this->pullIndexedValues();
            $scales = $this->query('SELECT * FROM scales')->fetchAll(PDO::FETCH_ASSOC);
            $emptyStart = $this->faker->numberBetween(0, 4) === 0;
    Severity: Minor
    Found in database/seeds/ScaleRuleSeed.php - About 1 hr to fix

      Function run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function run(): void
          {
              $ivs = $this->pullIndexedValues();
              $scales = $this->query('SELECT * FROM scales')->fetchAll(PDO::FETCH_ASSOC);
              $emptyStart = $this->faker->numberBetween(0, 4) === 0;
      Severity: Minor
      Found in database/seeds/ScaleRuleSeed.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 run has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function run(): void
          {
              $ivs = $this->query(<<<SQL
      SELECT iv.slug as slug,
              iv.id as id,
      Severity: Minor
      Found in database/seeds/IndexedValueVersionSeed.php - About 1 hr to fix

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

            private function sortAndSplitRanges(Vector $ranges): Vector
            {
                $ranges = $ranges
                    ->filter($this->validRangePredicate())
                    ->filter($this->duplicateRangePredicate())
        Severity: Minor
        Found in src/FiscalRepository.php - About 1 hr to fix

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

              private function limitAndMergeRanges(Map $scaleRanges, Map $scaleToIndexedValueMapping, Map $indexedValueRanges): void
              {
                  foreach ($scaleRanges as $slug => $ranges) {
                      $min = PHP_INT_MAX;
                      $max = PHP_INT_MIN;
          Severity: Minor
          Found in src/FiscalRepository.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

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

              public function __construct(int $id, string $slug, string $name, float $value, IndexType $type, int $precision)
          Severity: Minor
          Found in src/IndexedValue.php - About 45 mins to fix

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

                public function run(): void
                {
                    $ivs = $this->query(<<<SQL
            SELECT iv.slug as slug,
                    iv.id as id,
            Severity: Minor
            Found in database/seeds/IndexedValueVersionSeed.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

            Severity
            Category
            Status
            Source
            Language