klitsche/dog

View on GitHub

Showing 80 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->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

      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

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

                          public function matches(ElementInterface $element): bool
                          {
                              foreach ($this->match as $method => $expectedResult) {
                                  if (method_exists($element, $method) === false) {
                                      return false;
                      Severity: Minor
                      Found in src/Analyzer/Rule.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 getReturnType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getReturnType(): ?Type
                          {
                              if ($this->getDocBlock() && $this->getDocBlock()->hasTag('return')) {
                                  /** @var DocBlock\Tags\Return_ $tag */
                                  $tag = $this->getDocBlock()->getTagsByName('return')[0];
                      Severity: Minor
                      Found in src/Elements/Method.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 validateFunction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function validateFunction(ElementInterface $element): iterable
                          {
                              foreach ($element->getArguments() as $i => $argument) {
                                  if (
                                      $argument->getType() === null
                      Severity: Minor
                      Found in src/Analyzer/Rules/TypeMissingRule.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