railpage/railpagecore

View on GitHub

Showing 708 of 9,214 total issues

Function getStoriesFromTopic has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        public function getStoriesFromTopic($id = false, $page = 0, $limit = 25, $total = true) {
            if (!$id || !$this->db) {
                return false;
            }
            
Severity: Minor
Found in lib/News/News.php - About 1 hr 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 unread has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        public function unread() {
            if ($this->db instanceof \sql_db) {
                $query = "SELECT DISTINCT privmsgs_id 
                            FROM nuke_bbprivmsgs 
                            WHERE privmsgs_to_userid = ".$this->db->real_escape_string($this->User->id)." 
Severity: Minor
Found in lib/PrivateMessages/User.php - About 1 hr 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 get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        public function get($id = false) {
            if (!$id) {
                return false;
            }
            
Severity: Minor
Found in lib/SiteMessage/Message.php - About 1 hr 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 CreateOrganisation has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        public static function CreateOrganisation($id = false) {
            
            $Memcached = AppCore::getMemcached(); 
            $Redis = AppCore::getRedis(); 
            $Registry = Registry::getInstance(); 
Severity: Minor
Found in lib/Organisations/Factory.php - About 1 hr 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 CreateEvent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

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

    public function bulkAddLocos($firstLoco = null, $lastLoco = null, $gaugeId = null, $statusId = null, $manufacturerId = null, $prefix = "") {
        if ($firstLoco == null) {
            throw new Exception("Cannot add locomotives to class - first loco number was not provided");
        }
        
Severity: Minor
Found in lib/Locos/LocoClass.php - About 1 hr 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 dispatch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        public function dispatch() {
            
            /**
             * Set the dispatch transport
             */
Severity: Minor
Found in lib/Notifications/Notification.php - About 1 hr 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 createRichText has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function createRichText() {

        if (!is_array($this->meta) || count($this->meta) === 0) {
            return;
        }
Severity: Minor
Found in lib/Locos/Date.php - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    function __construct($threadid = false) {
        
        if (RP_DEBUG) {
            global $site_debug;
            $debug_timer_start = microtime(true);
Severity: Minor
Found in lib/Forums/Thread.php - About 1 hr 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 users has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function users($num_users = 5) {
        if ($this->db instanceof \sql_db) {
            $query = "SELECT user_id, username, uWheat, uChaff, (uWheat / uChaff * 100) AS rating FROM nuke_users WHERE user_active = 1 ORDER BY rating DESC LIMIT 0, ".$this->db->real_escape_string($num_users); 
            
            if ($rs = $this->db->query($query)) {
Severity: Minor
Found in lib/Forums/Stats.php - About 1 hr 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 setConfig has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function setConfig($config = null) {
        
        if ($this->type == "LocalFS") {
            if (substr($config['storageRoot'], -1) != "/") {
                $config['storageRoot'] .= "/"; 
Severity: Minor
Found in lib/Railcams/Storage.php - About 1 hr 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 forums has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function forums() {
        $query = "SELECT * FROM nuke_bbforums";
        
        if ($this->db instanceof \sql_db) {
            if ($rs = $this->db->query($query)) {
Severity: Minor
Found in lib/Forums/Index.php - About 1 hr 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 buildCurrentPage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildCurrentPage() {
        
        $links = $this->getParam("links"); 
        $currentPage = $this->getParam("current_page"); 
        
Severity: Minor
Found in lib/Pagination.php - About 1 hr 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 getVideos has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getVideos($num = 25) {
        if (!$this->video_store_url) {
            return false;
        }
        
Severity: Minor
Found in lib/Railcams/Camera.php - About 1 hr 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

Method removeUserFavourite has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function removeUserFavourite() {
        
        /**
         * Because I'll no doubt get confused - frequently - at the order of parameters, 
         * let's just be a sneaky bastard and check each parameter
Severity: Minor
Found in lib/Images/Favourites.php - About 1 hr to fix

    Method fetch has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function fetch() {
            
            $mckey = sprintf("railpage:group=%d", intval($this->id)); 
            
            if (!$row = $this->Redis->fetch($mckey)) {
    Severity: Minor
    Found in lib/Users/Group.php - About 1 hr to fix

      Method generateTitle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function generateTitle($row) {
              
              self::$row = $row;
              
              switch (self::$row['key']) {
      Severity: Minor
      Found in lib/Users/Timeline/Utility/ObjectTitle.php - About 1 hr to fix

        Method guest has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function guest() {
        
                $this->lang = "english";
                $this->date_format = "d M Y H:i";
                $this->avatar_filename = "blank.png";
        Severity: Minor
        Found in lib/Users/User.php - About 1 hr to fix

          Method commit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function commit() {
          
                  $this->validate();
          
                  $data = array(
          Severity: Minor
          Found in lib/Warnings/Warning.php - About 1 hr to fix

            Method lookup has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function lookup($type, $id, $activeOnly) {
                    
                    $Database = (new AppCore)->getDatabaseConnection(); 
                    
                    if ($type == "ip") {
            Severity: Minor
            Found in lib/BanControl/LookupUtility.php - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language