travi/php-framework

View on GitHub

Showing 176 of 176 total issues

Function add has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    add: function(image, options) {
        Reflection.remove(image);
        
        doptions = { "height" : Reflection.defaultHeight, "opacity" : Reflection.defaultOpacity }
        if (options) {
Severity: Minor
Found in client/thirdparty/reflection/reflection.js - 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

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

    cx=x+w; cy=y; cw=w; while(cw>0) {t=rF(wa,Math.min(cw,wz)); c=rF(1,t); ctx.quadraticCurveTo(cx-c,cy+rF(da,dz),cx-t,cy); cx-=t; cw-=t;}
Severity: Major
Found in client/thirdparty/instant/instant.js and 1 other location - About 2 hrs to fix
client/thirdparty/instant/instant.js on lines 164..164

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

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

    cx=x+w; cy=y+h; ch=h; while(ch>0) {t=rF(ha,Math.min(ch,hz)); c=rF(1,t); ctx.quadraticCurveTo(cx-rF(da,dz),cy-c,cx,cy-t); cy-=t; ch-=t;}
Severity: Major
Found in client/thirdparty/instant/instant.js and 1 other location - About 2 hrs to fix
client/thirdparty/instant/instant.js on lines 163..163

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

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

    cx=x; cy=y; ch=h; while(ch>0) {t=rF(ha,Math.min(ch,hz)); c=rF(1,t); ctx.quadraticCurveTo(cx+rF(da,dz),cy+c,cx,cy+t); cy+=t; ch-=t;}
Severity: Major
Found in client/thirdparty/instant/instant.js and 1 other location - About 2 hrs to fix
client/thirdparty/instant/instant.js on lines 165..165

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

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

    cx=x; cy=y+h; cw=w; while(cw>0) {t=rF(wa,Math.min(cw,wz)); c=rF(1,t); ctx.quadraticCurveTo(cx+c,cy-rF(da,dz),cx+t,cy); cx+=t; cw-=t;}
Severity: Major
Found in client/thirdparty/instant/instant.js and 1 other location - About 2 hrs to fix
client/thirdparty/instant/instant.js on lines 166..166

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

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

    function createFeed() {
        // if there is styleless output, use the content of this variable and ignore the rest
        if ($this->stylelessOutput!="") {
            return $this->stylelessOutput;
        }
Severity: Major
Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 2 hrs to fix

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

        public function addDependencies($dependencies = array(), $component = null)
        {
            if ($this->environment->isProduction() && !empty($dependencies['production'])) {
                $this->addDependencies($dependencies['production']);
            }

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

    function get_mobile_data( $pv_browser_user_agent )
    {
        $mobile_browser = '';
        $mobile_browser_number = '';
        $mobile_device = '';
    Severity: Major
    Found in php/thirdparty/browser_detection.php - About 2 hrs to fix

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

          public function __toString()
          {
              $hour = substr($this->getValue(), 0, 2);
              if ($hour >= 12) {
                  $ampm = 'pm';
      Severity: Major
      Found in php/framework/objects/travi/framework/content/form.class.php - About 2 hrs to fix

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

        <?php
        
        namespace travi\framework\email;
        
        
        
        Severity: Major
        Found in php/framework/src/travi/framework/email/Email.php and 1 other location - About 2 hrs to fix
        php/framework/src/travi/framework/photos/Media.php on lines 1..53

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

        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
        
        namespace travi\framework\photos;
        
        class Media
        Severity: Major
        Found in php/framework/src/travi/framework/photos/Media.php and 1 other location - About 2 hrs to fix
        php/framework/src/travi/framework/email/Email.php on lines 1..80

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

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

            function createFeed() {     
                $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
                $feed.= $this->_createGeneratorComment();
                if ($this->cssStyleSheet=="") {
                    $cssStyleSheet = "http://www.w3.org/2000/08/w3c-synd/style.css";
        Severity: Major
        Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 2 hrs to fix

          Field has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          abstract class Field extends ContentObject implements FormElement
          {
              protected $validations = array();
              protected $name;
              protected $label;
          Severity: Minor
          Found in php/framework/src/travi/framework/components/Forms/Field.php - About 2 hrs to fix

            Method upload has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function upload($isImage=false)
                {
                    if ($this->acceptedMimetype($this->mimetype)) {
                        $this->checkDirectory();
            
            
            Severity: Major
            Found in php/framework/objects/utility/upload.class.php - About 2 hrs to fix

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

                              if(!preg_match("|\:\/\/|",$matches[2]))
                              {
                                  // no host in the path, so prepend
                                  $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port;
                                  // eliminate double slash
              Severity: Major
              Found in php/thirdparty/Snoopy/Snoopy.class.php and 1 other location - About 2 hrs to fix
              php/thirdparty/Snoopy/Snoopy.class.php on lines 504..515

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

              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(!preg_match("|\:\/\/|",$matches[2]))
                              {
                                  // no host in the path, so prepend
                                  $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port;
                                  // eliminate double slash
              Severity: Major
              Found in php/thirdparty/Snoopy/Snoopy.class.php and 1 other location - About 2 hrs to fix
              php/thirdparty/Snoopy/Snoopy.class.php on lines 681..692

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

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

                  function createFeed() {
                      $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
                      $feed.= $this->_createGeneratorComment();
                      $feed.= $this->_createStylesheetReferences();
                      $feed.= "<feed xmlns=\"http://www.w3.org/2005/Atom\"";
              Severity: Major
              Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 2 hrs to fix

                Method createPreview has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function createPreview($newHeight,$newWidth)
                    {
                        if (empty($newHeight) && empty($newWidth)) {
                            $newHeight = 275;
                            $newWidth = 250;
                Severity: Minor
                Found in php/framework/objects/utility/upload.class.php - About 2 hrs to fix

                  Method _prepare_post_body has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function _prepare_post_body($formvars, $formfiles)
                      {
                          settype($formvars, "array");
                          settype($formfiles, "array");
                  
                  Severity: Minor
                  Found in php/thirdparty/Snoopy/Snoopy.class.php - About 2 hrs to fix

                    Method createFeed has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function createFeed() {
                            $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
                            $feed.= $this->_createGeneratorComment();
                            $feed.= $this->_createStylesheetReferences();
                            $feed.= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\"";
                    Severity: Minor
                    Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language