Showing 20 of 43 total issues
Method FriendsScreen
has a Cognitive Complexity of 67 (exceeds 10 allowed). Consider refactoring. Open
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FriendsScreen(friendsViewModel: FriendsViewModel) {
fun showFailureToast(context: Context, message: String) {
Toast.makeText(context, "Failure: $message", Toast.LENGTH_SHORT)
- 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 MapsScreen
has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring. Open
@Composable
fun MapsScreen(
mapViewModel: MapViewModel,
onDistractionClick: (Distraction) -> Unit,
onEventClick: (Event) -> Unit
- 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 FriendsScreen
has 127 lines of code (exceeds 50 allowed). Consider refactoring. Open
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FriendsScreen(friendsViewModel: FriendsViewModel) {
fun showFailureToast(context: Context, message: String) {
Toast.makeText(context, "Failure: $message", Toast.LENGTH_SHORT)
Method ListedDistraction
has a Cognitive Complexity of 31 (exceeds 10 allowed). Consider refactoring. Open
/**
* Screens that represents how one distraction is displayed in the list of distraction
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
- 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 RegisterScreen
has a Cognitive Complexity of 26 (exceeds 10 allowed). Consider refactoring. Open
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun RegisterScreen(
onSuccess: () -> Unit,
registerViewModel: RegisterViewModel
- 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 observeHistory
has a Cognitive Complexity of 26 (exceeds 10 allowed). Consider refactoring. Open
override fun observeHistory(userId: String, onHistoryChange: (List<Event>) -> Unit) {
if(currentHistoryListener.isPresent) eventParticipantsDatabaseRef.removeEventListener(currentHistoryListener.get())
currentHistoryListener = Optional.of(eventParticipantsDatabaseRef.addValueEventListener(object: ValueEventListener {
override fun onDataChange(snapshot: DataSnapshot) {
- 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 DistractionListScreen
has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring. Open
/**
* Screens that represent a list of scrollable distraction that we can then filter
*/
@Composable
fun DistractionListScreen(
- 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 ListedEvent
has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring. Open
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ListedEvent(
event: Event,
countPeople: Int,
- 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 RegisterScreen
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun RegisterScreen(
onSuccess: () -> Unit,
registerViewModel: RegisterViewModel
Method LoginScreen
has 80 lines of code (exceeds 50 allowed). Consider refactoring. Open
/**
* Author: Bluedrack and AdrienBouquet
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
Method ListedEvent
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ListedEvent(
event: Event,
countPeople: Int,
Method onDataChange
has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring. Open
override fun onDataChange(snapshot: DataSnapshot) {
participationsCache.clear()
snapshot.children.forEach {eventParticipantsRaw ->
val eventParticipants = eventParticipantsRaw.value as Map<String, Boolean>
Log.d("evhi", eventParticipants.toString())
- 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 ListedDistraction
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
/**
* Screens that represents how one distraction is displayed in the list of distraction
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
Method observeHistory
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
override fun observeHistory(userId: String, onHistoryChange: (List<Event>) -> Unit) {
Log.d("DEBUG", "IS CALLED")
service.observeHistory(userId){
if(OnlineStatus().isOnline(connectivityManager)){
val h = it.map{it.toEventEntity()}
- 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 observeClaims
has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring. Open
private fun observeClaims(userId: String) {
if(currentUserClaimsListener.isPresent) userClaimsDatabaseRef.removeEventListener(currentUserClaimsListener.get())
currentUserClaimsListener = Optional.of(userClaimsDatabaseRef.addValueEventListener(object: ValueEventListener {
override fun onDataChange(snapshot: DataSnapshot) {
- 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 refreshModel
has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring. Open
fun refreshModel(){
_distractionStatModel.fetchDistractionFeedback(_uiState.value.did).continueWith{
t-> _uiState.update { it.copy(feedbacks = t.result) }
}
_distractionStatModel.fetchDistractionTags(_uiState.value.did).continueWith { t ->
- 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 too many return
statements within this method. Open
return _createUserModel.createUser(UserData(
firstname = uiState.value.firstname,
lastname = uiState.value.lastname,
phone = uiState.value.phoneNumber,
birthday = timestamp,
Method onCheckboxClicked
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
fun onCheckboxClicked(
distractionIndex: Int,
newState: Boolean
) {
_uiState.update {
- 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 postDislike
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
override fun postDislike(did: String) : Task<Void>{
val uid = auth.uid ?: return Tasks.forException(Exception("Not login"))
return db.getReference(pathLikes).child(did).child(uid).get().continueWithTask{
j ->
if(j.isSuccessful && j.result.value == uid){
- 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 postLike
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
override fun postLike(did: String) : Task<Void> {
val uid = auth.uid ?: return Tasks.forException(Exception("Not login"))
return db.getReference(pathDislikes).child(did).child(uid).get().continueWithTask{
j ->
if(j.isSuccessful && j.result.value == uid){
- 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"