cowbell/cordova-plugin-geofence

View on GitHub

Showing 78 of 112 total issues

Function savepoint has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static func savepoint(savepointClosure: ()->Bool) -> Int? {

        //create the error variable
        var error: Int? = nil

Severity: Minor
Found in src/ios/SwiftData.swift - About 1 hr to fix

    Method ExecuteCustomCode has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public void ExecuteCustomCode() {
            logger.log(Log.DEBUG, "Adding new geofences...");
            if (geofencesToAdd != null && geofencesToAdd.size() > 0) try {
                LocationServices.GeofencingApi
    Severity: Minor
    Found in src/android/AddGeofenceCommand.java - About 1 hr to fix

      Method getUriFromRemote has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private Uri getUriFromRemote(String path) {
              File dir = context.getExternalCacheDir();
      
              if (dir == null) {
                  Log.e("Asset", "Missing external cache dir");
      Severity: Minor
      Found in src/android/AssetUtil.java - About 1 hr to fix

        Method onCommandExecuted has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public void onCommandExecuted(Object error) {
                if (error != null) try {
                    if (error instanceof Throwable) {
                        JSONObject errorObject = new JSONObject();
        Severity: Minor
        Found in src/android/CommandExecutionHandler.java - 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 openWithFlags has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                func openWithFlags(flags: Int32) -> Int? {
        
                    //check if in transaction
                    if inTransaction {
                        print("SwiftData Error -> During: Opening Database with Flags")
        Severity: Minor
        Found in src/ios/SwiftData.swift - About 1 hr to fix

          Function executeChange has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  func executeChange(sqlStr: String, withArgs: [AnyObject]? = nil) -> Int? {
          
                      var sql = sqlStr
                      if let args = withArgs {
                          let result = bind(args, toSQL: sql)
          Severity: Minor
          Found in src/ios/SwiftData.swift - About 1 hr to fix

            Method execute has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public boolean execute(final String action, final JSONArray args,
                                       final CallbackContext callbackContext) throws JSONException {
                    Log.d(TAG, "GeofencePlugin execute action: " + action + " args: " + args.toString());
                    executedAction = new Action(action, args, callbackContext);
            Severity: Minor
            Found in src/android/GeofencePlugin.java - About 1 hr to fix

              Function executeChange has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                      func executeChange(sqlStr: String, withArgs: [AnyObject]? = nil) -> Int? {
              
                          var sql = sqlStr
                          if let args = withArgs {
                              let result = bind(args, toSQL: sql)
              Severity: Minor
              Found in src/ios/SwiftData.swift - 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 getColumnValue has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                      func getColumnValue(statement: COpaquePointer, index: Int32, type: String) -> AnyObject? {
              
                          switch type {
                          case "INT", "INTEGER", "TINYINT", "SMALLINT", "MEDIUMINT", "BIGINT", "UNSIGNED BIG INT", "INT2", "INT8":
                              if sqlite3_column_type(statement, index) == SQLITE_NULL {
              Severity: Minor
              Found in src/ios/SwiftData.swift - 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 notify has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public void notify(Notification notification) {
                      notification.setContext(context);
                      NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
                          .setVibrate(notification.getVibrate())
                          .setSmallIcon(notification.getSmallIcon())
              Severity: Minor
              Found in src/android/GeoNotificationNotifier.java - About 1 hr to fix

                Function transaction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static func transaction(transactionClosure: ()->Bool) -> Int? {
                
                        //create the error variable
                        var error: Int? = nil
                
                
                Severity: Minor
                Found in src/ios/SwiftData.swift - About 1 hr to fix

                  Method getUriForResourcePath has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private Uri getUriForResourcePath(String path) {
                          File dir = context.getExternalCacheDir();
                  
                          if (dir == null) {
                              Log.e("Asset", "Missing external cache dir");
                  Severity: Minor
                  Found in src/android/AssetUtil.java - About 1 hr to fix

                    Function closeCustomConnection has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            func closeCustomConnection() -> Int? {
                    
                                //check if in trasaction
                                if inTransaction {
                                    print("SwiftData Error -> During: Closing Database with Flags")
                    Severity: Minor
                    Found in src/ios/SwiftData.swift - About 1 hr to fix

                      Function executeMultipleChanges has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static func executeMultipleChanges(sqlArr: [String]) -> Int? {
                      
                              //create error variable
                              var error: Int? = nil
                      
                      
                      Severity: Minor
                      Found in src/ios/SwiftData.swift - About 1 hr to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    switch sqlite3_column_type(pStmt, i) {
                                                    case 1:
                                                        columnType = "INTEGER"
                                                    case 2:
                                                        columnType = "FLOAT"
                        Severity: Major
                        Found in src/ios/SwiftData.swift - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                      if let columnValue: AnyObject = getColumnValue(pStmt, index: i, type: columnType) {
                                                          row[columnName] = SDColumn(obj: columnValue)
                                                      }
                          Severity: Major
                          Found in src/ios/SwiftData.swift - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                        if let columnValue: AnyObject = getColumnValue(pStmt, index: i, type: columnType) {
                                                            row[columnName] = SDColumn(obj: columnValue)
                                                        }
                            Severity: Major
                            Found in src/ios/SwiftData.swift - About 45 mins to fix

                              Function execPromise has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function execPromise(success, error, pluginName, method, args) {
                              Severity: Minor
                              Found in www/geofence.js - About 35 mins to fix

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

                                    func getAll() -> [JSON]? {
                                        let (resultSet, err) = SD.executeQuery("SELECT * FROM GeoNotifications")
                                
                                        if err != nil {
                                            //there was an error during the query, handle it here
                                Severity: Minor
                                Found in src/ios/GeofencePlugin.swift - 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 openWithFlags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                        func openWithFlags(flags: Int32) -> Int? {
                                
                                            //check if in transaction
                                            if inTransaction {
                                                print("SwiftData Error -> During: Opening Database with Flags")
                                Severity: Minor
                                Found in src/ios/SwiftData.swift - 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