travi/php-framework

View on GitHub

Showing 176 of 176 total issues

Function index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function index(&$request, &$response)
    {
        $requestMethod = $request->getRequestMethod();

        if (Request::GET === $requestMethod) {
Severity: Minor
Found in php/framework/src/travi/framework/controller/CrudController.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

Method addDependencies has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

            elseif ( is_array( $os_working_data ) && ( $i == ( $i_count - 1 ) ) )
            {
                $j_count = count($os_working_data);
                for ($j = 0; $j < $j_count; $j++)
                {
    Severity: Major
    Found in php/thirdparty/browser_detection.php and 1 other location - About 1 hr to fix
    php/thirdparty/browser_detection.php on lines 912..924

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

    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

            elseif ( is_array( $os_working_data ) && ( $i == ( $i_count - 2 ) ) )
            {
                $j_count = count($os_working_data);
                for ($j = 0; $j < $j_count; $j++)
                {
    Severity: Major
    Found in php/thirdparty/browser_detection.php and 1 other location - About 1 hr to fix
    php/thirdparty/browser_detection.php on lines 929..943

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

    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 33 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.= "<opml xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n";
    Severity: Minor
    Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 1 hr to fix

      Method execute has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function execute ()
          {
              $ch = curl_init();
              $this->setAuth($ch);
      
      
      Severity: Minor
      Found in php/framework/src/travi/framework/http/RestClient.php - About 1 hr to fix

        Function _set_interface has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function _set_interface() {
                    // Apply the HTML markup into body tag
                    $('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>');
                    // Get page sizes
                    var arrPageSizes = ___getPageSize();
        Severity: Minor
        Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 hr to fix

          Function createFeed has a Cognitive Complexity of 11 (exceeds 5 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

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

              function _setMIME($format) {
                  switch (strtoupper($format)) {
                      
                      case "2.0":
                          // fall through
          Severity: Minor
          Found in php/thirdparty/FeedCreator/include/feedcreator.class.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 addCacheBusters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function addCacheBusters()
              {
                  foreach ($this->requirementLists as $key => $list) {
                      if ($key === self::CSS_LIST || $key === self::JS_LIST) {
                          foreach ($list as $index => $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 createPreview has a Cognitive Complexity of 11 (exceeds 5 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 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 createFeed has a Cognitive Complexity of 11 (exceeds 5 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: Minor
          Found in php/thirdparty/FeedCreator/include/feedcreator.class.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

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

                          if(canvas.width>canvas.height) {
                              ff=(canvas.height/canvas.width); xo=0; yo=((ww*ff)-hh)/2; hh=(ww*ff);
                          }else if(canvas.width<canvas.height) {
                              ff=(canvas.width/canvas.height); yo=0; xo=((hh*ff)-ww)/2; ww=(hh*ff);
                          }else {
          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 382..386

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

          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

                          }else if(canvas.width<canvas.height) {
                              ff=(canvas.width/canvas.height); yo=0; xo=((hh*ff)-ww)/2; ww=(hh*ff);
                          }else {
                              ff=1; xo=0; yo=0;
                          }
          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 380..386

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

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

              public function remove(&$request, &$response)
              {
                  $form      = new Form(
                      array(
                          'action' => $this->getUrlPrefix() . $request->getId()
          Severity: Minor
          Found in php/framework/src/travi/framework/controller/CrudController.php - About 1 hr to fix

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

                function createFeed() {
                    $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
                    $feed.= $this->_createStylesheetReferences();
                    $feed.= "<feed version=\"0.1\" xmlns=\"http://example.com/newformat#\">\n"; 
                    $feed.= "    <title>".FeedCreator::iTrunc(htmlspecialchars($this->title),100)."</title>\n";
            Severity: Minor
            Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 1 hr to fix

              Method createSquareThumb has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function createSquareThumb($thumb_size = "")
                  {
                      if (empty($thumb_size)) {
                          $thumb_size = 75;
                      }
              Severity: Minor
              Found in php/framework/objects/utility/upload.class.php - About 1 hr to fix

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

                            if (intImageWidth > x) {
                                intAdjustedHeight = intAdjustedHeight * (x / intAdjustedWidth);
                                intAdjustedWidth = x;
                                if (intAdjustedHeight > y) {
                                    intAdjustedWidth = intAdjustedWidth * (y / intAdjustedHeight);
                client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js on lines 220..227

                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

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

                            text = canvas.alt!=''&&itxtalt!=0?canvas.alt:canvas.title!=''&&itxttitle!=0?canvas.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 251..251

                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

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

                            else if (intImageHeight > y) {
                                intAdjustedWidth = intAdjustedWidth * (y / intAdjustedHeight);
                                intAdjustedHeight = y;
                                if (intAdjustedWidth > x) {
                                    intAdjustedHeight = intAdjustedHeight * (x / intAdjustedWidth);
                client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js on lines 212..227

                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

                Severity
                Category
                Status
                Source
                Language