H-PixelDroid/PixelDroid

View on GitHub

Showing 57 of 148 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)
Severity: Minor
Found in app/src/main/java/org/pixeldroid/app/profile/EditProfileActivity.kt - About 2 days to fix

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())

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 onCreate has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
    Open

        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            binding = ActivityLoginBinding.inflate(layoutInflater)
            setContentView(binding.root)
    
    
    Severity: Minor
    Found in app/src/main/java/org/pixeldroid/app/login/LoginActivity.kt - About 5 hrs to fix

    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 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){
    Severity: Minor
    Found in app/src/main/java/org/pixeldroid/app/profile/ProfileFeedFragment.kt - About 5 hrs to fix

    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())
    
    

      Class Converters has 30 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
      Severity: Minor
      Found in app/src/main/java/org/pixeldroid/app/utils/db/Converters.kt - About 3 hrs to fix

        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
        Severity: Minor
        Found in app/src/main/java/org/pixeldroid/app/profile/ProfileFeedFragment.kt - About 3 hrs to fix

          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)
          Severity: Major
          Found in app/src/main/java/org/pixeldroid/app/profile/EditProfileActivity.kt - About 3 hrs to fix

            Method onCreate has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
            Open

                override fun onCreate(savedInstanceState: Bundle?) {
                    super.onCreate(savedInstanceState)
            
                    binding = ActivityPostCreationBinding.inflate(layoutInflater)
                    setContentView(binding.root)

            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 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                override fun onCreate(savedInstanceState: Bundle?) {
                    super.onCreate(savedInstanceState)
            
                    binding = ActivityPostCreationBinding.inflate(layoutInflater)
                    setContentView(binding.root)

              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){
              Severity: Major
              Found in app/src/main/java/org/pixeldroid/app/profile/ProfileFeedFragment.kt - About 3 hrs to fix

                Method onCreate has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    override fun onCreate(savedInstanceState: Bundle?) {
                        super.onCreate(savedInstanceState)
                        binding = ActivityLoginBinding.inflate(layoutInflater)
                        setContentView(binding.root)
                
                
                Severity: Major
                Found in app/src/main/java/org/pixeldroid/app/login/LoginActivity.kt - About 2 hrs to fix

                  Method showTutorial has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private fun showTutorial(dialog: Dialog){
                          lifecycleScope.launch {
                              var handle = binding.tabs.findViewHolderForLayoutPosition(0)?.itemView?.findViewById<ImageView>(R.id.dragHandle)
                              while (handle == null) {
                                  handle = binding.tabs.findViewHolderForLayoutPosition(0)?.itemView?.findViewById(R.id.dragHandle)
                  Severity: Major
                  Found in app/src/main/java/org/pixeldroid/app/settings/ArrangeTabsFragment.kt - About 2 hrs to fix

                    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 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)
                      Severity: Major
                      Found in app/src/main/java/org/pixeldroid/app/posts/AlbumActivity.kt - About 2 hrs to fix

                        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) {
                        Severity: Minor
                        Found in app/src/main/java/org/pixeldroid/app/profile/ProfileFeedFragment.kt - About 2 hrs to fix

                        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
                        
                        

                        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 onBindViewHolder has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                @SuppressLint("ClickableViewAccessibility")
                                override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
                                    val textView: MaterialButton = holder.itemView.findViewById(R.id.textView)
                                    val checkBox: MaterialCheckBox = holder.itemView.findViewById(R.id.checkBox)
                                    val dragHandle: ImageView = holder.itemView.findViewById(R.id.dragHandle)
                        Severity: Minor
                        Found in app/src/main/java/org/pixeldroid/app/settings/ArrangeTabsFragment.kt - About 2 hrs to fix

                          Method createEdgeEffect has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              override fun createEdgeEffect(recyclerView: RecyclerView, direction: Int): EdgeEffect {
                          
                                  return object : EdgeEffect(recyclerView.context) {
                          
                                      // A reference to the [SpringAnimation] for this RecyclerView used to bring the item back after the over-scroll effect.
                            Severity
                            Category
                            Status
                            Source
                            Language