Showing 3,272 of 4,939 total issues

Avoid too many return statements within this method.
Open

            return;
Severity: Major
Found in .phan/plugins/SleepCheckerPlugin.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $this->context;
    Severity: Major
    Found in .phan/plugins/InvalidVariableIssetPlugin.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return true;
      Severity: Major
      Found in .phan/plugins/PossiblyStaticMethodPlugin.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return;
        Severity: Major
        Found in tool/phan_repl_helpers.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return;
          Severity: Major
          Found in .phan/plugins/PHPDocRedundantPlugin.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return;
            Severity: Major
            Found in .phan/plugins/RemoveDebugStatementPlugin.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return;
              Severity: Major
              Found in .phan/plugins/NotFullyQualifiedUsagePlugin.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return $node;
                Severity: Major
                Found in .phan/plugins/DuplicateExpressionPlugin.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return;
                  Severity: Major
                  Found in .phan/plugins/PregRegexCheckerPlugin.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return true;
                    Severity: Major
                    Found in .phan/plugins/PossiblyStaticMethodPlugin.php - About 30 mins to fix

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

                          public static function shouldParse(string $file_path): bool
                          {
                              $exclude_file_regex = Config::getValue('exclude_file_regex');
                              if ($exclude_file_regex && self::isPathMatchedByRegex($exclude_file_regex, $file_path)) {
                                  return false;
                      Severity: Minor
                      Found in src/Phan/CLI.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 debugProgress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function debugProgress(string $msg, float $p, $details): void
                          {
                              $pct = \sprintf("%d%%", (int)(100 * self::boundPercentage($p)));
                      
                              if ($details === null) {
                      Severity: Minor
                      Found in src/Phan/CLI.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 detectAndConfigureColorSupport has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private static function detectAndConfigureColorSupport(array $opts): void
                          {
                              if (is_string($opts['color-scheme'] ?? false)) {
                                  \putenv('PHAN_COLOR_SCHEME=' . $opts['color-scheme']);
                              }
                      Severity: Minor
                      Found in src/Phan/CLI.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 renderInnerProgressBar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private static function renderInnerProgressBar(int $length, float $p): string
                          {
                              $current_float = $p * $length;
                              $current = (int)$current_float;
                              $rest = \max($length - $current, 0);
                      Severity: Minor
                      Found in src/Phan/CLI.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 suggestSimilarNewInAnyNamespace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function suggestSimilarNewInAnyNamespace(
                              string $namespace,
                              string $name,
                              Context $context,
                              bool $suggest_in_global_namespace
                      Severity: Minor
                      Found in src/Phan/CodeBase.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 labelForElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private static function labelForElement(TypedElementInterface $element): string
                          {
                              if (self::useVSCodeCompletion()) {
                                  $name = $element->getName();
                                  if ($element instanceof Variable) {
                      Severity: Minor
                      Found in src/Phan/LanguageServer/CompletionRequest.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 recomputeFileList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function recomputeFileList(): void
                          {
                              $this->file_list = $this->file_list_in_config;
                      
                              if (!$this->file_list_only) {
                      Severity: Minor
                      Found in src/Phan/CLI.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 setLogFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function setLogFile($new_file): void
                          {
                              if (!\is_resource($new_file)) {
                                  throw new \TypeError("Expected newFile to be a resource, got " . \gettype($new_file));
                              }
                      Severity: Minor
                      Found in src/Phan/LanguageServer/Logger.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 createCompletionItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private static function createCompletionItem(
                              CodeBase $code_base,
                              TypedElementInterface $element,
                              ?string $prefix = null
                          ): CompletionItem {
                      Severity: Minor
                      Found in src/Phan/LanguageServer/CompletionRequest.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 suggestSimilarClassInSameNamespace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function suggestSimilarClassInSameNamespace(
                              FullyQualifiedClassName $missing_class,
                              Context $context,
                              int $class_suggest_type = IssueFixSuggester::CLASS_SUGGEST_ONLY_CLASSES
                          ): array {
                      Severity: Minor
                      Found in src/Phan/CodeBase.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