hyperrail/hyperrail-for-android

View on GitHub

Showing 392 of 393 total issues

Method process has a Cognitive Complexity of 74 (exceeds 15 allowed). Consider refactoring.
Open

    @AddTrace(name = "RouteResponseListener.process")
    private void process(LinkedConnections data) throws StopLocationNotResolvedException {
        // Keep searching
        // - while no results have been found
        // - until we have the number of results we'd like (in case no departure time is given)

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 197 lines of code (exceeds 50 allowed). Consider refactoring.
Open

    @AddTrace(name = "RouteResponseListener.process")
    private void process(LinkedConnections data) throws StopLocationNotResolvedException {
        // Keep searching
        // - while no results have been found
        // - until we have the number of results we'd like (in case no departure time is given)

    File IrailApi.java has 396 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * This Source Code Form is subject to the terms of the Mozilla Public
     * License, v. 2.0. If a copy of the MPL was not distributed with this
     * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     */

      File IrailApiParser.java has 389 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       * This Source Code Form is subject to the terms of the Mozilla Public
       * License, v. 2.0. If a copy of the MPL was not distributed with this
       * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       */

        File Lc2IrailDataSource.java has 380 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
         * This Source Code Form is subject to the terms of the Mozilla Public
         * License, v. 2.0. If a copy of the MPL was not distributed with this
         * file, You can obtain one at http://mozilla.org/MPL/2.0/.
         */

          File VehiclePopupContextMenu.java has 346 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
           * This Source Code Form is subject to the terms of the Mozilla Public
           * License, v. 2.0. If a copy of the MPL was not distributed with this
           * file, You can obtain one at http://mozilla.org/MPL/2.0/.
           */

            File RouteSearchFragment.java has 345 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             * This Source Code Form is subject to the terms of the Mozilla Public
             * License, v. 2.0. If a copy of the MPL was not distributed with this
             * file, You can obtain one at http://mozilla.org/MPL/2.0/.
             */

              File LinkedConnectionsDataSource.java has 335 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              package be.hyperrail.opentransportdata.be.experimental.linkedconnections;
              
              import android.content.Context;
              import android.net.ConnectivityManager;
              import android.net.NetworkInfo;

                File PersistentQueryProvider.java has 329 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*
                 * This Source Code Form is subject to the terms of the Mozilla Public
                 * License, v. 2.0. If a copy of the MPL was not distributed with this
                 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
                 */

                  Method convertAm has 110 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                      private static NmbsTrainType convertAm(String parentType, String subType, String orientation, int firstClassSeats) {
                          String newParentType = parentType;
                          String newSubType = subType;
                          switch (parentType) {
                              case "AM08":

                    Method generateStopArray has 104 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                        @AddTrace(name = "LiveboardResponseListener.createStopArray")
                        private VehicleStopImpl[] generateStopArray() {
                            // Find stops (train arrives and leaves again)
                            ArrayList<LinkedConnection> handledConnections = new ArrayList<>();
                    
                    

                      Method convertAm has a Cognitive Complexity of 32 (exceeds 15 allowed). Consider refactoring.
                      Open

                          private static NmbsTrainType convertAm(String parentType, String subType, String orientation, int firstClassSeats) {
                              String newParentType = parentType;
                              String newSubType = subType;
                              switch (parentType) {
                                  case "AM08":

                      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

                      File RouteResponseListener.java has 294 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*
                       * This Source Code Form is subject to the terms of the Mozilla Public
                       * License, v. 2.0. If a copy of the MPL was not distributed with this
                       * file, You can obtain one at http://mozilla.org/MPL/2.0/.
                       */

                        Method parseRoute has 101 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                            private Route parseRoute(JSONObject routeObject) throws JSONException, StopLocationNotResolvedException {
                                JSONObject departure = routeObject.getJSONObject("departure");
                                JSONObject arrival = routeObject.getJSONObject("arrival");
                        
                                TransportOccupancyLevel departureOccupancyLevel = parseOccupancyLevel(departure);

                          File MainActivity.java has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /*
                           * This Source Code Form is subject to the terms of the Mozilla Public
                           * License, v. 2.0. If a copy of the MPL was not distributed with this
                           * file, You can obtain one at http://mozilla.org/MPL/2.0/.
                           */

                            Method convertCarriage has 99 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                                private static NmbsTrainType convertCarriage(String parentType, String subType, String orientation, int firstClassSeats, int position) {
                                    String newParentType = parentType;
                                    String newSubType = subType;
                                    String newOrientation = orientation;
                                    switch (parentType) {

                              Lc2IrailDataSource has 30 methods (exceeds 25 allowed). Consider refactoring.
                              Open

                              public class Lc2IrailDataSource implements TransportDataSource, MeteredDataSource {
                              
                                  private final static String TAG_IRAIL_API_GET = "LC2IRAIL_GET";
                                  private static final String UA = "OpenTransport-be-experimental for Android";
                                  private static final OpenTransportLog log = OpenTransportLog.getLogger(Lc2IrailDataSource.class);

                                File VehicleFragment.java has 278 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                /*
                                 * This Source Code Form is subject to the terms of the Mozilla Public
                                 * License, v. 2.0. If a copy of the MPL was not distributed with this
                                 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
                                 */

                                  File Lc2IrailParser.java has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  /*
                                   * This Source Code Form is subject to the terms of the Mozilla Public
                                   * License, v. 2.0. If a copy of the MPL was not distributed with this
                                   * file, You can obtain one at http://mozilla.org/MPL/2.0/.
                                   */

                                    File LiveboardSearchFragment.java has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    /*
                                     * This Source Code Form is subject to the terms of the Mozilla Public
                                     * License, v. 2.0. If a copy of the MPL was not distributed with this
                                     * file, You can obtain one at http://mozilla.org/MPL/2.0/.
                                     */
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language