railpage/railpagecore

View on GitHub

Showing 708 of 9,214 total issues

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

    public function __construct($id = null) {
        
        parent::__construct();
        
        if ($id !== null && !filter_var($id, FILTER_VALIDATE_INT)) {
Severity: Minor
Found in lib/fwlink.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 multiUsers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function multiUsers() {
        ini_set("memory_limit", "300M");
        
        $query = "SELECT h.*, u.username 
                    FROM nuke_users_hash AS h
Severity: Minor
Found in lib/Users/Admin.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 getModules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public function getModules($type = "all") {
            if (empty($type)) {
                $type = "all";
            }
            
Severity: Minor
Found in lib/Modules/Modules.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->name)) {
            throw new Exception("Camera name is empty"); 
        }
Severity: Minor
Found in lib/Images/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 processSighting has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function processSighting() {
        if (empty(self::$row['module']) || !isset(self::$row['module'])) {
            self::$row['module'] = "sightings";
        }
        
Severity: Minor
Found in lib/Users/Timeline/Utility/ObjectTitle.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 commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function commit($force = false) {

        $this->validate($force);

        Utility\UserUtility::clearCache($this);
Severity: Minor
Found in lib/Users/User.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 getLogins has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getLogins($itemsPerPage = 25, $page = 1) {

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

    public function loadNotes() {

        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
            return false;
        }
Severity: Minor
Found in lib/Users/User.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

    private function load() {
        
        /**
         * Fetch the WOE (Where On Earth) data from Yahoo
         */
Severity: Minor
Found in lib/Place.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 getFilteredForums has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getFilteredForums() {
        
        $timer = Debug::GetTimer(); 
        
        if (!isset($this->User->Guest) || !$this->User->Guest instanceof User) {
Severity: Minor
Found in lib/Users/Timeline.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 commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function commit() {
        
        $this->validate(); 
        
        $data = array(
Severity: Minor
Found in lib/Images/Competition.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 normaliseSizes_addMissingSizes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function normaliseSizes_addMissingSizes($missingSize, $minWidth, $minHeight) {
        
        if (isset(self::$sizes[$missingSize])) {
            return;
        }
Severity: Minor
Found in lib/Images/Images.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 removeControl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function removeControl($url = null, $text = null) {
        if ($url == null) {
            return false;
        }
        
Severity: Minor
Found in lib/PageControls.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 canVote has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function canVote(User $userObject) {
        
        if ($this->status == Ideas::STATUS_DELETED || $this->status == Ideas::STATUS_NO || $this->status == Ideas::STATUS_IMPLEMENTED) {
            return false;
        }
Severity: Minor
Found in lib/Ideas/Idea.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 display has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    function display($template = null, $cache_id = null, $compile_id = null, $parent = null) {
    
        if (RP_DEBUG) {
            global $site_debug;
            $debug_timer_start = microtime(true);
Severity: Minor
Found in lib/Template.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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($id = null) {
        
        parent::__construct();
        
        $this->Module = new Module("ideas");
Severity: Minor
Found in lib/Ideas/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

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

    private function validate() {

        if (!$this->Recipient instanceof User) {
            throw new Exception("Cannot validate warning level adjustment - no or invalid recipient provided");
        }
Severity: Minor
Found in lib/Warnings/Warning.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 getImage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getImage($id, $force = 0) {
        
        $mckey = sprintf("railpage:image.provider=%s;image=%d", self::PROVIDER_NAME, $id);
        
        $force = (bool) $force;
Severity: Minor
Found in lib/Images/Provider/Flickr.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 getPhotoContext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getPhotoContext($photos, $imageObject) {
        
        /**
         * Loop through the array once until we find the provided image. Add photos to a temporary array, and then we slice it to return the last 4 entries to the array
         */
Severity: Minor
Found in lib/Images/Utility/CompetitionUtility.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 getIcon has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getIcon() {
        
        $mime = explode("/", $this->mime); 
        
        switch ($mime[0]) {
Severity: Minor
Found in lib/Downloads/Download.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

Severity
Category
Status
Source
Language