coding-blocks/CBOnlineApp

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

Summary

Maintainability
D
1 day
Test Coverage

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

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

        doubtEmptyBtn.setOnClickListener { requireActivity().dashboardBottomNav.selectedItemId = R.id.dashboard_home }

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

        override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
            super.onViewCreated(view, savedInstanceState)
            setUpBottomSheet()
    
            doubtEmptyBtn.setOnClickListener { requireActivity().dashboardBottomNav.selectedItemId = R.id.dashboard_home }

    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

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

            vm.type.observer(thisLifecycleOwner) {
                when (it) {
                    LIVE -> {
                        liveDoubtBtn.isActivated = true
                        resolvedDoubtBtn.isActivated = false
    app/src/main/java/com/codingblocks/cbonlineapp/jobs/JobsActivity.kt on lines 102..125

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

    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

        private val chatClickListener: ChatClickListener by lazy {
            object : ChatClickListener {
                override fun onClick(convId: String, doubtId: String) {
                    requireContext().startActivity(
                        requireContext().intentFor<ChatActivity>(
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/player/doubts/VideoDoubtFragment.kt on lines 53..63

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

    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

        private val commentsClickListener: DoubtCommentClickListener by lazy {
            object : DoubtCommentClickListener {
                override fun onClick(doubtId: String) {
                    requireContext().startActivity(
                        requireContext().intentFor<DoubtCommentActivity>(
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/player/doubts/VideoDoubtFragment.kt on lines 41..51

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

    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? =
    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/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/dashboard/mycourses/DashboardMyCoursesFragment.kt on lines 55..59
    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 3 locations. Consider refactoring.
    Open

        override fun onDestroyView() {
            doubtListAdapter.apply {
                onResolveClick = null
                onCommentClick = null
                onChatClick = null
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/player/doubts/VideoDoubtFragment.kt on lines 90..97
    app/src/main/java/com/codingblocks/cbonlineapp/mycourse/content/player/notes/VideoNotesFragment.kt on lines 92..99

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

    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 (doubt.status == RESOLVED) {
                        requireContext().showDialog(RESOLVED, cancelable = true) {
                            vm.type.value = RESOLVED
                        }
                    } else {
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/doubts/DashboardDoubtsFragment.kt on lines 55..59

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

    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

                    } else {
                        requireContext().showDialog(REOPENED, cancelable = true) {
                            vm.type.value = LIVE
                        }
                    }
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/doubts/DashboardDoubtsFragment.kt on lines 51..55

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

    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/home/DashboardHomeFragment.kt on lines 107..110
    app/src/main/java/com/codingblocks/cbonlineapp/dashboard/mycourses/DashboardMyCoursesFragment.kt on lines 148..151

    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