Showing 82 of 168 total issues
Method computeOffsets
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
x: List<Long>,
xBottom: Long,
xTop: Long,
y: List<Long>,
yBottom: Long,
Method TeamProgressScreenContent
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
onBack: () -> Unit,
onLeaderboard: () -> Unit,
onChat: () -> Unit,
onClaim: (Challenge) -> Unit,
Method ClaimCard
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Composable
fun ClaimCard(
retrieveUser: (String) -> StateFlow<User?>,
claim: Claim,
fnViewImageCallback: (String) -> Unit
Method TeamCreator
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Composable
fun TeamCreator(createTeam: (String) -> Unit, disabled: Boolean) {
val name = remember { mutableStateOf("") }
Surface(elevation = 4.dp) {
Method createChallenge
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
/**
* Creates a challenge with the given photo, location and options.
*
* The challenge will be created on behalf of the currently logged in user. If there are none,
* throws a [UserNotLoggedInException].
Method onCreate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
GeoHuntTheme {
Method FlatLongButton
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
/**
* Implements a Drawer button. A button with full width, as in a table.
*
* Mainly inspired by https://github.com/SmartToolFactory/Jetpack-Compose-Tutorials/blob/master/Tutorial1-1Basics/src/main/java/com/smarttoolfactory/tutorial1_1basics/ui/components/DrawerButton.kt
*
Method TeamsSelector
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
teams: List<Team>?,
users: Map<String, List<User>>,
join: (Team) -> Unit,
leaveTeam: () -> Unit,
disabled: Boolean,
Method LabelledIcon
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
text: String,
painter: Painter,
contentDescription: String,
modifier: Modifier = Modifier,
fontSize: TextUnit = TextUnit.Unspecified,
Method ActiveBountiesList
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
/**
* Represents a List of bounties, bounties are displayed in a LazyRow and user can scroll through them
* @param bounties The bounties to display
* @param openExploreTab the callback that should be called by the button on the empty screen (No bounties)
* @param openBountyView the callback that should be called when the user clicks on a bounty
Method ProfileEditPage
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
Open
@Composable
fun ProfileEditPage(onBackButton: () -> Unit, vm: ProfileEditPageViewModel = viewModel(factory = ProfileEditPageViewModel.Factory)) {
// Getting user
val user by vm.user.collectAsState()
val eu by vm.editedUser.collectAsState()
- 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 CreateNewChallenge
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Composable
fun CreateNewChallenge(
onFailure: (Throwable) -> Unit = {},
onSuccess: (Challenge) -> Unit = {},
viewModel: CreateChallengeViewModel = viewModel(factory = CreateChallengeViewModel.Factory)
Method ActiveHuntsList
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
/**
* Creates a scrollable list of active hunts using the given list.
*
* If the list is empty, uses the [EmptyScreen] as fallback.
*
Method onCreate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Check that the user is not already logged in
if (viewModel.isLoggedIn()) {
Method ProfileEditPage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Composable
fun ProfileEditPage(onBackButton: () -> Unit, vm: ProfileEditPageViewModel = viewModel(factory = ProfileEditPageViewModel.Factory)) {
// Getting user
val user by vm.user.collectAsState()
val eu by vm.editedUser.collectAsState()
Method HomeScreen
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomeScreen(
onUserClick: (User) -> Unit,
onOpenMap: (Challenge) -> Unit,
Method HomeBountyCard
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
author: Flow<User?>,
onUserClick: (User) -> Unit,
name: String,
expiresIn: LocalDateTime,
challengesFlows: Flow<List<Challenge>?>,
Method RadioItem
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
title: String,
value: T,
isSelected: Boolean,
onSelect: (T) -> Unit,
modifier: Modifier = Modifier,
Method HomeScreen
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
onUserClick: (User) -> Unit,
onOpenMap: (Challenge) -> Unit,
onOpenChallenge: (Challenge) -> Unit,
onClaim: (Challenge) -> Unit,
onOpenExplore: () -> Unit,
Method TeamSelector
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
name: String,
users: List<User>? = listOf(),
onAction: () -> Unit = {},
disabled: Boolean = false,
isUserInside: Boolean = false,