coding-blocks/CBOnlineApp

View on GitHub
app/src/main/java/com/codingblocks/cbonlineapp/dashboard/DashboardActivity.kt

Summary

Maintainability
D
1 day
Test Coverage

File DashboardActivity.kt has 296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.codingblocks.cbonlineapp.dashboard

import android.annotation.TargetApi
import android.content.Context
import android.content.Intent

    Method showReportDialog has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private fun showReportDialog() {
            val dialog = AlertDialog.Builder(this).create()
            val view = layoutInflater.inflate(R.layout.report_dialog, null)
            view.primaryBtn.setOnClickListener {
    
    

      Method changeToolbar has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private fun changeToolbar(title: String, pos: Int) {
              dashboardPager.setCurrentItem(pos, true)
              supportActionBar?.title = title
              if (pos == 0 || pos == 2)
                  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {

        Method initializeUI has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private fun initializeUI(loggedIn: Boolean) {
                searchBtn.setOnClickListener {
                    startActivity(intentFor<LearningTracksActivity>().singleTop())
                }
                pagerAdapter.apply {

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                      dashboardToolbar.colouriseToolbar(this@DashboardActivity, R.drawable.toolbar_bg, getColor(R.color.black))
                  } else {
                      dashboardToolbar.colouriseToolbar(this@DashboardActivity, R.drawable.toolbar_bg, ContextCompat.getColor(this, R.color.black))
                  }
          app/src/main/java/com/codingblocks/cbonlineapp/dashboard/DashboardActivity.kt on lines 345..349

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 191.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                          dashboardToolbar.colouriseToolbar(this@DashboardActivity, R.drawable.toolbar_bg_dark, getColor(R.color.white))
                      } else {
                          dashboardToolbar.colouriseToolbar(this@DashboardActivity, R.drawable.toolbar_bg_dark, ContextCompat.getColor(this, R.color.white))
                      }
          app/src/main/java/com/codingblocks/cbonlineapp/dashboard/DashboardActivity.kt on lines 350..354

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 191.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  dialog.apply {
                      window?.setBackgroundDrawableResource(android.R.color.transparent)
                      setView(view)
                      setCancelable(true)
                      show()
          app/src/main/java/com/codingblocks/cbonlineapp/campaign/CampaignActivity.kt on lines 112..117
          app/src/main/java/com/codingblocks/cbonlineapp/campaign/HomeFragment.kt on lines 130..135
          app/src/main/java/com/codingblocks/cbonlineapp/course/checkout/CheckoutPaymentFragment.kt on lines 129..134

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 81.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                      } else if (view.mobile.editText?.text.isNullOrEmpty() && view.mobile.editText?.text?.length!! < 10) {
          app/src/main/java/com/codingblocks/cbonlineapp/util/extensions/ViewExtensions.kt on lines 457..457

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 72.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              override fun onCreateOptionsMenu(menu: Menu): Boolean {
                  menuInflater.inflate(R.menu.dashboard, menu)
                  return true
              }
          app/src/main/java/com/codingblocks/cbonlineapp/course/CourseActivity.kt on lines 327..330
          app/src/main/java/com/codingblocks/cbonlineapp/notifications/NotificationsActivity.kt on lines 111..114

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 67.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status