coding-blocks/CBOnlineApp

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

Summary

Maintainability
C
1 day
Test Coverage

Method onViewCreated has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        setUpBottomSheet()

        courseTypeTv.apply {

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

        private val itemClickListener: ItemClickListener by lazy {
            object : ItemClickListener {
    
                override fun onClick(id: String, runId: String, runAttemptId: String, name: String) {
                    startActivity(
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/library/DashboardLibraryFragment.kt on lines 29..41

    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 166.

    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 26 locations. Consider refactoring.
    Open

        override fun onCreateView(
            inflater: LayoutInflater,
            container: ViewGroup?,
            savedInstanceState: Bundle?
        ): View? = inflater.inflate(R.layout.fragment_dashboard_my_courses, container, false)
    app/src/main/java/com/codingblocks/cbonlineapp/auth/LoginHomeFragment.kt on lines 29..33
    app/src/main/java/com/codingblocks/cbonlineapp/auth/LoginOtpFragment.kt on lines 27..31
    app/src/main/java/com/codingblocks/cbonlineapp/auth/SignInFragment.kt on lines 18..22
    app/src/main/java/com/codingblocks/cbonlineapp/auth/SignUpFragment.kt on lines 20..24
    app/src/main/java/com/codingblocks/cbonlineapp/auth/SocialLoginFragment.kt on lines 21..25
    app/src/main/java/com/codingblocks/cbonlineapp/course/batches/RunFragment.kt on lines 27..31
    app/src/main/java/com/codingblocks/cbonlineapp/course/checkout/CheckoutFailedFragment.kt on lines 17..21
    app/src/main/java/com/codingblocks/cbonlineapp/course/checkout/CheckoutOrderDetailsFragment.kt on lines 24..25
    app/src/main/java/com/codingblocks/cbonlineapp/course/checkout/CheckoutPaymentFragment.kt on lines 24..25
    app/src/main/java/com/codingblocks/cbonlineapp/course/checkout/CheckoutPersonalDetailsFragment.kt on lines 23..27
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/doubts/DashboardDoubtsFragment.kt on lines 89..94
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/explore/DashboardExploreFragment.kt on lines 109..110
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/home/DashboardHomeFragment.kt on lines 87..91
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/library/DashboardLibraryFragment.kt on lines 43..47
    app/src/main/java/com/codingblocks/cbonlineapp/library/LibraryHomeFragment.kt on lines 18..23
    app/src/main/java/com/codingblocks/cbonlineapp/library/LibraryViewFragment.kt on lines 98..102
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/CourseContentFragment.kt on lines 104..105
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/player/doubts/VideoDoubtFragment.kt on lines 65..66
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/player/notes/VideoNotesFragment.kt on lines 68..69
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/quiz/AboutQuizFragment.kt on lines 23..27
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/quiz/QuizFragment.kt on lines 42..46
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/quiz/QuizResultFragment.kt on lines 33..38
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/quiz/info/QuizInfoFragment.kt on lines 18..23
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/quiz/submissions/QuizSubmissionsFragment.kt on lines 38..42
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/library/CourseLibraryFragment.kt on lines 23..28

    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 97.

    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

                setCompoundDrawablesRelativeWithIntrinsicBounds(
                    requireContext().getDrawable(imgs.getResourceId(lastSelected, 0)),
                    null,
                    requireContext().getDrawable(R.drawable.ic_dropdown),
                    null
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/mycourses/DashboardMyCoursesFragment.kt on lines 90..98

    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 94.

    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

                    setCompoundDrawablesRelativeWithIntrinsicBounds(
                        requireContext().getDrawable(
                            imgs.getResourceId(
                                num,
                                0
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/mycourses/DashboardMyCoursesFragment.kt on lines 74..79

    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 94.

    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

                vm.courses.distinctUntilChanged().observer(thisLifecycleOwner) {
                    courseListAdapter.submitList(it)
                    changeViewState(
                        dashboardCoursesRv,
                        emptyLl,
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/library/DashboardLibraryFragment.kt on lines 53..56

    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 75.

    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 3 locations. Consider refactoring.
    Open

            loginBtn.setOnClickListener {
                startActivity(intentFor<LoginActivity>())
                requireActivity().finish()
            }
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/doubts/DashboardDoubtsFragment.kt on lines 215..218
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/home/DashboardHomeFragment.kt on lines 107..110

    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 60.

    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