Showing 45 of 117 total issues
Method onCreate
has a Cognitive Complexity of 116 (exceeds 20 allowed). Consider refactoring. Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityEditProfileBinding.inflate(layoutInflater)
setContentView(binding.root)
setSupportActionBar(binding.topBar)
- 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 onViewCreated
has a Cognitive Complexity of 82 (exceeds 20 allowed). Consider refactoring. Open
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.topBar.setupWithNavController(findNavController())
- 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
File ImageCarousel.kt
has 478 lines of code (exceeds 250 allowed). Consider refactoring. Open
package org.pixeldroid.app.postCreation.carousel
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
Method bind
has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring. Open
fun bind(post: Status, lifecycleScope: LifecycleCoroutineScope, api: PixelfedAPI,
addCollection: Boolean = false, collection: Collection? = null, deleteFromCollection: Boolean = false
) {
if ((post.media_attachments?.size ?: 0) == 0){
- 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 nodeInfoSchema
has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring. Open
private suspend fun nodeInfoSchema(
normalizedDomain: String,
clientId: String,
nodeInfoSchemaUrl: String
) = coroutineScope {
- 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 onViewCreated
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.topBar.setupWithNavController(findNavController())
File ProfileFeedFragment.kt
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
package org.pixeldroid.app.profile
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
Class Converters
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Converters {
private val gson = Gson()
private val formatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME
private val instantFormatter = DateTimeFormatter.ISO_INSTANT
Method onCreate
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityEditProfileBinding.inflate(layoutInflater)
setContentView(binding.root)
setSupportActionBar(binding.topBar)
Method bind
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun bind(post: Status, lifecycleScope: LifecycleCoroutineScope, api: PixelfedAPI,
addCollection: Boolean = false, collection: Collection? = null, deleteFromCollection: Boolean = false
) {
if ((post.media_attachments?.size ?: 0) == 0){
File LoginActivity.kt
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
package org.pixeldroid.app
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
Method onCreate
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding = ActivityAlbumBinding.inflate(layoutInflater)
setContentView(binding.root)
Method initAttributes
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun initAttributes() {
context.theme.obtainStyledAttributes(
attributeSet,
R.styleable.ImageCarousel,
0,
Method onBindViewHolder
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
val post = if(collections && user?.user_id == accountId && position == 0) null else getItem(if(collections && user?.user_id == accountId) position - 1 else position)
post?.let {
if(collections) {
- 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 initListeners
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
private fun initListeners() {
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
val position = currentPosition
- 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 initListeners
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun initListeners() {
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
val position = currentPosition
Method onCreateDialog
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val list: MutableList<String> = mutableListOf()
// IDE doesn't find it, but compiling works apparently?
resources.getXml(R.xml._generated_res_locale_config).use {
var eventType = it.eventType
- 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 onCreate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMediaviewerBinding.inflate(layoutInflater)
setContentView(binding.root)
Method onOptionsItemSelected
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.delete_collection -> {
MaterialAlertDialogBuilder(this).apply {
setMessage(R.string.delete_collection_warning)
Method onCreate
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding = ActivityAlbumBinding.inflate(layoutInflater)
setContentView(binding.root)
- 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"