.phan/plugins/PrintfCheckerPlugin.php

Summary

Maintainability
F
1 wk
Test Coverage

Function analyzePrintfPattern has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
Open

    protected function analyzePrintfPattern(CodeBase $code_base, Context $context, FunctionInterface $function, $pattern_node, $arg_nodes): void
    {
        // Given a node, extract the printf directive and whether or not it could be translated
        $primitive_for_fmtstr = $this->astNodeToPrimitive($code_base, $context, $pattern_node);
        /**
Severity: Minor
Found in .phan/plugins/PrintfCheckerPlugin.php - About 1 day 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

File PrintfCheckerPlugin.php has 573 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Phan\Plugin\PrintfCheckerPlugin;
Severity: Major
Found in .phan/plugins/PrintfCheckerPlugin.php - About 1 day to fix

    Method analyzePrintfPattern has 211 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function analyzePrintfPattern(CodeBase $code_base, Context $context, FunctionInterface $function, $pattern_node, $arg_nodes): void
        {
            // Given a node, extract the printf directive and whether or not it could be translated
            $primitive_for_fmtstr = $this->astNodeToPrimitive($code_base, $context, $pattern_node);
            /**
    Severity: Major
    Found in .phan/plugins/PrintfCheckerPlugin.php - About 1 day to fix

      Function astNodeToPrimitive has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function astNodeToPrimitive(CodeBase $code_base, Context $context, $ast_node): ?PrimitiveValue
          {
              // Base case: convert primitive tokens such as numbers and strings.
              if (!($ast_node instanceof Node)) {
                  return new PrimitiveValue($ast_node);
      Severity: Minor
      Found in .phan/plugins/PrintfCheckerPlugin.php - About 5 hrs 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

      The class PrintfCheckerPlugin has an overall complexity of 105 which is very high. The configured complexity threshold is 50.
      Open

      class PrintfCheckerPlugin extends PluginV3 implements AnalyzeFunctionCallCapability, ReturnTypeOverrideCapability
      {
      
          // Pylint error codes for emitted issues.
          private const ERR_UNTRANSLATED_USE_ECHO                = 1300;
      Severity: Minor
      Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

      Method getAnalyzeFunctionCallClosures has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
          {
              /**
               * Analyzes a printf-like function with a format directive in the first position.
               * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
      Severity: Major
      Found in .phan/plugins/PrintfCheckerPlugin.php - About 2 hrs to fix

        Method astNodeToPrimitive has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function astNodeToPrimitive(CodeBase $code_base, Context $context, $ast_node): ?PrimitiveValue
            {
                // Base case: convert primitive tokens such as numbers and strings.
                if (!($ast_node instanceof Node)) {
                    return new PrimitiveValue($ast_node);
        Severity: Major
        Found in .phan/plugins/PrintfCheckerPlugin.php - About 2 hrs to fix

          Function getReturnTypeOverrides has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getReturnTypeOverrides(CodeBase $code_base): array
              {
                  $string_union_type = StringType::instance(false)->asPHPDocUnionType();
                  /**
                   * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
          Severity: Minor
          Found in .phan/plugins/PrintfCheckerPlugin.php - About 2 hrs 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 validateTranslations has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              protected static function validateTranslations(CodeBase $code_base, Context $context, string $fmt_str, array $types_of_arg): void
              {
                  $translations = static::gettextForAllLocales($fmt_str);
                  foreach ($translations as $locale => $translated_fmt_str) {
                      // Skip untranslated or equal strings.
          Severity: Minor
          Found in .phan/plugins/PrintfCheckerPlugin.php - About 2 hrs 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 getReturnTypeOverrides has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getReturnTypeOverrides(CodeBase $code_base): array
              {
                  $string_union_type = StringType::instance(false)->asPHPDocUnionType();
                  /**
                   * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
          Severity: Major
          Found in .phan/plugins/PrintfCheckerPlugin.php - About 2 hrs to fix

            Method validateTranslations has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected static function validateTranslations(CodeBase $code_base, Context $context, string $fmt_str, array $types_of_arg): void
                {
                    $translations = static::gettextForAllLocales($fmt_str);
                    foreach ($translations as $locale => $translated_fmt_str) {
                        // Skip untranslated or equal strings.
            Severity: Minor
            Found in .phan/plugins/PrintfCheckerPlugin.php - About 1 hr to fix

              Function getAnalyzeFunctionCallClosures has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
                  {
                      /**
                       * Analyzes a printf-like function with a format directive in the first position.
                       * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
              Severity: Minor
              Found in .phan/plugins/PrintfCheckerPlugin.php - About 45 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

              Method analyzePrintfPattern has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  protected function analyzePrintfPattern(CodeBase $code_base, Context $context, FunctionInterface $function, $pattern_node, $arg_nodes): void
              Severity: Minor
              Found in .phan/plugins/PrintfCheckerPlugin.php - About 35 mins to fix

                Avoid too many return statements within this method.
                Open

                        return [
                            // call
                            'printf'     => $printf_callback,
                            'sprintf'    => $printf_callback,
                            'fprintf'    => $fprintf_callback,
                Severity: Major
                Found in .phan/plugins/PrintfCheckerPlugin.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

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

                    Avoid too many return statements within this method.
                    Open

                                                return @\vsprintf($format_string, $sprintf_args);
                    Severity: Major
                    Found in .phan/plugins/PrintfCheckerPlugin.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return new PrimitiveValue($first_str);
                      Severity: Major
                      Found in .phan/plugins/PrintfCheckerPlugin.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

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

                          Avoid too many return statements within this method.
                          Open

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

                            Avoid too many return statements within this method.
                            Open

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

                              Avoid too many return statements within this method.
                              Open

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

                                Avoid too many return statements within this method.
                                Open

                                        return [
                                            'sprintf'                     => $sprintf_handler,
                                        ];
                                Severity: Major
                                Found in .phan/plugins/PrintfCheckerPlugin.php - About 30 mins to fix

                                  The method astNodeToPrimitive() has an NPath complexity of 2400. The configured NPath complexity threshold is 200.
                                  Open

                                      protected function astNodeToPrimitive(CodeBase $code_base, Context $context, $ast_node): ?PrimitiveValue
                                      {
                                          // Base case: convert primitive tokens such as numbers and strings.
                                          if (!($ast_node instanceof Node)) {
                                              return new PrimitiveValue($ast_node);
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  NPathComplexity

                                  Since: 0.1

                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                  Example

                                  class Foo {
                                      function bar() {
                                          // lots of complicated code
                                      }
                                  }

                                  Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                  The method getAnalyzeFunctionCallClosures() has an NPath complexity of 1024. The configured NPath complexity threshold is 200.
                                  Open

                                      public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
                                      {
                                          /**
                                           * Analyzes a printf-like function with a format directive in the first position.
                                           * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  NPathComplexity

                                  Since: 0.1

                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                  Example

                                  class Foo {
                                      function bar() {
                                          // lots of complicated code
                                      }
                                  }

                                  Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                  The method getAnalyzeFunctionCallClosures() has 102 lines of code. Current threshold is set to 100. Avoid really long methods.
                                  Open

                                      public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
                                      {
                                          /**
                                           * Analyzes a printf-like function with a format directive in the first position.
                                           * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  The method getReturnTypeOverrides() has an NPath complexity of 588. The configured NPath complexity threshold is 200.
                                  Open

                                      public function getReturnTypeOverrides(CodeBase $code_base): array
                                      {
                                          $string_union_type = StringType::instance(false)->asPHPDocUnionType();
                                          /**
                                           * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  NPathComplexity

                                  Since: 0.1

                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                  Example

                                  class Foo {
                                      function bar() {
                                          // lots of complicated code
                                      }
                                  }

                                  Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                  The method analyzePrintfPattern() has an NPath complexity of 49014400. The configured NPath complexity threshold is 200.
                                  Open

                                      protected function analyzePrintfPattern(CodeBase $code_base, Context $context, FunctionInterface $function, $pattern_node, $arg_nodes): void
                                      {
                                          // Given a node, extract the printf directive and whether or not it could be translated
                                          $primitive_for_fmtstr = $this->astNodeToPrimitive($code_base, $context, $pattern_node);
                                          /**
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  NPathComplexity

                                  Since: 0.1

                                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                  Example

                                  class Foo {
                                      function bar() {
                                          // lots of complicated code
                                      }
                                  }

                                  Source https://phpmd.org/rules/codesize.html#npathcomplexity

                                  The method analyzePrintfPattern() has 269 lines of code. Current threshold is set to 100. Avoid really long methods.
                                  Open

                                      protected function analyzePrintfPattern(CodeBase $code_base, Context $context, FunctionInterface $function, $pattern_node, $arg_nodes): void
                                      {
                                          // Given a node, extract the printf directive and whether or not it could be translated
                                          $primitive_for_fmtstr = $this->astNodeToPrimitive($code_base, $context, $pattern_node);
                                          /**
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  The method astNodeToPrimitive() has a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      protected function astNodeToPrimitive(CodeBase $code_base, Context $context, $ast_node): ?PrimitiveValue
                                      {
                                          // Base case: convert primitive tokens such as numbers and strings.
                                          if (!($ast_node instanceof Node)) {
                                              return new PrimitiveValue($ast_node);
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  CyclomaticComplexity

                                  Since: 0.1

                                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                  Example

                                  // Cyclomatic Complexity = 11
                                  class Foo {
                                  1   public function example() {
                                  2       if ($a == $b) {
                                  3           if ($a1 == $b1) {
                                                  fiddle();
                                  4           } elseif ($a2 == $b2) {
                                                  fiddle();
                                              } else {
                                                  fiddle();
                                              }
                                  5       } elseif ($c == $d) {
                                  6           while ($c == $d) {
                                                  fiddle();
                                              }
                                  7        } elseif ($e == $f) {
                                  8           for ($n = 0; $n < $h; $n++) {
                                                  fiddle();
                                              }
                                          } else {
                                              switch ($z) {
                                  9               case 1:
                                                      fiddle();
                                                      break;
                                  10              case 2:
                                                      fiddle();
                                                      break;
                                  11              case 3:
                                                      fiddle();
                                                      break;
                                                  default:
                                                      fiddle();
                                                      break;
                                              }
                                          }
                                      }
                                  }

                                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                  The method analyzePrintfPattern() has a Cyclomatic Complexity of 41. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      protected function analyzePrintfPattern(CodeBase $code_base, Context $context, FunctionInterface $function, $pattern_node, $arg_nodes): void
                                      {
                                          // Given a node, extract the printf directive and whether or not it could be translated
                                          $primitive_for_fmtstr = $this->astNodeToPrimitive($code_base, $context, $pattern_node);
                                          /**
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  CyclomaticComplexity

                                  Since: 0.1

                                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                  Example

                                  // Cyclomatic Complexity = 11
                                  class Foo {
                                  1   public function example() {
                                  2       if ($a == $b) {
                                  3           if ($a1 == $b1) {
                                                  fiddle();
                                  4           } elseif ($a2 == $b2) {
                                                  fiddle();
                                              } else {
                                                  fiddle();
                                              }
                                  5       } elseif ($c == $d) {
                                  6           while ($c == $d) {
                                                  fiddle();
                                              }
                                  7        } elseif ($e == $f) {
                                  8           for ($n = 0; $n < $h; $n++) {
                                                  fiddle();
                                              }
                                          } else {
                                              switch ($z) {
                                  9               case 1:
                                                      fiddle();
                                                      break;
                                  10              case 2:
                                                      fiddle();
                                                      break;
                                  11              case 3:
                                                      fiddle();
                                                      break;
                                                  default:
                                                      fiddle();
                                                      break;
                                              }
                                          }
                                      }
                                  }

                                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                  The method getAnalyzeFunctionCallClosures() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public function getAnalyzeFunctionCallClosures(CodeBase $code_base): array
                                      {
                                          /**
                                           * Analyzes a printf-like function with a format directive in the first position.
                                           * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  CyclomaticComplexity

                                  Since: 0.1

                                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                  Example

                                  // Cyclomatic Complexity = 11
                                  class Foo {
                                  1   public function example() {
                                  2       if ($a == $b) {
                                  3           if ($a1 == $b1) {
                                                  fiddle();
                                  4           } elseif ($a2 == $b2) {
                                                  fiddle();
                                              } else {
                                                  fiddle();
                                              }
                                  5       } elseif ($c == $d) {
                                  6           while ($c == $d) {
                                                  fiddle();
                                              }
                                  7        } elseif ($e == $f) {
                                  8           for ($n = 0; $n < $h; $n++) {
                                                  fiddle();
                                              }
                                          } else {
                                              switch ($z) {
                                  9               case 1:
                                                      fiddle();
                                                      break;
                                  10              case 2:
                                                      fiddle();
                                                      break;
                                  11              case 3:
                                                      fiddle();
                                                      break;
                                                  default:
                                                      fiddle();
                                                      break;
                                              }
                                          }
                                      }
                                  }

                                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                  The method getReturnTypeOverrides() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                                  Open

                                      public function getReturnTypeOverrides(CodeBase $code_base): array
                                      {
                                          $string_union_type = StringType::instance(false)->asPHPDocUnionType();
                                          /**
                                           * @param list<Node|string|int|float> $args the nodes for the arguments to the invocation
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  CyclomaticComplexity

                                  Since: 0.1

                                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                  Example

                                  // Cyclomatic Complexity = 11
                                  class Foo {
                                  1   public function example() {
                                  2       if ($a == $b) {
                                  3           if ($a1 == $b1) {
                                                  fiddle();
                                  4           } elseif ($a2 == $b2) {
                                                  fiddle();
                                              } else {
                                                  fiddle();
                                              }
                                  5       } elseif ($c == $d) {
                                  6           while ($c == $d) {
                                                  fiddle();
                                              }
                                  7        } elseif ($e == $f) {
                                  8           for ($n = 0; $n < $h; $n++) {
                                                  fiddle();
                                              }
                                          } else {
                                              switch ($z) {
                                  9               case 1:
                                                      fiddle();
                                                      break;
                                  10              case 2:
                                                      fiddle();
                                                      break;
                                  11              case 3:
                                                      fiddle();
                                                      break;
                                                  default:
                                                      fiddle();
                                                      break;
                                              }
                                          }
                                      }
                                  }

                                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                                  The class PrintfCheckerPlugin has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13.
                                  Open

                                  class PrintfCheckerPlugin extends PluginV3 implements AnalyzeFunctionCallCapability, ReturnTypeOverrideCapability
                                  {
                                  
                                      // Pylint error codes for emitted issues.
                                      private const ERR_UNTRANSLATED_USE_ECHO                = 1300;
                                  Severity: Minor
                                  Found in .phan/plugins/PrintfCheckerPlugin.php by phpmd

                                  CouplingBetweenObjects

                                  Since: 1.1.0

                                  A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                                  Example

                                  class Foo {
                                      /**
                                       * @var \foo\bar\X
                                       */
                                      private $x = null;
                                  
                                      /**
                                       * @var \foo\bar\Y
                                       */
                                      private $y = null;
                                  
                                      /**
                                       * @var \foo\bar\Z
                                       */
                                      private $z = null;
                                  
                                      public function setFoo(\Foo $foo) {}
                                      public function setBar(\Bar $bar) {}
                                      public function setBaz(\Baz $baz) {}
                                  
                                      /**
                                       * @return \SplObjectStorage
                                       * @throws \OutOfRangeException
                                       * @throws \InvalidArgumentException
                                       * @throws \ErrorException
                                       */
                                      public function process(\Iterator $it) {}
                                  
                                      // ...
                                  }

                                  Source https://phpmd.org/rules/design.html#couplingbetweenobjects

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

                                          $vprintf_callback = function (
                                              CodeBase $code_base,
                                              Context $context,
                                              Func $function,
                                              array $args
                                  Severity: Major
                                  Found in .phan/plugins/PrintfCheckerPlugin.php and 1 other location - About 4 hrs to fix
                                  .phan/plugins/PrintfCheckerPlugin.php on lines 348..366

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

                                  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

                                          $vfprintf_callback = function (
                                              CodeBase $code_base,
                                              Context $context,
                                              Func $function,
                                              array $args
                                  Severity: Major
                                  Found in .phan/plugins/PrintfCheckerPlugin.php and 1 other location - About 4 hrs to fix
                                  .phan/plugins/PrintfCheckerPlugin.php on lines 325..343

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

                                  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

                                  There are no issues that match your filters.

                                  Category
                                  Status