Playhi/FreezeYou

View on GitHub
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt

Summary

Maintainability
F
6 days
Test Coverage

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

            } else {
                generateHashMap(
                    getApplication<Application>().getString(R.string.ACBSNotEnabled),
                    getApplication<Application>().getString(R.string.affect) + " " + getApplication<Application>().getString(
                        R.string.avoidFreezeForegroundApplications
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 143..154

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

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 (isAccessibilitySettingsOn(getApplication())) {
                generateHashMap(
                    getApplication<Application>().getString(R.string.ACBSNotEnabled),
                    getApplication<Application>().getString(R.string.affect) + " " + getApplication<Application>().getString(
                        R.string.avoidFreezeForegroundApplications
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 154..165

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

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

                ) {
                    generateHashMap(
                        getApplication<Application>().getString(R.string.noNotificationListenerPermission),
                        getApplication<Application>().getString(R.string.affect) + " " + getApplication<Application>().getString(
                            R.string.avoidFreezeNotifyingApplications
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 187..196

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

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 {
                    generateHashMap(
                        getApplication<Application>().getString(R.string.noNotificationListenerPermission),
                        getApplication<Application>().getString(R.string.affect) + " " + getApplication<Application>().getString(
                            R.string.avoidFreezeNotifyingApplications
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 178..187

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

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

        ) {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.bluetoothPermissionIsNotGranted),
                    getApplication<Application>().getString(R.string.mayCannotUseScheduledTaskToEnableOrDisableBluetooth),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 120..129
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 204..213
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 226..235
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 248..257
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 286..295
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 311..320
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 335..344
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 421..430

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

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

        } else {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.noMRootPermission),
                    getApplication<Application>().getString(R.string.someFuncMayRestrict),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 129..138
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 213..222
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 257..266
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 295..304
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 320..329
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 344..353
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 372..381

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

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

        } else {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.noIgnoringBO),
                    getApplication<Application>().getString(R.string.someFuncMayBeAff),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 129..138
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 213..222
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 235..244
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 257..266
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 295..304
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 344..353
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 372..381

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

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

        } else {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.noNotifyPermission),
                    getApplication<Application>().getString(R.string.mayCannotNotify),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 129..138
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 235..244
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 257..266
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 295..304
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 320..329
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 344..353
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 372..381

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

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

        } else {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.notUpdatedForALongTime),
                    getApplication<Application>().getString(R.string.someNewFuncMayPub),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 129..138
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 213..222
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 235..244
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 295..304
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 320..329
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 344..353
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 372..381

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

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

        if (isDeviceOwner(getApplication())) {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.noMRootPermission),
                    getApplication<Application>().getString(R.string.someFuncMayRestrict),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 120..129
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 204..213
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 248..257
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 286..295
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 311..320
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 335..344
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 363..372
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 421..430

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

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

        } else {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.inPowerSaveMode),
                    getApplication<Application>().getString(R.string.someFuncMayBeAff),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 129..138
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 213..222
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 235..244
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 257..266
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 295..304
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 320..329
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 372..381

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

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

        if (Build.VERSION.SDK_INT >= 24 && !notificationManager.areNotificationsEnabled()) {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.noNotifyPermission),
                    getApplication<Application>().getString(R.string.mayCannotNotify),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 120..129
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 226..235
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 248..257
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 286..295
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 311..320
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 335..344
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 363..372
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 421..430

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

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

        ) {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.inPowerSaveMode),
                    getApplication<Application>().getString(R.string.someFuncMayBeAff),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 120..129
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 204..213
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 226..235
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 248..257
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 286..295
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 311..320
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 363..372
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 421..430

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

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

        ) {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.noIgnoringBO),
                    getApplication<Application>().getString(R.string.someFuncMayBeAff),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 120..129
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 204..213
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 226..235
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 248..257
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 286..295
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 335..344
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 363..372
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 421..430

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

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

        } else {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.sysVerLow),
                    getApplication<Application>().getString(R.string.someFuncUn),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 213..222
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 235..244
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 257..266
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 295..304
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 320..329
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 344..353
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 372..381

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

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

        } else {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.noRootPermission),
                    getApplication<Application>().getString(R.string.someFuncMayRestrict),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 129..138
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 213..222
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 235..244
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 257..266
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 320..329
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 344..353
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 372..381

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

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

        if (!hasPermission || value != 0) {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.noRootPermission),
                    getApplication<Application>().getString(R.string.someFuncMayRestrict),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 120..129
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 204..213
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 226..235
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 248..257
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 311..320
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 335..344
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 363..372
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 421..430

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

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

        if (isOutdated(getApplication<Application>())) {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.notUpdatedForALongTime),
                    getApplication<Application>().getString(R.string.someNewFuncMayPub),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 120..129
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 204..213
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 226..235
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 286..295
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 311..320
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 335..344
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 363..372
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 421..430

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

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

        } else {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.bluetoothPermissionIsNotGranted),
                    getApplication<Application>().getString(R.string.mayCannotUseScheduledTaskToEnableOrDisableBluetooth),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 129..138
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 213..222
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 235..244
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 257..266
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 295..304
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 320..329
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 344..353

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

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

        if (Build.VERSION.SDK_INT < 21) {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.sysVerLow),
                    getApplication<Application>().getString(R.string.someFuncUn),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 204..213
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 226..235
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 248..257
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 286..295
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 311..320
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 335..344
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 363..372
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 421..430

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

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

        if (problemsList.value!!.isEmpty()) {
            problemsList.value!!.add(
                generateHashMap(
                    getApplication<Application>().getString(R.string.noProblemsFound),
                    getApplication<Application>().getString(R.string.everySeemsAllRight),
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 120..129
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 204..213
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 226..235
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 248..257
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 286..295
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 311..320
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 335..344
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 363..372

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

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

                    val i = (t0["level"] as Int).compareTo(
                        (t1["level"] as Int)
                    )
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 94..94

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

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 (i == 0) (t0["id"] as String).compareTo((t1["id"] as String)) else i
app/src/main/java/cf/playhi/freezeyou/viewmodel/AutoDiagnosisViewModel.kt on lines 91..93

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

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