giansalex/greenter

View on GitHub

Showing 97 of 97 total issues

Method load has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function load(ClassMetadata $metadata)
    {
        $metadata->addPropertyConstraints('unidad', [
            new Assert\NotBlank(),
        ]);
Severity: Minor
Found in packages/validator/src/Validator/Loader/v21/SaleDetailLoader.php - About 1 hr to fix

    Method load has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function load(ClassMetadata $metadata)
        {
            $metadata->addPropertyConstraints('serie', [
                new Assert\NotBlank(),
                new Assert\Length(['max' => 4]),
    Severity: Minor
    Found in packages/validator/src/Validator/Loader/PerceptionLoader.php - About 1 hr to fix

      Method loadTotals has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function loadTotals(Note $inv, DOMNode $node = null)
          {
              if (empty($node)) {
                  return;
              }
      Severity: Minor
      Found in packages/xml-parser/src/Xml/Parser/NoteParser.php - About 1 hr to fix

        Method load has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function load(ClassMetadata $metadata)
            {
                $metadata->addPropertyConstraints('serie', [
                    new Assert\NotBlank(),
                    new Assert\Length(['max' => 4]),
        Severity: Minor
        Found in packages/validator/src/Validator/Loader/RetentionLoader.php - About 1 hr to fix

          Function loadTotals has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private function loadTotals(Invoice $inv, DOMXPath $xpt, DOMNode $node = null)
              {
                  if (empty($node)) {
                      return;
                  }
          Severity: Minor
          Found in packages/xml-parser/src/Xml/Parser/InvoiceParser.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 processResponse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function processResponse($status): StatusResult
              {
                  $originCode = $status->statusCode;
                  $code = (int)$originCode;
          
          
          Severity: Minor
          Found in packages/ws/src/Ws/Services/ExtService.php - About 1 hr to fix

            Method processResponse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function processResponse(StatusResponse $status): StatusResult
                {
                    $code = $status->getCodRespuesta();
            
                    $result = new StatusResult();
            Severity: Minor
            Found in packages/ws/src/Api/GreSender.php - About 1 hr to fix

              Method getShipment has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getShipment()
                  {
                      $xml = $this->reader;
                      $node = $xml->getNode('cac:Shipment', $this->rootNode);
              
              
              Severity: Minor
              Found in packages/xml-parser/src/Xml/Parser/DespatchParser.php - About 1 hr to fix

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

                    public function load(ClassMetadata $metadata)
                    {
                        $metadata->addPropertyConstraints('tipoDoc', [
                            new Assert\NotBlank(),
                            new Assert\Length(['max' => 2]),
                Severity: Minor
                Found in packages/validator/src/Validator/Loader/RetentionDetailLoader.php - About 1 hr to fix

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

                      public function getTemplate(DocumentInterface $document): ?string
                      {
                          $className = get_class($document);
                          switch ($className) {
                              case Invoice::class:
                  Severity: Minor
                  Found in packages/report/src/Report/Resolver/DefaultTemplateResolver.php - About 1 hr to fix

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

                        private function getStatusResult(string $method, string $resultName, string $ruc, string $tipo, string $serie, int $numero)
                    Severity: Minor
                    Found in packages/ws/src/Ws/Services/ConsultCdrService.php - About 45 mins to fix

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

                          private function loadTotals(Note $inv, DOMNode $node = null)
                          {
                              if (empty($node)) {
                                  return;
                              }
                      Severity: Minor
                      Found in packages/xml-parser/src/Xml/Parser/NoteParser.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

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

                      <?php
                      /**
                       * Created by PhpStorm.
                       * User: Giansalex
                       * Date: 17/07/2017
                      Severity: Major
                      Found in packages/core/src/Core/Model/Sale/Document.php and 2 other locations - About 45 mins to fix
                      packages/core/src/Core/Model/Despatch/Puerto.php on lines 1..57
                      packages/core/src/Core/Model/Sale/Legend.php on lines 1..67

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

                      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

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

                      <?php
                      
                      declare(strict_types=1);
                      
                      namespace Greenter\Model\Despatch;
                      Severity: Major
                      Found in packages/core/src/Core/Model/Despatch/Puerto.php and 2 other locations - About 45 mins to fix
                      packages/core/src/Core/Model/Sale/Document.php on lines 1..67
                      packages/core/src/Core/Model/Sale/Legend.php on lines 1..67

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

                      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

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

                      <?php
                      /**
                       * Created by PhpStorm.
                       * User: Giansalex
                       * Date: 17/07/2017
                      Severity: Major
                      Found in packages/core/src/Core/Model/Sale/Legend.php and 2 other locations - About 45 mins to fix
                      packages/core/src/Core/Model/Despatch/Puerto.php on lines 1..57
                      packages/core/src/Core/Model/Sale/Document.php on lines 1..67

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

                      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

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

                          private function getCompany()
                          {
                              $xml = $this->reader;
                              $node = $xml->getNode('cac:AccountingSupplierParty', $this->rootNode);
                      
                      
                      Severity: Minor
                      Found in packages/xml-parser/src/Xml/Parser/SummaryParser.php and 1 other location - About 40 mins to fix
                      packages/xml-parser/src/Xml/Parser/VoidedParser.php on lines 62..73

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

                      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

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

                          private function getCompany()
                          {
                              $xml = $this->reader;
                              $node = $xml->getNode('cac:AccountingSupplierParty', $this->rootNode);
                      
                      
                      Severity: Minor
                      Found in packages/xml-parser/src/Xml/Parser/VoidedParser.php and 1 other location - About 40 mins to fix
                      packages/xml-parser/src/Xml/Parser/SummaryParser.php on lines 65..76

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

                      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

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

                          private function processResponse(StatusResponse $status): StatusResult
                          {
                              $code = $status->getCodRespuesta();
                      
                              $result = new StatusResult();
                      Severity: Minor
                      Found in packages/ws/src/Api/GreSender.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 getTemplate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getTemplate(DocumentInterface $document): ?string
                          {
                              $className = get_class($document);
                              switch ($className) {
                                  case Invoice::class:
                      Severity: Minor
                      Found in packages/report/src/Report/Resolver/DefaultTemplateResolver.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 '40';
                      Severity: Major
                      Found in packages/ws/src/Ws/Reader/XmlFilenameExtractor.php - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language