cowbell/cordova-plugin-geofence

View on GitHub

Showing 112 of 112 total issues

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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                                      if let columnValue: AnyObject = getColumnValue(pStmt, index: i, type: columnType) {
                                          row[columnName] = SDColumn(obj: columnValue)
                                      }
          Severity: Minor
          Found in src/ios/SwiftData.swift and 1 other location - About 35 mins to fix
          src/ios/SwiftData.swift on lines 1451..1453

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

          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

          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 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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                                      if let columnValue: AnyObject = getColumnValue(pStmt, index: i, type: columnType) {
                                          row[columnName] = SDColumn(obj: columnValue)
                                      }
          Severity: Minor
          Found in src/ios/SwiftData.swift and 1 other location - About 35 mins to fix
          src/ios/SwiftData.swift on lines 1432..1434

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

          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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          //
          // SwiftData.swift
          //
          // Copyright (c) 2014 Ryan Fowler
          //
          Severity: Minor
          Found in src/ios/SwiftData.swift and 1 other location - About 35 mins to fix
          src/ios/SwiftData.swift on lines 1..2152

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 43.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                      dispatch_async(dispatch_get_main_queue()) {
                          let pluginResult = CDVPluginResult(status: CDVCommandStatus_OK)
                          self.commandDelegate!.sendPluginResult(pluginResult, callbackId: command.callbackId)
                      }
          Severity: Minor
          Found in src/ios/GeofencePlugin.swift and 1 other location - About 30 mins to fix
          src/ios/GeofencePlugin.swift on lines 206..209

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 41.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                      dispatch_async(dispatch_get_main_queue()) {
                          let pluginResult = CDVPluginResult(status: CDVCommandStatus_OK)
                          self.commandDelegate!.sendPluginResult(pluginResult, callbackId: command.callbackId)
                      }
          Severity: Minor
          Found in src/ios/GeofencePlugin.swift and 1 other location - About 30 mins to fix
          src/ios/GeofencePlugin.swift on lines 216..219

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 41.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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 "'\(escapeStringValue(imageID))'"
            Severity: Major
            Found in src/ios/SwiftData.swift - About 30 mins to fix

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                      if (geofence.notification.smallIcon) {
                          geofence.notification.smallIcon = geofence.notification.smallIcon.toString();
                      }
              Severity: Minor
              Found in www/geofence.js and 2 other locations - About 30 mins to fix
              www/geofence.js on lines 189..191
              www/geofence.js on lines 193..195

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              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 nil
                Severity: Major
                Found in src/ios/SwiftData.swift - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language