cowbell/cordova-plugin-geofence

View on GitHub

Showing 78 of 112 total issues

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

    public static func executeWithConnection(flags: SD.Flags, closure: ()->Void) -> Int? {

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

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

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

    func createIndex(name: String, columns: [String], table: String, unique: Bool) -> Int? {

        if columns.count < 1 {
            print("SwiftData Error -> During: Creating Index")
            print("                -> Code: 401 - At least one column name must be provided")
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

Method startTone has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public void startTone(String name) {
        int tone = 0;
        int duration = 1000;

        if (name.equals("beep")) {
Severity: Minor
Found in src/android/BeepHelper.java - 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 locationManager has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    func locationManager(manager: CLLocationManager, monitoringDidFailForRegion region: CLRegion?, withError error: NSError) {
        log("Monitoring region \(region!.identifier) failed. Reson: \(error.description)")
        if let clRegion = region as? CLCircularRegion {
            if let command = self.addOrUpdateCallbacks[clRegion] {
                var errors = [[String:String]]()
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

Avoid too many return statements within this function.
Open

            return nil
Severity: Major
Found in src/ios/SwiftData.swift - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return Double(sqlite3_column_double(statement, index))
    Severity: Major
    Found in src/ios/SwiftData.swift - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                          return dateFormatter.dateFromString(string)
      Severity: Major
      Found in src/ios/SwiftData.swift - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return "X'\(newStr)'"
        Severity: Major
        Found in src/ios/SwiftData.swift - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return nil
          Severity: Major
          Found in src/ios/SwiftData.swift - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                return "'\(escapeStringValue(imageID))'"
            Severity: Major
            Found in src/ios/SwiftData.swift - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return Uri.EMPTY;
              Severity: Major
              Found in src/android/AssetUtil.java - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return "NULL"
                Severity: Major
                Found in src/ios/SwiftData.swift - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return nil
                  Severity: Major
                  Found in src/ios/SwiftData.swift - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return sqlite3_column_int(statement, index) != 0
                    Severity: Major
                    Found in src/ios/SwiftData.swift - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return "NULL"
                      Severity: Major
                      Found in src/ios/SwiftData.swift - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return "\(escapeValue(dateFormatter.stringFromDate(obj as! NSDate)))"
                        Severity: Major
                        Found in src/ios/SwiftData.swift - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return nil
                          Severity: Major
                          Found in src/ios/SwiftData.swift - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return "NULL"
                            Severity: Major
                            Found in src/ios/SwiftData.swift - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return Int(status)
                              Severity: Major
                              Found in src/ios/SwiftData.swift - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                    return nil
                                Severity: Major
                                Found in src/ios/SwiftData.swift - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language