Showing 3,272 of 4,939 total issues

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

    public function read(): bool
    {
        if ($this->done) {
            return true;
        }
Severity: Minor
Found in .phan/plugins/InvokePHPNativeSyntaxCheckPlugin.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 recursivelyCheck has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function recursivelyCheck(Node $node): void
    {
        switch ($node->kind) {
            // TODO: Handle phan-closure-scope.
            // case ast\AST_CLOSURE:
Severity: Minor
Found in .phan/plugins/AvoidableGetterPlugin.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 visitClass has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitClass(Node $node): array
    {
        [$property_descriptions, $method_descriptions] = parent::visitClass($node);
        foreach (self::findGroups($property_descriptions) as $entries) {
            $first_entry = array_shift($entries);
Severity: Minor
Found in .phan/plugins/HasPHPDocPlugin.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 visitClass has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitClass(Node $node): array
    {
        $class = $this->context->getClassInScope($this->code_base);
        $property_descriptions = [];
        $method_descriptions = [];
Severity: Minor
Found in .phan/plugins/HasPHPDocPlugin.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 analyzePostponedMethod has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private static function analyzePostponedMethod(
        CodeBase $code_base,
        FunctionInterface $method
    ): void {
        if ($method instanceof Method) {
Severity: Minor
Found in .phan/plugins/PossiblyStaticMethodPlugin.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 visitBinaryOp has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function visitBinaryOp(Node $node): void
    {
        $flags = $node->flags;
        if (!\array_key_exists($flags, self::REDUNDANT_BINARY_OP_SET)) {
            // Nothing to warn about
Severity: Minor
Found in .phan/plugins/DuplicateExpressionPlugin.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 computeEditsForParamTypeDeclaration has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private static function computeEditsForParamTypeDeclaration(
        FileCacheEntry $contents,
        FunctionLike $declaration,
        string $param_name,
        string $shorter_param_type
Severity: Minor
Found in .phan/plugins/PreferNamespaceUsePlugin/Fixers.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 checkUnaryOpOfConditional has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function checkUnaryOpOfConditional(Node $cond_node, $true_node_hash): void
    {
        if ($cond_node->flags !== ast\flags\UNARY_BOOL_NOT) {
            return;
        }
Severity: Minor
Found in .phan/plugins/DuplicateExpressionPlugin.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 tokenizeRegexParts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private static function tokenizeRegexParts(string $inner): Generator
    {
        $inner_len = strlen($inner);
        for ($j = 0; $j < $inner_len;) {
            switch ($c = $inner[$j]) {
Severity: Minor
Found in .phan/plugins/PregRegexCheckerPlugin.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 generateStaticObjectCompletions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function generateStaticObjectCompletions(array $tokens, string $completed_text): array
    {
        $i = count($tokens) - 1;
        $this->appendToLogFile("generateStaticObjectCompletions tokens = " . StringUtil::jsonEncode($tokens) . "\n");
        while (!is_array($tokens[$i]) || $tokens[$i][0] !== T_DOUBLE_COLON) {
Severity: Minor
Found in tool/phan_repl_helpers.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 init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function init(): void
    {
        static $did_init = false;
        if ($did_init) {
            return;
Severity: Minor
Found in src/Phan/Debug/SignalHandler.php - About 1 hr to fix

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

        private function recordDefinitionOfTypeFQSEN(
            CodeBase $code_base,
            FQSEN $type_fqsen
        ): void {
            $record_definition = function (AddressableElementInterface $element) use ($code_base): void {
    Severity: Minor
    Found in src/Phan/LanguageServer/GoToDefinitionRequest.php - About 1 hr to fix

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

          private function maybeReadConfigFile(bool $require_config_exists): void
          {
      
              // If the file doesn't exist here, try a directory up
              $config_file_name = $this->config_file;
      Severity: Minor
      Found in src/Phan/CLI.php - About 1 hr to fix

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

            public static function reloadFilePathListForDaemon(CodeBase $code_base, Closure $file_path_lister, array $file_mapping_contents, array $file_names = null): void
            {
                $old_count = $code_base->getParsedFilePathCount();
        
                $file_list = $file_path_lister(true);
        Severity: Minor
        Found in src/Phan/Daemon/Request.php - About 1 hr to fix

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

              public static function progress(
                  string $msg,
                  float $p,
                  $details = null,
                  ?int $offset = null,
          Severity: Minor
          Found in src/Phan/CLI.php - About 1 hr to fix

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

                public function getGettersMap(CodeBase $code_base): array
                {
                    if ($this->isInterface()) {
                        return [];
                    }
            Severity: Minor
            Found in src/Phan/Language/Element/Clazz.php - About 1 hr to fix

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

                  private static function checkConstantCompatibility(
                      CodeBase $code_base,
                      ClassConstant $inherited_constant,
                      ClassConstant $overriding_constant
                  ): void {
              Severity: Minor
              Found in src/Phan/Language/Element/Clazz.php - About 1 hr to fix

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

                    public function warnAboutUnusedUseElements(CodeBase $code_base): void
                    {
                        foreach ($this->namespace_map as $flags => $entries_for_flag) {
                            foreach ($entries_for_flag as $namespace_map_entry) {
                                if ($namespace_map_entry->is_used) {
                Severity: Minor
                Found in src/Phan/Language/Context.php - About 1 hr to fix

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

                      public static function computeRealElementTypesForDimAccess(array $real_type_set): array
                      {
                          $result = [];
                          foreach ($real_type_set as $type) {
                              if ($type instanceof StringType) {
                  Severity: Minor
                  Found in src/Phan/Language/UnionType.php - About 1 hr to fix

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

                        public static function computeRealElementTypesForDestructuringAccess(array $real_type_set): array
                        {
                            $result = [];
                            foreach ($real_type_set as $type) {
                                if ($type instanceof StringType) {
                    Severity: Minor
                    Found in src/Phan/Language/UnionType.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language