railpage/railpagecore

View on GitHub

Showing 1,011 of 9,214 total issues

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

        public function getMessageForObject($Object = false) {
            if (!is_object($Object)) {
                throw new Exception("You did not provide an object");
            } 
            
Severity: Minor
Found in lib/SiteMessages/SiteMessages.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 listorgs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public function listorgs($starter = false) {
            if ($starter == "number") {
                $starter = "WHERE o.organisation_name RLIKE '^[^A-Z]'";
            } elseif (preg_match("@([a-zA-Z]+)@", $starter)) {
                $starter = "WHERE o.organisation_name LIKE '" . $starter . "%'";
Severity: Minor
Found in lib/Organisations/Base.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 fetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function fetch() {
        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
            throw new Exception("Cannot fetch Livery object - no ID given"); 
            return false;
        }
Severity: Minor
Found in lib/Locos/Liveries/Livery.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 CreateEventCategory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function CreateEventCategory($id = null) {
        
        $CacheDriver = AppCore::getRedis(); 
        $Registry = Registry::getInstance(); 
        
Severity: Minor
Found in lib/Events/Factory.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function validate() {
        
        if (empty($this->title)) {
            $this->name = $this->path;
        }
Severity: Minor
Found in lib/Gallery/Image.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        private function validate() {
            if (empty($this->slug)) {
                $this->slug = parent::createSlug();
            }
            
Severity: Minor
Found in lib/Organisations/Organisation.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 populate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function populate($id) {
        
        $row = $this->load($id); 
        
        if (!isset($row) || !is_array($row)) {
Severity: Minor
Found in lib/Events/Event.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function validate() {
        if (empty($this->title)) {
            throw new Exception("Validation failed for event. Title cannot be empty");
        }
        
Severity: Minor
Found in lib/Events/Event.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function validate() {
        
        if (empty($this->title)) {
            throw new Exception("Title cannot be empty"); 
        }
Severity: Minor
Found in lib/Content/Page.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 getLatest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getLatest($update = true) {
        
        if ($footage = $this->getLatestFootage("image")) {
            
            return [
Severity: Minor
Found in lib/Railcams/Camera.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function validate() {
        
        if (!$this->Author instanceof User) {
            throw new Exception("A valid user object must be set using " . __CLASS__ . "::setAuthor()");
        }
Severity: Minor
Found in lib/Chronicle/Entry.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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function load() {
        if (empty($this->id) || $this->id === false) {
            throw new Exception("Cannot load Railcam - empty or invalid ID given"); 
        }
        
Severity: Minor
Found in lib/Railcams/Camera.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 exists has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public function exists() {
            
            if (!$this->User instanceof User) {
                throw new Exception("Can't lookup a reminder because no user was specified");
            }
Severity: Minor
Found in lib/Reminders/Reminder.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 getForums has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getForums() {
        
        if (!$this->User instanceof User) {
            throw new Exception("Cannot get the list of forums within this category because no valid user has been specified");
        }
Severity: Minor
Found in lib/Forums/Category.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 self::GravatarHTTPS($userAvatar);
Severity: Major
Found in lib/Users/Utility/AvatarUtility.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return true;
    Severity: Major
    Found in lib/Links/Link.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return false;
      Severity: Major
      Found in lib/Images/Competition.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return false;
        Severity: Major
        Found in lib/Images/Competition.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return self::GravatarHTTPS($userAvatar); 
          Severity: Major
          Found in lib/Users/Utility/AvatarUtility.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return self::GravatarHTTPS($result);
            Severity: Major
            Found in lib/Users/Utility/AvatarUtility.php - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language