MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

Method yylex2 has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function yylex2()
    {
        $tokenMap = array (
              1 => 0,
              2 => 0,
Severity: Major
Found in include/smarty/libs/sysplugins/smarty_internal_templatelexer.php - About 4 hrs to fix

    File DKIMSigner.php has 347 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /*
     * This file is part of SwiftMailer.
     * (c) 2004-2009 Chris Corbyn
    Severity: Minor
    Found in include/lib/swiftmailer/classes/Swift/Signers/DKIMSigner.php - About 4 hrs to fix

      Function compileChildBlock has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          static function compileChildBlock($compiler, $_name = null)
          {
              if ($compiler->inheritance_child) {
                  $name1 = Smarty_Internal_Compile_Block::$nested_block_names[0];
                  if (isset($compiler->template->block_data[$name1])) {
      Severity: Minor
      Found in include/smarty/libs/sysplugins/smarty_internal_compile_block.php - About 4 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 compile has 106 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function compile($args, $compiler, $parameter)
          {
              $tpl = $compiler->template;
              // check and get attributes
              $_attr = $this->getAttributes($compiler, $args);
      Severity: Major
      Found in include/smarty/libs/sysplugins/smarty_internal_compile_foreach.php - About 4 hrs to fix

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

        <?php
        $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
        
        // ACL check
        switch($setting->getValue('acl_moot_forum', 2)) {
        Severity: Major
        Found in include/pages/about/moot.inc.php and 1 other location - About 4 hrs to fix
        include/pages/about/chat.inc.php on lines 1..20

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

        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

        <?php
        $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
        
        // ACL check
        switch($setting->getValue('acl_chat_page', 2)) {
        Severity: Major
        Found in include/pages/about/chat.inc.php and 1 other location - About 4 hrs to fix
        include/pages/about/moot.inc.php on lines 1..20

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

        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

        Statistics has 33 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Statistics extends Base {
          protected $table = 'statistics_shares';
          protected $table_user_stats = 'statistics_users';
          private $getcache = true;
        
        
        Severity: Minor
        Found in include/classes/statistics.class.php - About 4 hrs to fix

          Method buildFilepath has 104 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
              {
                  $file = $source->name;
                  if ($source instanceof Smarty_Config_Source) {
                      $_directories = $source->smarty->getConfigDir();
          Severity: Major
          Found in include/smarty/libs/sysplugins/smarty_resource.php - About 4 hrs to fix

            Function compileAllConfig has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function compileAllConfig($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
                {
                    // switch off time limit
                    if (function_exists('set_time_limit')) {
                        @set_time_limit($time_limit);
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 4 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 compile has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

                public function compile($args, $compiler, $parameter)
                {
                    // check and get attributes
                    $_attr = $this->getAttributes($compiler, $args);
            
            
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_internal_compile_if.php - About 4 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 smarty_function_mailto has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

            function smarty_function_mailto($params, $template)
            {
                static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
                $extra = '';
            
            
            Severity: Minor
            Found in include/smarty/libs/plugins/function.mailto.php - About 4 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 compileAllTemplates has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function compileAllTemplates($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
                {
                    // switch off time limit
                    if (function_exists('set_time_limit')) {
                        @set_time_limit($time_limit);
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 4 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 yy_r154 has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

                function yy_r154(){
                if (!$this->security || $this->smarty->security_policy->isTrustedPhpFunction($this->yystack[$this->yyidx + -3]->minor, $this->compiler)) {
                    if (strcasecmp($this->yystack[$this->yyidx + -3]->minor,'isset') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'empty') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'array') === 0 || is_callable($this->yystack[$this->yyidx + -3]->minor)) {
                        $func_name = strtolower($this->yystack[$this->yyidx + -3]->minor);
                        if ($func_name == 'isset') {
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.php - About 4 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 getnetworkhashps has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

              public function getnetworkhashps() {
                $this->oDebug->append("STA " . __METHOD__, 4);
                if ($data = $this->memcache->get(__FUNCTION__)) return $data;
                try {
                  $dNetworkHashrate = $this->getmininginfo();
            Severity: Minor
            Found in include/classes/bitcoinwrapper.class.php - About 4 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 smarty_function_html_checkboxes has 100 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function smarty_function_html_checkboxes($params, $template)
            {
                require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
            
                $name = 'checkbox';
            Severity: Major
            Found in include/smarty/libs/plugins/function.html_checkboxes.php - About 4 hrs to fix

              Consider simplifying this complex logical expression.
              Open

                      if (
                          $this->isIOS() && $this->version('iPad', self::VERSION_TYPE_FLOAT)<4.3 ||
                          $this->isIOS() && $this->version('iPhone', self::VERSION_TYPE_FLOAT)<3.1 ||
                          $this->isIOS() && $this->version('iPod', self::VERSION_TYPE_FLOAT)<3.1 ||
              
              
              Severity: Critical
              Found in include/lib/Mobile_Detect.php - About 4 hrs to fix

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

                  if (@$_REQUEST['next'] && !empty($_REQUEST['height'])) {
                    $iHeight = @$roundstats->getNextBlock($_REQUEST['height']);
                    if (!$iHeight) {
                      $iBlock = $block->getLast();
                      $iHeight = $iBlock['height'];
                Severity: Major
                Found in include/pages/statistics/blocks.inc.php and 2 other locations - About 4 hrs to fix
                include/pages/admin/reports.inc.php on lines 34..47
                include/pages/statistics/round.inc.php on lines 10..23

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

                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 3 locations. Consider refactoring.
                Open

                  if (@$_REQUEST['next'] && !empty($_REQUEST['height'])) {
                    $iHeight = @$roundstats->getNextBlock($_REQUEST['height']);
                      if (!$iHeight) {
                        $iBlock = $block->getLast();
                        $iHeight = $iBlock['height']; 
                Severity: Major
                Found in include/pages/statistics/round.inc.php and 2 other locations - About 4 hrs to fix
                include/pages/admin/reports.inc.php on lines 34..47
                include/pages/statistics/blocks.inc.php on lines 16..29

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

                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 3 locations. Consider refactoring.
                Open

                  if (@$_REQUEST['next'] && !empty($_REQUEST['height'])) {
                    $iHeight = @$roundstats->getNextBlock($_REQUEST['height']);
                    if (!$iHeight) {
                      $iBlock = $block->getLast();
                      $iHeight = $iBlock['height'];
                Severity: Major
                Found in include/pages/admin/reports.inc.php and 2 other locations - About 4 hrs to fix
                include/pages/statistics/blocks.inc.php on lines 16..29
                include/pages/statistics/round.inc.php on lines 10..23

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

                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

                Method smarty_function_html_image has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function smarty_function_html_image($params, $template)
                {
                    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
                
                    $alt = '';
                Severity: Major
                Found in include/smarty/libs/plugins/function.html_image.php - About 3 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language