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
File GeofencePlugin.swift
has 436 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Foundation
import AudioToolbox
import WebKit
let TAG = "GeofencePlugin"
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
- Read upRead up
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");
- Read upRead up
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 {
- Read upRead up
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
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)) {
- Read upRead up
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);
- Read upRead up
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
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
- Read upRead up
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
- Read upRead up
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
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
- Read upRead up
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");
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)) {
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
- Read upRead up
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);
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 {
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
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 {