Showing 7 of 7 total issues
Method playMove
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
/**
* Executes a given move, throwing an exception if the move is illegal. Returns the number of
* stones captured by the move.
*
* @param m move to play
- 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 toCommand
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
/**
* Command deserialization helper function.
*/
fun toCommand(s: String): GTPCommand {
val decomposed = s.split(" ")
- 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 onCreate
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val gameSizeInput = intent.getIntExtra(EXTRA_GAME_SIZE, 9)
val komi = intent.getDoubleExtra(EXTRA_KOMI, 5.5)
Avoid deeply nested control flow statements. Open
for (enemy in enemyGroup) {
board[enemy] = Stone.EMPTY
capturedStones.add(enemy)
}
Method sendMessage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
fun sendMessage(senderId: String, chatId: String, messageText: String, onSuccess: () -> Unit, onFailure: (Exception) -> Unit) {
Method findMatch
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
fun findMatch(ranked: Boolean, onFind: (String, Stone) -> Unit, onFail: () -> Unit) {
val user = Authentication.getCurrentUser()
this.onFind = onFind
if (user != null) {
val ratingPath = "/matchmaking/users/${user.uid}/rating"
- 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 onReceive
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
@RequiresApi(Build.VERSION_CODES.N)
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
BluetoothDevice.ACTION_FOUND -> {
- 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"