travi/php-framework

View on GitHub

Showing 176 of 176 total issues

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

            text = image.alt!=''&&itxtalt!=0?image.alt:image.title!=''&&itxttitle!=0?image.title:'';
Severity: Major
Found in client/thirdparty/instant/instant.js and 1 other location - About 1 hr to fix
client/thirdparty/instant/instant.js on lines 344..344

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

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

    public function buildOptions() {

        foreach ($this->_matches[1] as $command) {

            $command = trim($command);
Severity: Minor
Found in php/thirdparty/PHP-Dependency/library/Pd/Map/Builder/Parser.php - About 1 hr to fix

    Method checkAdditionalRequirements has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function checkAdditionalRequirements()
        {
            $status = "good";
            $msg = "Image passed image specific requirements";
    
    
    Severity: Minor
    Found in php/framework/objects/utility/upload.class.php - About 1 hr to fix

      Function addLining has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function addLining(ctx,x,y,width,height,opacity,inset,inner,color) {
      Severity: Major
      Found in client/thirdparty/instant/instant.js - About 1 hr to fix

        Function _keyboard_action has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function _keyboard_action(objEvent) {
                    // To ie
                    if ( objEvent == null ) {
                        escapeKey = 27;
                        keycode = event.keyCode;
        Severity: Minor
        Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 hr to fix

          Function resolvePartsFromNonRestfulUri has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private function resolvePartsFromNonRestfulUri()
              {
                  if ($this->uriParts[1] === 'index.php') {
                      array_shift($this->uriParts);
                  }
          Severity: Minor
          Found in php/framework/src/travi/framework/http/Request.php - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function myGetElementsByClassName has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              document.myGetElementsByClassName = function(className) {
                  var children = document.getElementsByTagName('*') || document.all;
                  var elements = new Array();
                
                  for (var i = 0; i < children.length; i++) {
          Severity: Minor
          Found in client/thirdparty/reflection/reflection.js - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method _striptext has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function _striptext($document)
              {
                  
                  // I didn't use preg eval (//e) since that is only available in PHP 4.0.
                  // so, list your entities one by one here. I included some of the
          Severity: Minor
          Found in php/thirdparty/Snoopy/Snoopy.class.php - About 1 hr to fix

            Method qp_enc has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function qp_enc($input = "", $line_max = 76) { 
                    $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); 
                    $lines = preg_split("/(?:\r\n|\r|\n)/", $input); 
                    $eol = "\r\n"; 
                    $escape = "="; 
            Severity: Minor
            Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 1 hr to fix

              Method get_item_version has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function get_item_version( $pv_browser_user_agent, $pv_search_string, $pv_b_break_last='', $pv_extra_search='' )
              {
                  // 12 is the longest that will be required, handles release dates: 20020323; 0.8.0+
                  $substring_length = 15;
                  $start_pos = 0; // set $start_pos to 0 for first iteration
              Severity: Minor
              Found in php/thirdparty/browser_detection.php - About 1 hr to fix

                Method resolvePartsFromRestfulUri has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function resolvePartsFromRestfulUri()
                    {
                        if ($this->uriParts[1] === 'index.php') {
                            array_shift($this->uriParts);
                        }
                Severity: Minor
                Found in php/framework/src/travi/framework/http/Request.php - About 1 hr to fix

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

                                      if($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)
                                      {
                                          $frameurls = $this->_frameurls;
                                          $this->_frameurls = array();
                                          
                  Severity: Major
                  Found in php/thirdparty/Snoopy/Snoopy.class.php and 1 other location - About 1 hr to fix
                  php/thirdparty/Snoopy/Snoopy.class.php on lines 232..247

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

                  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($this->_framedepth < $this->maxframes && count($this->_frameurls) > 0)
                                  {
                                      $frameurls = $this->_frameurls;
                                      $this->_frameurls = array();
                  
                  Severity: Major
                  Found in php/thirdparty/Snoopy/Snoopy.class.php and 1 other location - About 1 hr to fix
                  php/thirdparty/Snoopy/Snoopy.class.php on lines 173..188

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

                  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

                  Function tiltShadow has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function tiltShadow(ctx,x,y,width,height,radius,opacity,round){
                  Severity: Major
                  Found in client/thirdparty/instant/instant.js - About 1 hr to fix

                    Function addRadialStyle has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function addRadialStyle(ctx,x1,y1,r1,x2,y2,r2,opacity) {
                    Severity: Major
                    Found in client/thirdparty/instant/instant.js - About 1 hr to fix

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

                                  for (var j = 0; j < classNames.length; j++) {
                                      if (classNames[j] == className) {
                                          elements.push(child);
                                          break;
                                      }
                      Severity: Minor
                      Found in client/thirdparty/reflection/reflection.js and 1 other location - About 55 mins to fix
                      client/thirdparty/instant/instant.js on lines 30..35

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

                      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

                              for (var j = 0; j < classNames.length; j++) {
                                  if (classNames[j] == className) {
                                      elements.push(child);
                                      break;
                                  }
                      Severity: Minor
                      Found in client/thirdparty/instant/instant.js and 1 other location - About 55 mins to fix
                      client/thirdparty/reflection/reflection.js on lines 16..21

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

                      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

                      Function addDependencies has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function addDependencies($dependencies = array())
                          {
                              $scripts = $dependencies['scripts'];
                              $jsInits = $dependencies['jsInits'];
                              $styles = $dependencies['styles'];
                      Severity: Minor
                      Found in php/framework/objects/travi/framework/DependantObject.php - About 55 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

                      Function mapDependencies has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function mapDependencies($dependencies)
                          {
                              if (!empty($dependencies['jsDependencies'])) {
                                  foreach ($dependencies['jsDependencies'] as $dependency) {
                                      $this->addJavaScript($dependency);

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

                          public function getFieldByName($fieldName)
                          {
                              if ('name' === $fieldName) {
                                  $fieldName = 'name_value';
                              }
                      Severity: Minor
                      Found in php/framework/src/travi/framework/components/Forms/FormElementGroup.php - About 55 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

                      Severity
                      Category
                      Status
                      Source
                      Language