travi/php-framework

View on GitHub

Showing 140 of 176 total issues

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

      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

          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

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

              Function wavedRect has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function wavedRect(ctx,x,y,w,h,r,n){
              Severity: Major
              Found in client/thirdparty/instant/instant.js - About 50 mins to fix

                Function roundedRect has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function roundedRect(ctx,x,y,width,height,radius,nopath){
                Severity: Major
                Found in client/thirdparty/instant/instant.js - About 50 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if ( !$moz_rv )
                                          {
                                              // you can use this if you are running php >= 4.2
                                              if ( function_exists( 'floatval' ) )
                                              {
                  Severity: Major
                  Found in php/thirdparty/browser_detection.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if(!window.opera) addLining(context,border,border,canvas.width-(border*2),canvas.height-(border*4),opacity,inset,true);
                    Severity: Major
                    Found in client/thirdparty/instant/instant.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if ( $browser_number < 5 )// opera 4 wasn't very useable.
                                              {
                                                  $b_safe_browser = false;
                                              }
                      Severity: Major
                      Found in php/thirdparty/browser_detection.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                for ( $j = 0; $j < $j_count; $j++ )
                                                {
                                                    if ( strstr( $browser_user_agent, $a_webkit_types[$j] ) )
                                                    {
                                                        $webkit_type = $a_webkit_types[$j];
                        Severity: Major
                        Found in php/thirdparty/browser_detection.php - About 45 mins to fix

                          Function addShading has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function addShading(ctx,x,y,width,height,opacity) {
                          Severity: Minor
                          Found in client/thirdparty/instant/instant.js - About 45 mins to fix

                            Function addLinearStyle has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function addLinearStyle(ctx,x,y,w,h,opacity) {
                            Severity: Minor
                            Found in client/thirdparty/instant/instant.js - About 45 mins to fix

                              Function qC has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  function qC(cX,cY,CPx,CPy,aX,aY) {var z=new Array(6); z[0]=cX+2.0/3.0*(CPx-cX); z[1]=cY+2.0/3.0*(CPy-cY); z[2]=z[0]+(aX-cX)/3.0; z[3]=z[1]+(aY-cY)/3.0; z[4]=aX; z[5]=aY; return z;}
                              Severity: Minor
                              Found in client/thirdparty/instant/instant.js - About 45 mins to fix

                                Method _httprequest has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="")
                                Severity: Minor
                                Found in php/thirdparty/Snoopy/Snoopy.class.php - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language