cowbell/cordova-plugin-geofence

View on GitHub

Showing 78 of 112 total issues

File SwiftData.swift has 1191 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Foundation
import UIKit


// MARK: - SwiftData
Severity: Major
Found in src/ios/SwiftData.swift - About 3 days to fix

    File GeofencePlugin.swift has 436 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import Foundation
    import AudioToolbox
    import WebKit
    
    let TAG = "GeofencePlugin"
    Severity: Minor
    Found in src/ios/GeofencePlugin.swift - About 6 hrs to fix

      Function executeQuery has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

              func executeQuery(sqlStr: String, withArgs: [AnyObject]? = nil) -> (result: [SDRow], error: Int?) {
      
                  var resultSet = [SDRow]()
      
                  var sql = sqlStr
      Severity: Minor
      Found in src/ios/SwiftData.swift - About 5 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 coerceProperties has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

      function coerceProperties(geofence) {
          if (geofence.id) {
              geofence.id = geofence.id.toString();
          } else {
              throw new Error("Geofence id is not provided");
      Severity: Minor
      Found in www/geofence.js - About 4 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 escapeValue has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          func escapeValue(obj: AnyObject?) -> String {
      
              if let obj: AnyObject = obj {
      
                  if obj is String {
      Severity: Minor
      Found in src/ios/SwiftData.swift - About 4 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 errorMessageFromCode has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static func errorMessageFromCode(errorCode: Int) -> String {
      
              switch errorCode {
      
              //no error
      Severity: Major
      Found in src/ios/SwiftData.swift - About 3 hrs to fix

        Function checkRequirements has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        func checkRequirements() -> (Bool, [String], [[String:String]]) {
            var errors = [[String:String]]()
            var warnings = [String]()
            
            if (!CLLocationManager.isMonitoringAvailableForClass(CLRegion)) {
        Severity: Minor
        Found in src/ios/GeofencePlugin.swift - About 3 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 onHandleIntent has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            protected void onHandleIntent(Intent intent) {
                Logger logger = Logger.getLogger();
                logger.log(Log.DEBUG, "ReceiveTransitionsIntentService - onHandleIntent");
                Intent broadcastIntent = new Intent(GeofenceTransitionIntent);
        Severity: Minor
        Found in src/android/ReceiveTransitionsIntentService.java - 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 executeQuery has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                func executeQuery(sqlStr: String, withArgs: [AnyObject]? = nil) -> (result: [SDRow], error: Int?) {
        
                    var resultSet = [SDRow]()
        
                    var sql = sqlStr
        Severity: Major
        Found in src/ios/SwiftData.swift - About 2 hrs to fix

          Function bind has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              func bind(objects: [AnyObject], toSQL sql: String) -> (string: String, error: Int?) {
          
                  var newSql = ""
                  var bindIndex = 0
                  var i = false
          Severity: Minor
          Found in src/ios/SwiftData.swift - 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 savepoint has a Cognitive Complexity of 19 (exceeds 5 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 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

          SwiftData has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public struct SwiftData {
          
          
              // MARK: - Public SwiftData Functions
          
          
          Severity: Minor
          Found in src/ios/SwiftData.swift - About 2 hrs to fix

            Function transaction has a Cognitive Complexity of 16 (exceeds 5 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 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 coerceProperties has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function coerceProperties(geofence) {
                if (geofence.id) {
                    geofence.id = geofence.id.toString();
                } else {
                    throw new Error("Geofence id is not provided");
            Severity: Major
            Found in www/geofence.js - About 2 hrs to fix

              Function checkRequirements has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              func checkRequirements() -> (Bool, [String], [[String:String]]) {
                  var errors = [[String:String]]()
                  var warnings = [String]()
                  
                  if (!CLLocationManager.isMonitoringAvailableForClass(CLRegion)) {
              Severity: Minor
              Found in src/ios/GeofencePlugin.swift - About 1 hr to fix

                Function executeMultipleChanges has a Cognitive Complexity of 14 (exceeds 5 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

                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 onHandleIntent has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    protected void onHandleIntent(Intent intent) {
                        Logger logger = Logger.getLogger();
                        logger.log(Log.DEBUG, "ReceiveTransitionsIntentService - onHandleIntent");
                        Intent broadcastIntent = new Intent(GeofenceTransitionIntent);
                Severity: Minor
                Found in src/android/ReceiveTransitionsIntentService.java - About 1 hr to fix

                  Function escapeValue has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      func escapeValue(obj: AnyObject?) -> String {
                  
                          if let obj: AnyObject = obj {
                  
                              if obj is String {
                  Severity: Minor
                  Found in src/ios/SwiftData.swift - About 1 hr to fix

                    Function bind has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        func bind(objects: [AnyObject], toSQL sql: String) -> (string: String, error: Int?) {
                    
                            var newSql = ""
                            var bindIndex = 0
                            var i = false
                    Severity: Minor
                    Found in src/ios/SwiftData.swift - About 1 hr to fix

                      Function getColumnValue has 39 lines of code (exceeds 25 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
                        Severity
                        Category
                        Status
                        Source
                        Language