railpage/railpagecore

View on GitHub

Showing 708 of 9,214 total issues

Function getChildLocations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getChildLocations($parent_id = 0) {

        $query = "SELECT jn_location_id, jn_location_name, ? AS jn_parent_id FROM jn_locations WHERE jn_parent_id = ? ORDER BY jn_location_name";

        if ($this->db instanceof \sql_db) {
Severity: Minor
Found in lib/Jobs/Locations.php - About 45 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 recordLogin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function recordLogin($clientAddr = false) {

        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
            return false;
        }
Severity: Minor
Found in lib/Users/User.php - About 45 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 createNewExif has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function createNewExif($type, $exif) {
        
        switch ($type) {
            
            case "camera_id" :
Severity: Minor
Found in lib/Images/Exif.php - About 45 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 getLinks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getLinks($categoryId = false, $sort = "title", $direction = "ASC") {
        if (!$this->db || !$categoryId) {
            return false;
        }
        
Severity: Minor
Found in lib/Links/Links.php - About 45 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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct() {

        $timer = Debug::getTimer();

        Debug::RecordInstance();
Severity: Minor
Found in lib/Users/User.php - About 45 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 findImage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function findImage($provider = null, $photoId = null, $option = null) {
        if (is_null($provider)) {
            throw new Exception("Cannot lookup image from image provider - no provider given (hint: Flickr, WestonLangford)");
        }
        
Severity: Minor
Found in lib/Images/Images.php - About 45 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 getStatusDescription has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getStatusDescription($statusId = null) {
        if (!filter_var($statusId, FILTER_VALIDATE_INT)) {
            return;
        }
        
Severity: Minor
Found in lib/Ideas/Ideas.php - About 45 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 randomImage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function randomImage($namespace, $namespaceKey) {
        
        $Database = (new AppCore)->getDatabaseConnection(); 
        
        if (is_null($namespace) && !is_null($namespaceKey)) {
Severity: Minor
Found in lib/Images/Utility/Finder.php - About 45 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 deeply nested control flow statements.
Open

                                    if (!$Loco->Class->hasCoverImage()) {
                                        $Loco->Class->setCoverImage($this);
                                    }
Severity: Major
Found in lib/Images/Image.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                    if (!$LocoClass->hasCoverImage()) {
                                        $LocoClass->setCoverImage($this);
                                    }
    Severity: Major
    Found in lib/Images/Image.php - About 45 mins to fix

      Function getJSON has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getJSON() {
      
              if (isset( $this->author )) {
                  $author = clone $this->author;
      
      Severity: Minor
      Found in lib/Images/Image.php - About 45 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 deeply nested control flow statements.
      Open

                                          if (!$Loco->hasCoverImage()) {
                                              $Loco->setCoverImage($this);
                                          }
      Severity: Major
      Found in lib/Images/Image.php - About 45 mins to fix

        Function sendNotification has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function sendNotification(Competition $photoComp, $notificationOptions) {
                
                if (count((new Competitions)->getPreviousContestants()) == 0) {
                    return false;
                }
        Severity: Minor
        Found in lib/Images/Utility/CompetitionUtility.php - About 45 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 load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                private function load() {
                    
                    $this->mckey = sprintf("railpage:locations.location=%d", $this->id); 
                    
                    if (!$row = $this->Memcached->fetch($this->mckey)) {
        Severity: Minor
        Found in lib/Locations/Location.php - About 45 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 Process has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function Process($string, $doEmoticons = true) {
                
                if (!$doEmoticons) {
                    return $string; 
                }
        Severity: Minor
        Found in lib/Formatting/EmoticonsUtility.php - About 45 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 listMessages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                public function listMessages($start = 0, $perpage = 25) {
                    if ($this->db instanceof \sql_db) {
                        $query = "SELECT * FROM messages ORDER BY message_id LIMIT ".$start.", ".$perpage."";
                        
                        if ($rs = $this->db->query($query)) {
        Severity: Minor
        Found in lib/SiteMessage/Admin.php - About 45 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 add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                public function add($message_text = false) {
                    if (!$message_text) {
                        return false;
                    }
                    
        Severity: Minor
        Found in lib/SiteMessage/Admin.php - About 45 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 embedRailpageDownload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function embedRailpageDownload($e) {
                
                if (pq($e)->attr("href") != pq($e)->text()) {
                    return $e;
                }
        Severity: Minor
        Found in lib/Formatting/MultimediaUtility.php - About 45 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 _split_str_by_whitespace has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function _split_str_by_whitespace( $string, $goal ) {
                $chunks = array();
            
                $string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
            
        Severity: Minor
        Found in lib/Formatting/MakeClickable.php - About 45 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 esc_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function esc_url( $url, $protocols = null, $_context = 'display' ) {
                $original_url = $url;
            
                if ( '' == $url )
                    return $url;
        Severity: Minor
        Found in lib/Formatting/MakeClickable.php - About 45 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