Showing 10 of 85 total issues
Method ReadingStateControl
has a Cognitive Complexity of 89 (exceeds 20 allowed). Consider refactoring. Confirmed
/**
* On the book details page of a work, allow a user to set if they :
* - are interested in reading the book
* - are currently reading the book
* - have finished reading the book
- 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 NavGraph
has a Cognitive Complexity of 75 (exceeds 20 allowed). Consider refactoring. Confirmed
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun NavGraph(navController: NavHostController) {
Scaffold(
bottomBar = { BottomToolbar(navController) }
- 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
Class LibraryDao
has 54 methods (exceeds 20 allowed). Consider refactoring. Confirmed
/**
* Library local DAO.
*/
@Dao
interface LibraryDao {
Method NavGraph
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun NavGraph(navController: NavHostController) {
Scaffold(
bottomBar = { BottomToolbar(navController) }
Method ReadingStateControl
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
/**
* On the book details page of a work, allow a user to set if they :
* - are interested in reading the book
* - are currently reading the book
* - have finished reading the book
Method getContacts
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* Find all contacts of the user, and map them to either a phone number or an email
* "Copy-pasted" from https://stackoverflow.com/questions/12562151/android-get-all-contacts
*/
@SuppressLint("Range")
Method insert
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Confirmed
/**
* Inserts the given [Work] in the database.
*
* It includes inserting the corresponding [WorkEntity], all its [Cover]s and `Subject`s
* and – if [recursive] – all its authors and editions.
- 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 toModel
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
override fun toModel(libraryApi: LibraryApi): Author? {
val id = extractIdFromKey(key, "/authors/")
if (id == null || error != null)
return null
Method insert
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Confirmed
/**
* Inserts the given [Edition] in the database.
*
* It includes inserting the corresponding [EditionEntity], all its [Cover]s
* and – if [recursive] – all its authors and works.
- 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
Avoid deeply nested control flow statements. Open
while (pCur.moveToNext()) {
val phoneNo: String = pCur.getString(
pCur.getColumnIndex(
ContactsContract.CommonDataKinds.Phone.NUMBER
)