Showing 29 of 166 total issues
Method prepare
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
protected boolean prepare() {
if (mBlurRadius == 0) {
release();
return 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
Method onTouchEvent
has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring. Open
override fun onTouchEvent(event: MotionEvent): Boolean {
when (event.action) {
ACTION_DOWN -> {
// Four angles' area.
fourAngles.forEach searching@{
- 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 scaleBitmap
has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring. Open
private fun scaleBitmap(data: ByteArray) {
BitmapFactory.decodeByteArray(data, 0, data.size).also { bmp ->
selectedRectF.apply {
// Round the x, y, width, and height for avoiding the range is over than bitmap size.
var roundWidth = (x + w).let { if (it > bmp.width) bmp.width - x else w }
- 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
File RealtimeBlurView.java
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (C) 2018 The Smash Ks Open Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Method prepare
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected boolean prepare() {
if (mBlurRadius == 0) {
release();
return false;
}
Method onDraw
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onDraw(canvas: Canvas) {
canvas.apply {
// Create a new canvas for doing interaction layer.
saveLayer(wholeRectangle, null).apply {
// All background rectangle (DST layer).
Method showSelectionDialog
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
//region Showing From ViewModel
private fun showSelectionDialog(bitmap: Bitmap) {
selectionDialog = QuickDialogFragment.Builder(this) {
var debouncing = 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
Method onTouchEvent
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onTouchEvent(event: MotionEvent): Boolean {
when (event.action) {
ACTION_DOWN -> {
// Four angles' area.
fourAngles.forEach searching@{
File SelectableAreaView.kt
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (C) 2018 The Smash Ks Open Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Method recognizeImage
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun recognizeImage(bitmap: Bitmap): List<Recognition> {
// Log this method so that it can be analyzed with systrace.
Trace.beginSection("recognizeImage")
Trace.beginSection("preprocessBitmap")
// Preprocess the image data from 0-255 int to normalized float based
Method showSelectionDialog
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
//region Showing From ViewModel
private fun showSelectionDialog(bitmap: Bitmap) {
selectionDialog = QuickDialogFragment.Builder(this) {
var debouncing = false
Method onPreDraw
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public boolean onPreDraw() {
int[] locations = new int[2];
Bitmap oldBmp = mBlurredBitmap;
View decor = mDecorView;
Method rendered
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
//region Base Fragment
override fun rendered(savedInstanceState: Bundle?) {
cv_camera.apply {
setLifecycleOwner(this@TakeAPicFragment)
clearCameraListeners()
Method create
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
/**
* Initializes a native TensorFlow session for classifying images.
*
* @param assetManager The asset manager to be used to load assets.
* @param modelFilename The filepath of the model GraphDef protocol buffer.
- 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 onLayoutChange
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
v: View,
left: Int,
top: Int,
right: Int,
bottom: Int,
Method loadCoderOptions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Throws(IOException::class)
private fun loadCoderOptions(assetManager: AssetManager, locationFilename: String, boxPriors: Array<FloatArray>) {
// Try to be intelligent about opening from assets or sdcard depending on prefix.
val assetPrefix = "file:///android_asset/"
val `is` = if (locationFilename.startsWith(assetPrefix)) {
Method setEventListeners
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun setEventListeners() {
ib_check.onClick {
if (isUploaded) {
showToast(getString(R.string.toast_has_uploaded))
}
Method addCircularRevealAnimation
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun View.addCircularRevealAnimation(
revealSettings: RevealAnimationSetting,
startColor: Int,
endColor: Int
) {
Method onPreDraw
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean onPreDraw() {
int[] locations = new int[2];
Bitmap oldBmp = mBlurredBitmap;
View decor = mDecorView;
- 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 peelResponseOptions
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
/**
* Check the [KsResponse]'s changing and do the corresponding reaction. Here're three data
* type [Loading], [Success], and [Error].
*
* - [Loading] state will show the loading view.
- 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"