travi/php-framework

View on GitHub

Showing 140 of 176 total issues

Function optionAdder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function optionAdder($options=array())
    {
        if (isset($this->settings['optGroups'])) {
            foreach ($options as $optGroup => $values) {
                $this->optGroups[$optGroup] = array();

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

    public function buildMethods() {

        $methods = $this->_reflect->getMethods();

        foreach($methods as $method) {
Severity: Minor
Found in php/thirdparty/PHP-Dependency/library/Pd/Map/Builder/Class.php - About 35 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 init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function init($config)
    {
        $this->config = $config;

        if (isset($config['siteName'])) {
Severity: Minor
Found in php/framework/src/travi/framework/http/Response.php - About 35 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

Avoid too many return statements within this method.
Open

        return true;
Severity: Major
Found in php/thirdparty/Snoopy/Snoopy.class.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return ("You must select a file for upload");
    Severity: Major
    Found in php/framework/objects/utility/upload.class.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return ("There was an unknown problem with your upload");
      Severity: Major
      Found in php/framework/objects/utility/upload.class.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return false;
        Severity: Major
        Found in php/thirdparty/Snoopy/Snoopy.class.php - About 30 mins to fix

          Function wavedRect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function wavedRect(ctx,x,y,w,h,r,n){
              function rF(a,z) {return Math.random()*(z-a)+a;};
              var i,t,c,cx,cy,cw,ch,wa=w/16,wz=w/32,ha=h/16,hz=h/32,da=r*0.1,dz=r*0.25; if(!n) {ctx.beginPath();} ctx.moveTo(x,y);
              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;}
              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: Minor
          Found in client/thirdparty/instant/instant.js - About 25 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 buildPhotoListFrom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function buildPhotoListFrom($xmlElement, $options, $namespaces)
              {
                  $mediaList = array();
          
                  foreach ($xmlElement->entry as $entry) {
          Severity: Minor
          Found in php/framework/src/travi/framework/marshallers/PicasaUnmarshaller.php - About 25 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 getDecoratedTitle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getDecoratedTitle()
              {
                  if ($this->environment->isLocal()) {
                      $decoratedTitle = '[dev] ';
                  } else if ($this->environment->isProduction()) {
          Severity: Minor
          Found in php/framework/objects/travi/framework/page/AbstractResponse.php - About 25 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 format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function format()
              {
                  $acceptHeader = "";
          
                  if (isset($_SERVER['HTTP_ACCEPT'])) {
          Severity: Minor
          Found in php/framework/objects/travi/framework/page/AbstractResponse.php - About 25 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 _connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              function _connect(&$fp)
              {
                  if(!empty($this->proxy_host) && !empty($this->proxy_port))
                      {
                          $this->_isproxy = true;
          Severity: Minor
          Found in php/thirdparty/Snoopy/Snoopy.class.php - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getFieldByName($fieldName)
              {
                  $field = parent::getFieldByName($fieldName);
          
                  if (!isset($field)) {
          Severity: Minor
          Found in php/framework/src/travi/framework/components/Forms/Form.php - About 25 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 output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              function output() {
                  // when field available and syndicated in html we assume 
                  // - valid html in $rawFieldContent and we enclose in CDATA tags
                  // - no truncation (truncating risks producing invalid html)
                  if (!$this->rawFieldContent) {
          Severity: Minor
          Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 25 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 buildQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              function buildQuery()
              {
                  $thisFileId = "";
                  if (isset($this->dbConnection) && isset($this->insertIdQuery)) {
                      $thisFileId = $this->getInsertId();
          Severity: Minor
          Found in php/framework/objects/utility/upload.class.php - About 25 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 _striplinks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              function _striplinks($document)
              {    
                  preg_match_all("'<\s*a\s+.*href\s*=\s*            # find <a href=
                                  ([\"\'])?                    # find single or double quote
                                  (?(1) (.*?)\\1 | ([^\s\>]+))        # if quote found, match up to next matching
          Severity: Minor
          Found in php/thirdparty/Snoopy/Snoopy.class.php - About 25 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 getClasses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function getClasses(classes,string){
              var temp = '';
              for (var j=0;j<classes.length;j++) {
                  if (classes[j] != string) {
                      if (temp) {
          Severity: Minor
          Found in client/thirdparty/instant/instant.js - About 25 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 createFeed has a Cognitive Complexity of 6 (exceeds 5 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 25 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 getImages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function getImages(className){
              var children = document.getElementsByTagName('img'); 
              var elements = new Array(); var i = 0;
              var child; var classNames; var j = 0;
              for (i=0;i<children.length;i++) {
          Severity: Minor
          Found in client/thirdparty/instant/instant.js - About 25 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 getLinesFromFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getLinesFromFile($fileName, $pathToFile)
              {
                  $pwFile = $this->sitePath . $pathToFile . $fileName;
          
                  if (file_exists($pwFile) && is_readable($pwFile)) {
          Severity: Minor
          Found in php/framework/src/travi/framework/utilities/FileSystem.php - About 25 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