Showing 43 of 254 total issues
Method EditProfileForm
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Composable
fun EditProfileForm(
firstName: MutableState<String>,
lastName: MutableState<String>,
userName: MutableState<String>,
Method onBlockedClicked
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
override fun onBlockedClicked() {
when (currentListing) {
is ApiResponse.Success -> {
val listing = (currentListing as ApiResponse.Success<Listing>).data
viewModelScope.launch {
- 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 setupSearchBar
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
private fun setupSearchBar() {
// Initialize the Places SDK
if (!Places.isInitialized()) {
Places.initialize(applicationContext, MAPS_API_KEY)
- 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 invoke
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* Retrieves all listings matching the given [keyword] from the [repository]
*
* @param [keyword] the value to compare to the listings
* @param [minPrice] the minimum Price in order to retrieve listings
Method ListingForm
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
chosen: SnapshotStateList<Category>,
title: MutableState<String>,
description: MutableState<String>,
price: MutableState<String>,
meetingPoint: MutableState<MeetingPoint?>,
Method Details
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
onMeetingPointClick: () -> Unit,
listing: Listing,
onContactSellerClick: () -> Unit,
isFavorite: Boolean,
isBlocked: Boolean,
Consider simplifying this complex logical expression. Open
} else if (listing != null
&& chosenCategories.isNotEmpty()
&& (blockedUsers[listing.seller.id] != true)
&& (listing.name.contains(keyword, true)
|| listing.description.contains(keyword, true)
Method placeBid
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
/**
* Upates the bid for a bidding type listing
*
* @param bidderId the id of the user placing the bid
* @param bid the new bid to replace old price of the listing
- 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 ProfileBlockedScreen
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Composable
fun ProfileBlockedScreen(
viewModel: ProfileViewModel = hiltViewModel()
) {
val blocked = viewModel.blockedUsers.collectAsState(initial = emptyList())
Method setupMap
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun setupMap() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED
) {
googleMap.isMyLocationEnabled = true
Method BiddingControls
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* This renders the controls for the detailed listing screen only if it's of bidding type so the user
* can bid on those.
* @param price mutablestate of string to be used for the price bid field
* @param onSubmit the submit handler
Method createListing
has 9 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
title: String,
description: String,
categories: List<Category>,
price: Float,
meetingPoint: MeetingPoint?,
Method saveDraft
has 9 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
title: String,
description: String,
categories: List<Category>,
price: Float,
meetingPoint: MeetingPoint?,
Method handleSubmitRating
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
viewModel: IUserRatingViewModel,
targetUserId: String,
currentUser: State<ApiResponse<User>>,
thumbUp: Boolean,
ratingText: String,
Method RatingDialog
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
showDialog: Boolean,
setShowDialog: () -> Unit,
onSubmit: (Boolean, String) -> Unit,
thumbUp: Boolean,
setThumbUp: (Boolean) -> Unit,
Method CategoryChoice
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* This is the category picker part. There is a modal drawer that works as a category picker and
* the chosen categories are displayed in "Chip" composables. They can be clicked off to be
* removed from the chosen list
* @param chosen the list state of chosen categories
Method searchLocation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun searchLocation(locationName: String) {
idlingResourceSearchLocation.increment()
launch {
try {
withTimeout(5000) { // Set a 5-second timeout for the Geocoder request
Method ListingCard
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ListingCard(listing: Listing, onClick: () -> Unit) {
Card(
onClick = onClick,
- 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
Consider simplifying this complex logical expression. Open
if (listing != null
&& chosenCategories.isEmpty()
&& (blockedUsers[listing.seller.id] != true)
&& (listing.name.contains(keyword, true)
|| listing.description.contains(keyword, true))
Method getListingsBySearch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
keyword: String,
minPrice: String,
maxPrice: String,
chosenCategories: List<Category>,
blockedUsers: Map<String, Boolean>