Showing 36 of 36 total issues
Method onCreate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val bottomBar: BottomNavigationView = findViewById(R.id.mainNavigationView)
Method setupStartHoursButton
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
/**
* Setup the start hour button
* @param view the view of the fragment
*/
private fun setupStartHoursButton(view: View) {
Method setupEndHoursButton
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
/**
* Setup the end hour button
* @param view the view of the fragment
*/
private fun setupEndHoursButton(view: View) {
Method setUpShare
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private fun setUpShare(trashCategorySelector: Spinner) {
val shareBtn = view?.findViewById<ImageView>(R.id.send_post)
shareBtn?.setOnClickListener {
if (!sendingPost) {
Method setupDateButton
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
/**
* Setup the date button and the date picker
* @param view the view of the fragment
*/
private fun setupDateButton(view: View) {
Method handleBottomMenuItemClicked
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
/**
* Helper function to perform the correct action given that a menu item from
* the bottom menu has been pressed.
*
* @param item The menu item that has been pressed
Method setupDrawerUserInfo
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
/**
* Helper function to setup the user info, description and profile picture in the drawer menu
*
* @param imageView The view that contains the image in the drawer
* @param usernameTW The view that contains the username in the drawer
- 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
Open
return true
Avoid too many return
statements within this method. Open
Open
if (startHour.value == null) return false
Avoid too many return
statements within this method. Open
Open
if (startMinute.value == null) return false
Avoid too many return
statements within this method. Open
Open
return true
Avoid too many return
statements within this method. Open
Open
if (radius.value == null) return false
Avoid too many return
statements within this method. Open
Open
if (endMinute.value == null) return false
Avoid too many return
statements within this method. Open
Open
if (longLat.longitude!! < -180 || longLat.longitude!! > 180) return false
Avoid too many return
statements within this method. Open
Open
if (endHour.value == null) return false
Method addHourListener
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
Open
/**
* Add a listener to the hour edit text
* @param text the edit text to setup
* @param hour the hour state flow
* @param minute the minute state flow
- 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"