railpage/railpagecore

View on GitHub

Showing 1,011 of 9,214 total issues

Method validatePassword has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function validatePassword($password = false, $username = false) {
        
        Utility\PasswordUtility::validateParameters($password, $username, $this); 

        /**
Severity: Major
Found in lib/Users/User.php - About 2 hrs to fix

    Method unBanUser has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function unBanUser($banId, $userId = null) {
            $success = false;
            
            /**
             * Empty the cache
    Severity: Major
    Found in lib/BanControl/BanControl.php - About 2 hrs to fix

      Function getAddress has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getAddress() {
              
              $mckey = sprintf("railpage.place.address.lat=%s&lon=%s", $this->lat, $this->lon);
              
              if ($address = $this->Memcached->fetch($mckey)) {
      Severity: Minor
      Found in lib/Place.php - About 2 hrs 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 autoPopulateNextComp has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function autoPopulateNextComp() {
              $month = new DateTime("first day of next month"); 
              
              $title = $month->format("F Y");
              
      Severity: Minor
      Found in lib/Images/Competitions.php - About 2 hrs 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 getStylesheets has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getStylesheets() {
              $tags = array(); 
              
              $minify = array(); 
              
      Severity: Minor
      Found in lib/Template.php - About 2 hrs 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 isClientBanned has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function isClientBanned($userId, $remoteAddr, $force = null) {
              
              if ($remoteAddr == "58.96.64.238" || $userId == 71317) {
                  $force = true;
              }
      Severity: Minor
      Found in lib/BanControl/BanControl.php - About 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function Process( $text ) {
              
              $timer = Debug::GetTimer(); 
              
              $r = '';
      Severity: Minor
      Found in lib/Formatting/MakeClickable.php - About 2 hrs 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 getTimeline has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getTimeline() {
              $query = "SELECT d.*, lu.loco_num, ld.loco_date_text FROM loco_unit_date AS d INNER JOIN loco_date_type AS ld ON ld.loco_date_id = d.loco_date_id INNER JOIN loco_unit AS lu ON lu.loco_id = d.loco_unit_id WHERE lu.class_id = ? ORDER BY timestamp ASC";
              
              $return = array(
                  "timeline" => array(
      Severity: Minor
      Found in lib/Locos/LocoClass.php - About 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
      Open

          public function commit() {
              if (empty($this->bbcode_uid)) {
                  $this->bbcode_uid = crc32($this->text);
              }
              
      Severity: Minor
      Found in lib/Forums/Post.php - About 2 hrs 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 hybi10Encode has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          private function hybi10Encode($payload, $type = 'text', $masked = true)
          {
              $frameHead = array();
              $payloadLength = strlen($payload);
              switch ($type) {
      Severity: Minor
      Found in lib/SocketIO.php - About 2 hrs 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 process has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              private function process(array $item) {
                  
                  /**
                   * Process the description field
                   */
      Severity: Major
      Found in lib/RSS/Consume.php - About 2 hrs to fix

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

            public function fetch() {
        
                if (!is_string($this->feed)) {
                    throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
                }
        Severity: Major
        Found in lib/Jobs/Scraper.php - About 2 hrs to fix

          File Weekly.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
              /**
               * Curate a weekly newsletter
               * @since Version 3.10.0
               * @package Railpage
          Severity: Minor
          Found in lib/Newsletters/Weekly.php - About 2 hrs to fix

            File CountryCodes.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
                /**
                 * ISO 3166-1 country codes
                 * @since Version 3.10.0
                 * @package Railpage
            Severity: Minor
            Found in lib/Locations/Utility/CountryCodes.php - About 2 hrs to fix

              Method GetLoadingSVG has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function GetLoadingSVG(Image $imageObject) {
                      
                      $cachekey = sprintf("railpage:base64.image.svg=%d", $imageObject->id); 
                      
                      $Memcached = AppCore::GetMemcached(); 
              Severity: Major
              Found in lib/Images/Utility/ImageUtility.php - About 2 hrs to fix

                Method EmbedGoogleMap has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function EmbedGoogleMap(DOMElement $e) {
                        
                        $timer = Debug::GetTimer(); 
                        
                        $Config = AppCore::GetConfig(); 
                Severity: Major
                Found in lib/Formatting/MultimediaUtility.php - About 2 hrs to fix

                  Method getThumbnail has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getThumbnail() {
                          
                          $mime = explode("/", $this->mime); 
                          $thumbnail = sprintf("%s.thumbnail.jpg", $this->filepath);
                          
                  Severity: Major
                  Found in lib/Downloads/Download.php - About 2 hrs to fix

                    Method isClientBanned has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function isClientBanned($userId, $remoteAddr, $force = null) {
                            
                            if ($remoteAddr == "58.96.64.238" || $userId == 71317) {
                                $force = true;
                            }
                    Severity: Major
                    Found in lib/BanControl/BanControl.php - About 2 hrs to fix

                      Method send has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              public function send($markAsSent = false) {
                                  
                                  $this->validate(); 
                                  
                                  $Smarty = AppCore::getSmarty(); 
                      Severity: Major
                      Found in lib/Reminders/Reminder.php - About 2 hrs to fix

                        Function fetch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function fetch() {
                        
                                if (!is_string($this->feed)) {
                                    throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
                                }
                        Severity: Minor
                        Found in lib/Jobs/Scraper.php - About 2 hrs 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