coding-blocks/CBOnlineApp

View on GitHub

Showing 246 of 862 total issues

Method insertContents has a Cognitive Complexity of 156 (exceeds 20 allowed). Consider refactoring.
Open

    private suspend fun insertContents(
        contentList: List<LectureContent>,
        attemptId: String,
        sectionId: String,
        name: String?

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 149 (exceeds 20 allowed). Consider refactoring.
Open

    fun bind(item: Course, type: String) = with(itemView) {
        courseLogo.loadImage(item.logo)
        ViewCompat.setTransitionName(courseLogo, item.title)
        val ratingText = getSpannableSring("${item.rating}/5.0", ", ${item.reviewCount} ratings")
        ratingTv.text = ratingText

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

    private fun fetchQuestion(viewModel: QuizViewModel, pos: Int, view: View) {
        if (pos == questionList.size() - 1 && result == null) {
            view.submitButton.visibility = View.VISIBLE
        }
        CBOnlineLib.onlineV2JsonApi.getQuestionById(

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 VideoPlayerActivity.kt has 811 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.codingblocks.cbonlineapp.mycourse.content.player

import android.animation.LayoutTransition
import android.annotation.TargetApi
import android.app.ActivityManager

    Method makeForm has a Cognitive Complexity of 97 (exceeds 20 allowed). Consider refactoring.
    Open

        private fun makeForm(formData: MutableLiveData<ArrayList<Form>>) {
    
            val params = LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT

    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 APIModel.kt has 677 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package com.codingblocks.onlineapi.models
    
    import com.fasterxml.jackson.annotation.JsonProperty
    import com.github.jasminb.jsonapi.Links
    import com.github.jasminb.jsonapi.RelType

      Method setupUI has a Cognitive Complexity of 91 (exceeds 20 allowed). Consider refactoring.
      Open

          private fun setupUI() {
      
              vm.offlineSnackbar.observer(this) {
                  rootLayout.showSnackbar(it, Snackbar.LENGTH_SHORT, action = false)
              }

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

          private fun attachObservers() {
      
              viewModel.progress.observer(thisLifecycleOwner) {
                  swiperefresh.isRefreshing = it
              }

      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 75 (exceeds 20 allowed). Consider refactoring.
      Open

          override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
              super.onViewCreated(view, savedInstanceState)
              courseLeaderboardRv.setRv(requireContext(), leaderBoardListAdapter)
              viewModel.run?.distinctUntilChanged()?.observer(thisLifecycleOwner) { courseAndRun ->
                  if (courseAndRun.runAttempt.paused) {

      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

      Class OnlineJsonApi has 61 methods (exceeds 20 allowed). Consider refactoring.
      Open

      interface OnlineJsonApi {
      
          @GET("courses/{id}")
          suspend fun getCourse(
              @Path("id") id: String

        File VdoPlayerControls.kt has 505 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package com.codingblocks.cbonlineapp.util.widgets
        
        import android.content.Context
        import android.os.Handler
        import android.os.HandlerThread

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

              override fun onCreate(savedInstanceState: Bundle?) {
                  super.onCreate(savedInstanceState)
                  setContentView(R.layout.activity_complete_profile)
                  val id = JWTUtils.getIdentity(sharedPrefs.SP_JWT_TOKEN_KEY)
                  courseResumeBtn.setOnClickListener {

          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 ViewExtensions.kt has 493 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          package com.codingblocks.cbonlineapp.util.extensions
          
          import android.animation.Animator
          import android.animation.AnimatorListenerAdapter
          import android.content.Context

            Class VideoPlayerActivity has 53 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class VideoPlayerActivity :
                BaseCBActivity(),
                EditNoteClickListener,
                AnkoLogger,
                VdoPlayer.InitializationListener,

              Method onActivityCreated has a Cognitive Complexity of 61 (exceeds 20 allowed). Consider refactoring.
              Open

                  override fun onActivityCreated(savedInstanceState: Bundle?) {
                      super.onActivityCreated(savedInstanceState)
                      sectionItemsAdapter.starter = this
                      sectionItemsAdapter.onItemClick = {
                          when (it) {

              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 60 (exceeds 20 allowed). Consider refactoring.
              Open

                  override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
                      super.onViewCreated(view, savedInstanceState)
                      setUpBottomSheet()
                      typeTv.text = vm.type
                      when (vm.type) {

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

                  private suspend fun insertContents(
                      contentList: List<LectureContent>,
                      attemptId: String,
                      sectionId: String,
                      name: String?

                Method onViewCreated has a Cognitive Complexity of 56 (exceeds 20 allowed). Consider refactoring.
                Open

                    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
                        super.onViewCreated(view, savedInstanceState)
                        vm.getCart()
                
                        useBalance.setOnClickListener {

                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 56 (exceeds 20 allowed). Consider refactoring.
                Open

                    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
                        super.onViewCreated(view, savedInstanceState)
                
                        pauseCancelBtn.setOnClickListener {
                            dismiss()

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

                    private fun setupUI() {
                
                        vm.offlineSnackbar.observer(this) {
                            rootLayout.showSnackbar(it, Snackbar.LENGTH_SHORT, action = false)
                        }
                  Severity
                  Category
                  Status
                  Source
                  Language