railpage/railpagecore

View on GitHub

Showing 708 of 9,214 total issues

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

    private function closeCorrection($type, $reason) {
        
        if (!isset($this->Resolution->User) || !$this->Resolution->User instanceof User) {
            throw new Exception("Cannot close correction - User resolving this correction not specified");
        }
Severity: Minor
Found in lib/Locos/Correction.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 loadNotes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadNotes() {
        $query = "SELECT n.*, u.username, user_avatar FROM loco_notes AS n LEFT JOIN nuke_users AS u ON n.user_id = u.user_id WHERE n.loco_id = ?";
        
        $notes = array(); 
        
Severity: Minor
Found in lib/Locos/Locomotive.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 formatDepartures has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function formatDepartures($departures) {
        $return = array();
        
        if (isset($departures['values'])) {
            foreach ($departures['values'] as $row) {
Severity: Minor
Found in lib/GTFS/AU/VIC/PTV/Stop.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 addDividers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function addDividers() {
        
        $links = $this->getParam("links");
        
        end($links); 
Severity: Minor
Found in lib/Pagination.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 getEventsForDates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getEventsForDates($dateFrom = null, $dateTo = null) {
        
        $events = array(); 
        
        $Railcams = new Module_Railcams;
Severity: Minor
Found in lib/Chronicle/Provider/Railcams.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 getAllowedForumsIDsForUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAllowedForumsIDsForUser(User $User, $permission = self::AUTH_ALL) {
        $acl = $this->setUser($User)->getACL(); 
        
        $ids = array(); 
        $allforums = $this->getAllForums();
Severity: Minor
Found in lib/Forums/Forums.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 updateUserThreadView has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function updateUserThreadView(Thread $Thread, $User = false) {
        
        // Prevent browser prefetch/preview from creating a timestamp
        if (
            (isset($_SERVER["HTTP_X_PURPOSE"]) && (strtolower($_SERVER["HTTP_X_PURPOSE"]) == "preview")) || 
Severity: Minor
Found in lib/Forums/Utility/ForumsUtility.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 tagLoco has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function tagLoco(Locomotive $Loco) {
        
        if (!filter_var($Loco->id, FILTER_VALIDATE_INT)) {
            throw new Exception("An invalid instance of Railpage\\Locos\\Locomotive was supplied");
        }
Severity: Minor
Found in lib/Railcams/Photo.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