MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

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

static public $yy_action = array(
 /*     0 */   219,  309,  305,  301,  302,  303,  304,  310,  311,  317,
 /*    10 */   318,  319,  201,   30,  273,    9,   33,  238,  280,   15,
 /*    20 */     5,  108,  235,  234,  220,    7,  126,   42,   30,   30,
 /*    30 */   259,  211,  256,  495,   15,   15,   10,   33,  495,  280,
include/smarty/libs/sysplugins/smarty_internal_templateparser.php on lines 471..713

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

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

    static public $yy_lookahead = array(
 /*     0 */     1,    4,    5,    6,    7,    8,    9,   10,   11,   12,
 /*    10 */    13,   14,   15,   30,   66,   18,   18,    2,   20,   36,
 /*    20 */    23,   24,   94,   95,   96,   39,   29,   28,   30,   30,
 /*    30 */    33,   60,   35,   60,   36,   36,   65,   18,   65,   20,
include/smarty/libs/sysplugins/smarty_internal_templateparser.php on lines 228..470

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

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

File Markdown.php has 2647 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
#
# Markdown  -  A text-to-HTML conversion tool for web writers
#
# PHP Markdown  
Severity: Major
Found in include/lib/Michelf/Markdown.php - About 1 wk to fix

    File smarty_internal_templateparser.php has 2007 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
    * Smarty Internal Plugin Templateparser
    *
    * This is the template parser.
    Severity: Major
    Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.php - About 5 days to fix

      Function testInstall has a Cognitive Complexity of 250 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function testInstall(Smarty $smarty, &$errors=null)
          {
              $status = true;
      
              if ($errors === null) {
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 5 days 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 compileTag has a Cognitive Complexity of 235 (exceeds 5 allowed). Consider refactoring.
      Open

          public function compileTag($tag, $args, $parameter = array())
          {
              // $args contains the attributes parsed and compiled by the lexer/parser
              // assume that tag does compile into code, but creates no HTML output
              $this->has_code = true;

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

          public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
          {
              if ($template === null && $this instanceof $this->template_class) {
                  $template = $this;
              }
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 4 days 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

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

          public function doParse($yymajor, $yytokenvalue)
          {
              $yyerrorhit = 0;   /* True if yymajor has invoked an error */
      
              if ($this->yyidx === null || $this->yyidx < 0) {
      include/smarty/libs/sysplugins/smarty_internal_configfileparser.php on lines 838..926

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

      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

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

          public function doParse($yymajor, $yytokenvalue)
          {
              $yyerrorhit = 0;   /* True if yymajor has invoked an error */
      
              if ($this->yyidx === null || $this->yyidx < 0) {
      include/smarty/libs/sysplugins/smarty_internal_templateparser.php on lines 3155..3243

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

      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

      Smarty_Internal_Templateparser has 167 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Smarty_Internal_Templateparser#line 80 "smarty_internal_templateparser.php"
      {
      #line 15 "smarty_internal_templateparser.y"
      
          const Err1 = "Security error: Call to private object member not allowed";
      Severity: Major
      Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.php - About 3 days to fix

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

            public function yylex5()
            {
                $tokenMap = array (
                      1 => 0,
                      2 => 0,
        include/smarty/libs/sysplugins/smarty_internal_configfilelexer.php on lines 556..611

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

        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

            public function yylex6()
            {
                $tokenMap = array (
                      1 => 0,
                      2 => 0,
        include/smarty/libs/sysplugins/smarty_internal_configfilelexer.php on lines 484..539

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

        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

        File smarty_internal_templatelexer.php has 1195 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
        * Smarty Internal Plugin Templatelexer
        *
        * This is the lexer to break the template source into tokens 
        Severity: Major
        Found in include/smarty/libs/sysplugins/smarty_internal_templatelexer.php - About 3 days to fix

          Function smarty_function_fetch has a Cognitive Complexity of 142 (exceeds 5 allowed). Consider refactoring.
          Open

          function smarty_function_fetch($params, $template)
          {
              if (empty($params['file'])) {
                  trigger_error("[plugin] fetch parameter 'file' cannot be empty",E_USER_NOTICE);
          
          
          Severity: Minor
          Found in include/smarty/libs/plugins/function.fetch.php - About 2 days 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

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

              public function yy_get_expected_tokens($token)
              {
                  $state = $this->yystack[$this->yyidx]->stateno;
                  $expected = self::$yyExpectedTokens[$state];
                  if (in_array($token, self::$yyExpectedTokens[$state], true)) {
          include/smarty/libs/sysplugins/smarty_internal_templateparser.php on lines 1494..1562

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

          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

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

              public function yy_get_expected_tokens($token)
              {
                  $state = $this->yystack[$this->yyidx]->stateno;
                  $expected = self::$yyExpectedTokens[$state];
                  if (in_array($token, self::$yyExpectedTokens[$state], true)) {
          include/smarty/libs/sysplugins/smarty_internal_configfileparser.php on lines 388..456

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

          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

              public function yy_is_expected_token($token)
              {
                  if ($token === 0) {
                      return true; // 0 is not part of this
                  }
          include/smarty/libs/sysplugins/smarty_internal_configfileparser.php on lines 458..529

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

          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

              public function yy_is_expected_token($token)
              {
                  if ($token === 0) {
                      return true; // 0 is not part of this
                  }
          include/smarty/libs/sysplugins/smarty_internal_templateparser.php on lines 1564..1635

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

          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

          File mime_types.php has 989 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /*
           * This file is part of SwiftMailer.
           * (c) 2004-2009 Chris Corbyn
          Severity: Major
          Found in include/lib/swiftmailer/mime_types.php - About 2 days to fix

            Method testInstall has 480 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function testInstall(Smarty $smarty, &$errors=null)
                {
                    $status = true;
            
                    if ($errors === null) {
            Severity: Major
            Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 2 days to fix
              Severity
              Category
              Status
              Source
              Language