Showing 109 of 109 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
/**
* Requests the CAMERA permission.
* This method shows the permission request dialogs.
*/
fun askCameraPermission(activity: Activity) {
- Read upRead up
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 121.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
Image(painter = painterResource(R.drawable.copyright),
contentDescription = "Copyright",
modifier = Modifier
.size(10.dp)
.align(Alignment.End)
- Read upRead up
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 117.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
Image(
painter = painterResource(R.drawable.logo), // Replace with your image resource
contentDescription = "Orkest Logo",
modifier = Modifier
.size(200.dp)
- Read upRead up
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 117.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method getArtistImage
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
// This function is used to get the artist image
fun getArtistImage(artistId: String, accessToken: String, testResponse: Response?): CompletableFuture<String> {
val future = CompletableFuture<String>()
val client = OkHttpClient()
Method updateUserFollowers
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* toFollow: Boolean = states whether we should add the current user or retrieve it from the user's followers' list
* Update the followers' list of the visited profile
* The multiple future.complete allow to reduce the complexity of the function and make sure to handle all the errors
*/
Method getAlbumCoverImageUrl
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
// This function is used to get the album cover image
fun getAlbumCoverImageUrl(albumId: String, accessToken: String, testResponse: Response?): CompletableFuture<String> {
val future = CompletableFuture<String>()
val client = OkHttpClient()
Method UserSelection
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Composable
fun UserSelection(){
val viewModel = SearchViewModel()
var text by remember { mutableStateOf("search User") }
var list by remember { mutableStateOf(mutableListOf("")) }
Method updateCurrentUserFollowings
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* toFollow: Boolean = states whether we should add the visited user or retrieve it from the current user's followings' list
* Update the followings' list of the current logged in user
*/
open fun updateCurrentUserFollowings(toFollow: Boolean): CompletableFuture<Boolean> {
Method updatePostLikesInDatabase
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* This function updates the nbLikes and likeList of the given post depending on whether the user wants to like or dislike the post
* The user is always CURRENT_LOGGED_USER because he/she is the only one who can react to a post when logged in
* @param post: the post to which we want to like or dislike the content
* @param like: boolean that indicates if the user wants to like or dislike the post
Method sharedMusicPost
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* This function creates the UI for post when a user shared a music with the current logged in user
* profile: Profile = the profile of the user that shared the song. Used the class Profile to get access to the username and the profile picture ID.
* song: Song = song that was shared from the service provider.
* message: String = the user has the possibility to add a customizable message.
Method fetchTheUserId
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun fetchTheUserId(access_token: String): String {
return "{\n" +
" \"id\": \"2297625024\",\n" +
" \"name\": \"Zermelo-101\",\n" +
" \"lastname\": \"Rocher\",\n" +
Method CapturedMedia
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
@OptIn(ExperimentalCoilApi::class)
@Composable
fun CapturedMedia(
capturedUri: Uri?,
isVideo: Boolean
Method discoverDevices
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun discoverDevices(
context: Context,
receiver: BroadcastReceiver,
requestBluetooth: ActivityResultLauncher<Intent>
) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (user != null) {
username.value = user.username
bio.value = user.profile.bio
nbFollowers.value = user.profile.nbFollowers
nbFollowings.value = user.profile.nbFollowings
- Read upRead up
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 102.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
future.thenAccept {
username.value = it.username
bio.value = it.profile.bio
nbFollowers.value = it.profile.nbFollowers
nbFollowings.value = it.profile.nbFollowings
- Read upRead up
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 102.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method onReceiveHandle
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun onReceiveHandle(intent: Intent, bluetoothServiceManager: BluetoothInterface? = this.bluetoothServiceManager) {
intent.action?.let { Log.d("BluetoothActivity", it) }
when(intent.action) {
BluetoothDevice.ACTION_FOUND -> {
Method promptUserToEnableNotifications
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* Build the notification manager to enable notifications
* The choice will be saved in the phone's parameters
*/
fun promptUserToEnableNotifications() {
Method EditPostScreen
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
@Composable
fun EditPostScreen(viewModel: PostViewModel, activity: ComponentActivity) {
//Create editable fields for the post
- Read upRead up
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 FollowList
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
@Composable
fun FollowList(activity: ComponentActivity, viewModel: FollowListViewModel){
Column {
Row(
Modifier
- Read upRead up
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 onCreate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.d("HELLO TEST","HELLO")
var deezerApi = DeezerApiIntegration(deezerApiImplemented())
var codeValue: String? =""