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
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
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");
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();
- 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 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")
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)
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);
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)
- 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 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 {
- 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 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())
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
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");
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")
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
Avoid deeply nested control flow statements. Open
switch sqlite3_column_type(pStmt, i) {
case 1:
columnType = "INTEGER"
case 2:
columnType = "FLOAT"
Avoid deeply nested control flow statements. Open
if let columnValue: AnyObject = getColumnValue(pStmt, index: i, type: columnType) {
row[columnName] = SDColumn(obj: columnValue)
}
Avoid deeply nested control flow statements. Open
if let columnValue: AnyObject = getColumnValue(pStmt, index: i, type: columnType) {
row[columnName] = SDColumn(obj: columnValue)
}
Function execPromise
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function execPromise(success, error, pluginName, method, args) {
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
- 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 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")
- 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"