Showing 3,272 of 4,939 total issues

Method updateFileList has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function updateFileList(CodeBase $code_base, array $new_file_list, array $file_mapping_contents, array $reanalyze_files = null): array
    {
        $new_file_set = [];
        foreach ($new_file_list as $path) {
            $new_file_set[$path] = true;
Severity: Minor
Found in src/Phan/CodeBase/UndoTracker.php - About 1 hr to fix

    Method withSetVariable has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function withSetVariable(string $var_name, Node $var_node, Node $ancestor_node): Context
        {
            $context = $this->context;
            $is_object = $var_node->kind === ast\AST_PROP;
    
    
    Severity: Minor
    Found in src/Phan/Analysis/ConditionVisitor.php - About 1 hr to fix

      Method flush has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function flush(): void
          {
              $document = new \DOMDocument('1.0', 'ISO-8859-15');
      
              $checkstyle = new \DOMElement('checkstyle');
      Severity: Minor
      Found in src/Phan/Output/Printer/CheckstylePrinter.php - About 1 hr to fix

        Method getStaticMethodOrEmitIssue has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getStaticMethodOrEmitIssue(Node $node, string $method_name): ?Method
            {
                try {
                    // Get a reference to the method being called
                    $result = (new ContextNode(
        Severity: Minor
        Found in src/Phan/Analysis/PostOrderAnalysisVisitor.php - About 1 hr to fix

          Method phpParserArrayToAstArray has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function phpParserArrayToAstArray(PhpParser\Node\Expression\ArrayCreationExpression $n, int $start_line): ast\Node
              {
                  $ast_items = [];
                  $prev_was_element = false;
                  foreach ($n->arrayElements->children ?? [] as $item) {
          Severity: Minor
          Found in src/Phan/AST/TolerantASTConverter/TolerantASTConverter.php - About 1 hr to fix

            Method analyzePluginSuppressionsForFile has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function analyzePluginSuppressionsForFile(CodeBase $code_base, SuppressionCapability $plugin, string $relative_file_path): void
                {
                    $absolute_file_path = Config::projectPath($relative_file_path);
                    $plugin_class = \get_class($plugin);
                    $name_pos = \strrpos($plugin_class, '\\');
            Severity: Minor
            Found in .phan/plugins/UnusedSuppressionPlugin.php - About 1 hr to fix

              Method checkMethodDescription has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function checkMethodDescription(Clazz $class, Node $node): ?ClassElementEntry
                  {
                      $method_name = (string)$node->children['name'];
                      $method = $class->getMethodByName($this->code_base, $method_name);
                      if ($method->isMagic()) {
              Severity: Minor
              Found in .phan/plugins/HasPHPDocPlugin.php - About 1 hr to fix

                Function recordDefinitionOfTypeFQSEN has a Cognitive Complexity of 13 (exceeds 5 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

                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 guessActualLineLocation has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function guessActualLineLocation(int $i): int
                    {
                        $path = Config::projectPath($this->context->getFile());
                        $entry = FileCache::getEntry($path);
                        $declaration_lineno = $this->lineno;
                Severity: Minor
                Found in src/Phan/Language/Element/Comment/Builder.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 setParentType has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function setParentType(Type $parent_type, int $lineno = 0): void
                    {
                        if ($this->getInternalScope()->hasAnyTemplateType()) {
                            // Get a reference to the local list of templated
                            // types. We'll use this to map templated types on the
                Severity: Minor
                Found in src/Phan/Language/Element/Clazz.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 handleJSONResponseFromWorker has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function handleJSONResponseFromWorker(array $uris_to_analyze, array $response_data): void
                    {
                        $most_recent_node_info_request = $this->most_recent_node_info_request;
                        if ($most_recent_node_info_request) {
                            if ($most_recent_node_info_request instanceof GoToDefinitionRequest) {
                Severity: Minor
                Found in src/Phan/LanguageServer/LanguageServer.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 checkPropertyCompatibility has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function checkPropertyCompatibility(
                        CodeBase $code_base,
                        Property $inherited_property,
                        Property $overriding_property
                    ): void {
                Severity: Minor
                Found in src/Phan/Language/Element/Clazz.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 getFilteredURIsToAnalyze has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getFilteredURIsToAnalyze(): array
                    {
                        $uris_to_analyze = $this->analyze_request_set;
                        if (\count($uris_to_analyze) === 0) {
                            return [[], []];
                Severity: Minor
                Found in src/Phan/LanguageServer/LanguageServer.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 getTemplateTypeExtractorClosure has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getTemplateTypeExtractorClosure(CodeBase $code_base, TemplateType $template_type, int $skip_index = null): ?Closure
                    {
                        $closure = null;
                        foreach ($this->parameter_list as $i => $parameter) {
                            if ($i === $skip_index) {
                Severity: Minor
                Found in src/Phan/Language/Element/FunctionTrait.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 getTemplateTypeExtractorClosure has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getTemplateTypeExtractorClosure(CodeBase $code_base, TemplateType $template_type): ?Closure
                    {
                        // Create a closure to extract types for the template type from the return type and param types.
                        $closure = $this->getReturnTemplateTypeExtractorClosure($code_base, $template_type);
                        foreach ($this->params as $i => $param) {
                Severity: Minor
                Found in src/Phan/Language/Type/FunctionLikeDeclarationType.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 getTemplateTypeExtractorClosure has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getTemplateTypeExtractorClosure(CodeBase $code_base, TemplateType $template_type): ?Closure
                    {
                        $closure = null;
                        foreach ($this->field_types as $key => $type) {
                            $field_closure = $type->getTemplateTypeExtractorClosure($code_base, $template_type);
                Severity: Minor
                Found in src/Phan/Language/Type/ArrayShapeType.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 castTypeListToClassString has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function castTypeListToClassString(array $type_set): array
                    {
                        $result = [];
                        $is_possibly_string = false;
                        foreach ($type_set as $type) {
                Severity: Minor
                Found in src/Phan/Language/UnionType.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 normalizeArrayShapes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function normalizeArrayShapes(array $type_set, array $array_shape_types, array $union_types, bool $from_real_type_set): array
                    {
                        // If one of the union types had no array shape types, merge the array shape types of other types with the empty type
                        $add_mixed = false;
                        foreach ($union_types as $union_type) {
                Severity: Minor
                Found in src/Phan/Language/UnionType.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 closureParamComponentStringsToParams has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function closureParamComponentStringsToParams(array $param_components, Context $context, int $source): array
                    {
                        $result = [];
                        foreach ($param_components as $param_string) {
                            if ($param_string === '') {
                Severity: Minor
                Found in src/Phan/Language/Type.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 identifyLowestCommonAncestor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function identifyLowestCommonAncestor(array $scope_list): ?Scope
                    {
                        $counts = [];
                        $N = count($scope_list);
                        foreach ($scope_list as $i => $scope) {
                Severity: Minor
                Found in src/Phan/Language/Scope.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

                Severity
                Category
                Status
                Source
                Language