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

            if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
                $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['file'] = $file;
                $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'] = $function;
            } else {
                $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['file'] = $file;
include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on lines 650..656

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

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

Swift_Transport_EsmtpTransport has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTransport implements Swift_Transport_SmtpAgent
{
    /**
     * ESMTP extension handlers.
     *
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Transport/EsmtpTransport.php - About 2 hrs to fix

    Method findUpstreamShare has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function findUpstreamShare($aBlock, $last=0) {
        // Many use stratum, so we create our stratum check first
        $version = pack("I*", sprintf('%08d', $aBlock['version']));
        $previousblockhash = pack("H*", swapEndian($aBlock['previousblockhash']));
        $merkleroot = pack("H*", swapEndian($aBlock['merkleroot']) );
    Severity: Major
    Found in include/classes/share.class.php - About 2 hrs to fix

      Method getAllUserStats has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public function getAllUserStats($filter='%',$limit=1,$start=0) {
          $this->debug->append("STA " . __METHOD__, 4);
          $sql = "
            SELECT
              a.id AS id,
      Severity: Major
      Found in include/classes/statistics.class.php - About 2 hrs to fix

        Method yylex1 has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method init has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function init()
              {
                  if (count(self::$_specials) > 0) {
                      return;
                  }
          Severity: Major
          Found in include/lib/swiftmailer/classes/Swift/Mime/Grammar.php - About 2 hrs to fix

            Function smarty_modifiercompiler_escape has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            function smarty_modifiercompiler_escape($params, $compiler)
            {
                static $_double_encode = null;
                if ($_double_encode === null) {
                    $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
            Severity: Minor
            Found in include/smarty/libs/plugins/modifiercompiler.escape.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 yy_is_expected_token has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public function yy_is_expected_token($token)
                {
                    if ($token === 0) {
                        return true; // 0 is not part of this
                    }
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_internal_configfileparser.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 yy_is_expected_token has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public function yy_is_expected_token($token)
                {
                    if ($token === 0) {
                        return true; // 0 is not part of this
                    }
            Severity: Minor
            Found in include/smarty/libs/sysplugins/smarty_internal_templateparser.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 smarty_block_textformat has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function smarty_block_textformat($params, $content, $template, &$repeat)
            {
                if (is_null($content)) {
                    return;
                }
            Severity: Major
            Found in include/smarty/libs/plugins/block.textformat.php - About 2 hrs to fix

              Method compile has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function compile($args, $compiler, $parameter, $tag)
                  {
                      if (!isset($tag[5]) || substr($tag,-5) != 'close') {
                          // opening tag of block plugin
                          // check and get attributes

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

                    if (document.getElementById("motd")) {
                        var md5motd = $.md5(document.getElementById('motd').innerHTML);
                        // Check if MOTD alert has been closed
                        //alert(md5motd);
                        if( $.cookie('motd-box') === md5motd ){
                Severity: Major
                Found in public/site_assets/bootstrap/js/mpos.js and 2 other locations - About 2 hrs to fix
                public/site_assets/bootstrap/js/mpos.js on lines 36..45
                public/site_assets/bootstrap/js/mpos.js on lines 47..55

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

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

                    if (document.getElementById("lastlogin")) {
                        var md5lastlogin = $.md5(document.getElementById('lastlogin').innerHTML);
                        // Check if lastlogin alert has been closed
                        //alert(md5lastlogin);
                        if( $.cookie('lastlogin-box') === md5lastlogin ){
                Severity: Major
                Found in public/site_assets/bootstrap/js/mpos.js and 2 other locations - About 2 hrs to fix
                public/site_assets/bootstrap/js/mpos.js on lines 26..34
                public/site_assets/bootstrap/js/mpos.js on lines 47..55

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

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

                    if (document.getElementById("backend")) {
                        var md5backend = $.md5(document.getElementById('backend').innerHTML);
                        // Check if Backend Issues alert has been closed
                        //alert(md5backend);
                        if( $.cookie('backend-box') === md5backend ){
                Severity: Major
                Found in public/site_assets/bootstrap/js/mpos.js and 2 other locations - About 2 hrs to fix
                public/site_assets/bootstrap/js/mpos.js on lines 26..34
                public/site_assets/bootstrap/js/mpos.js on lines 36..45

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

                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 doAnchors has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function doAnchors($text) {
                    #
                    # Turn Markdown link shortcuts into XHTML <a> tags.
                    #
                        if ($this->in_anchor) return $text;
                Severity: Major
                Found in include/lib/Michelf/Markdown.php - About 2 hrs to fix

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

                      if (isset($options)) {
                          foreach ($options as $_key => $_val) {
                              $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
                          }
                      } else {
                  Severity: Major
                  Found in include/smarty/libs/plugins/function.html_radios.php and 1 other location - About 2 hrs to fix
                  include/smarty/libs/plugins/function.html_checkboxes.php on lines 151..160

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

                  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

                      if (isset($options)) {
                          foreach ($options as $_key=>$_val) {
                              $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
                          }
                      } else {
                  Severity: Major
                  Found in include/smarty/libs/plugins/function.html_checkboxes.php and 1 other location - About 2 hrs to fix
                  include/smarty/libs/plugins/function.html_radios.php on lines 140..149

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

                  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 debug has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function debug($message)
                      {
                          $message = bin2hex($message);
                          $messageId = substr($message, 16, 8);
                          echo substr($message, 0, 16) . " NTLMSSP Signature<br />\n";

                    Method doAnchors has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function doAnchors($text) {
                        #
                        # Turn Markdown link shortcuts into XHTML <a> tags.
                        #
                            if ($this->in_anchor) return $text;
                    Severity: Major
                    Found in include/lib/Michelf/Markdown.php - About 2 hrs to fix

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

                              if (empty($this->allowed_modifiers)) {
                                  if (empty($this->disabled_modifiers) || !in_array($modifier_name, $this->disabled_modifiers)) {
                                      return true;
                                  } else {
                                      $compiler->trigger_template_error("modifier '{$modifier_name}' disabled by security setting", $compiler->lex->taglineno);
                      Severity: Major
                      Found in include/smarty/libs/sysplugins/smarty_security.php and 1 other location - About 2 hrs to fix
                      include/smarty/libs/sysplugins/smarty_security.php on lines 249..259

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language