klitsche/dog

View on GitHub

Showing 103 of 103 total issues

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

    public function analyze(ElementInterface $element): iterable
    {
        if (
            $element instanceof DocBlockAwareInterface
            && $element instanceof ArgumentsAwareInterface
Severity: Minor
Found in src/Analyzer/Rules/DocBlockParamUnknownRule.php - About 1 hr to fix

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

        public function analyze(ElementInterface $element): iterable
        {
            if (
                $element instanceof DocBlockAwareInterface
                && $element->hasDocBlock() === true
    Severity: Minor
    Found in src/Analyzer/Rules/DocBlockParamNameOnlyOnceRule.php - About 1 hr to fix

      Method analyze has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function analyze(ElementInterface $element): iterable
          {
              if (
                  (
                      $element instanceof Method
      Severity: Minor
      Found in src/Analyzer/Rules/DocBlockReturnDescriptionRule.php - About 1 hr to fix

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

                if (
                    $element instanceof DocBlockAwareInterface
                    && $element->hasDocBlock() === true
                    && $element->getDocBlock()->hasTag('param') === true
                ) {
        Severity: Major
        Found in src/Analyzer/Rules/DocBlockParamTypeRule.php and 1 other location - About 1 hr to fix
        src/Analyzer/Rules/DocBlockApiVisibilityPublicRule.php on lines 21..46

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

        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 2 locations. Consider refactoring.
        Open

                if (
                    $element instanceof VisibilityAwareInterface
                    && $element instanceof DocBlockAwareInterface
                    && $element->hasDocBlock() === true
                    && $element->getDocBlock()->hasTag('api') === true
        Severity: Major
        Found in src/Analyzer/Rules/DocBlockApiVisibilityPublicRule.php and 1 other location - About 1 hr to fix
        src/Analyzer/Rules/DocBlockParamTypeRule.php on lines 20..44

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

        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

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

                int $complexity,
                int $methods,
                int $coveredmethods,
                int $conditionals,
                int $coveredconditionals,
        Severity: Major
        Found in src/Enrichers/Clover/ClassMetrics.php - About 1 hr to fix

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

              public function enrich(DataAwareInterface $dataHolder): void
              {
                  if ($dataHolder instanceof Interface_) {
                      $implementedBy = [];
                      $project = $dataHolder->getProject();
          Severity: Minor
          Found in src/Enrichers/ImplementedBy/ImplementedByEnricher.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 walk has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public function walk(iterable $elements): iterable
              {
                  foreach ($elements as $element) {
                      if ($element instanceof ElementInterface) {
                          yield $element;
          Severity: Minor
          Found in src/Elements/ElementsIndex.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 getArguments has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getArguments(): array
              {
                  if (isset($this->arguments) === false) {
                      $this->arguments = [];
                      if ($this->php !== null) {
          Severity: Minor
          Found in src/Elements/Method.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 outputError has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private function outputError(ErrorEvent $event): void
              {
                  $exception = $event->getThrowable();
                  $this->style->error(
                      [
          Severity: Minor
          Found in src/Cli/ErrorReporter.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 analyze has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function analyze(ElementInterface $element): iterable
              {
                  if (
                      $element instanceof VisibilityAwareInterface
                      && $element instanceof DocBlockAwareInterface
          Severity: Minor
          Found in src/Analyzer/Rules/DocBlockApiVisibilityPublicRule.php - About 1 hr to fix

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

                public function analyze(ElementInterface $element): iterable
                {
                    if (
                        $element instanceof DocBlockAwareInterface
                        && $element->hasDocBlock() === true
            Severity: Minor
            Found in src/Analyzer/Rules/DocBlockAuthorEmailRule.php - About 1 hr to fix

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

                  private function outputIssues(string $elementId, array $issues): void
                  {
                      $verbosity = $this->style->getVerbosity();
              
                      /** @var \Klitsche\Dog\Analyzer\Issue[] $filteredIssues */
              Severity: Minor
              Found in src/Cli/IssuesReporter.php - About 1 hr to fix

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

                    public function analyze(ElementInterface $element): iterable
                    {
                        if (
                            $element instanceof DocBlockAwareInterface
                            && $element->hasDocBlock() === true
                Severity: Minor
                Found in src/Analyzer/Rules/DocBlockAuthorNameMissingRule.php - About 1 hr to fix

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

                      public function analyze(ElementInterface $element): iterable
                      {
                          if (
                              $element instanceof DocBlockAwareInterface
                              && $element->hasDocBlock() === true
                  Severity: Minor
                  Found in src/Analyzer/Rules/DocBlockParamTypeRule.php - About 1 hr to fix

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

                        private function renderFile($template, $fileName, $context): void
                        {
                            $this->currentFileName = $fileName;
                    
                            $this->emitProgress(PrinterInterface::PROGRESS_TOPIC, 1, $fileName);
                    Severity: Minor
                    Found in src/Printer/Markdown/Printer.php - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (
                                  (
                                      $element->getReturnType() === null
                                      && $element->getName() !== '__construct'
                                      && $element->getName() !== '__destruct'
                      Severity: Major
                      Found in src/Analyzer/Rules/TypeMissingRule.php - About 1 hr to fix

                        Function getProperties has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getProperties(): array
                            {
                                if (isset($this->properties) === false) {
                                    $this->properties = [];
                                    foreach ($this->php->getProperties() as $property) {
                        Severity: Minor
                        Found in src/Elements/Trait_.php - About 55 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 enrich has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function enrich(DataAwareInterface $dataHolder): void
                            {
                                switch (true) {
                                    case $dataHolder instanceof ProjectInterface:
                                        $elements = $this->clover->xpath('//project');
                        Severity: Minor
                        Found in src/Enrichers/Clover/CloverEnricher.php - About 55 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 getMethods has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getMethods(): array
                            {
                                if (isset($this->methods) === false) {
                                    $this->methods = [];
                                    foreach ($this->php->getMethods() as $method) {
                        Severity: Minor
                        Found in src/Elements/Trait_.php - About 55 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