Showing 109 of 109 total issues
Similar blocks of code found in 2 locations. 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()
- 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 665.
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
// 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()
- 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 665.
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 SignIn
has a Cognitive Complexity of 68 (exceeds 20 allowed). Consider refactoring. Open
/**
* The function that launches the call to firebase and the google api to sign in
*/
@Composable
fun SignIn (navController: NavController, viewModel: AuthViewModel) {
- 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 ProfileTopInterface
has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring. Open
/**
* The top interface of the user's profile displaying the user's information
* username, bio, number of followers, number of followings, profile picture
*/
@Composable
- 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 CreateNavigationBar
has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring. Open
@SuppressLint("UnrememberedMutableState")
@Composable
fun CreateNavigationBar(navController: NavHostController, currentUser: String, activity: MainActivity) {
val context = LocalContext.current
- 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 searchAsong
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun searchAsong(songName: String, artistName: String): String {
Log.d("ENTER MOCK", songName)
return "{\n" +
" \"data\": [\n" +
" {\n" +
Method WelcomeOperation
has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring. Open
/**
* 1) Stores the access token along with the userName
* 2) Fetch the user Id using the Deezer API
* 3) Create a orkest Playlist then waits for the playlist ID
* 4) Stores the playlist id back into the database
- 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 createUI
has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring. Open
@Composable
fun createUI(bluetoothServiceManager: BluetoothInterface) {
val recompose by rememberUpdatedState(update)
//bluetoothServiceManager.acceptConnections()
- 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
File FireStoreDatabaseAPI.kt
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.github.orkest.domain
import android.content.ContentValues
import android.content.ContentValues.TAG
import android.content.Context
Method SignIn
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* The function that launches the call to firebase and the google api to sign in
*/
@Composable
fun SignIn (navController: NavController, viewModel: AuthViewModel) {
Method SearchUi
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* @param viewModel use to communicate with the Backend
*
*This method display the search bar, and support the drawing of the future users that will
* be find in the database
Method onCreate
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
OrkestTheme {
// A surface container using the 'background' color from the theme
- 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 createUI
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Composable
fun createUI(bluetoothServiceManager: BluetoothInterface) {
val recompose by rememberUpdatedState(update)
//bluetoothServiceManager.acceptConnections()
Method updateUserFollowers
has a Cognitive Complexity of 35 (exceeds 20 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
*/
- 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 updateCurrentUserFollowings
has a Cognitive Complexity of 35 (exceeds 20 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> {
- 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 ProfileTopInterface
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* The top interface of the user's profile displaying the user's information
* username, bio, number of followers, number of followings, profile picture
*/
@Composable
Class FireStoreDatabaseAPI
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
open class FireStoreDatabaseAPI {
companion object{
val db = Firebase.firestore
fun isOnline(context: Context): Boolean {
Method CreateNavigationBar
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressLint("UnrememberedMutableState")
@Composable
fun CreateNavigationBar(navController: NavHostController, currentUser: String, activity: MainActivity) {
val context = LocalContext.current
Similar blocks of code found in 2 locations. Consider refactoring. Open
// Define a type converter for the Song class
class SongConverter {
@TypeConverter
fun fromSong(song: Song?): String? {
val gson = Gson()
- 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 173.
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
// Define a type converter for the OrkestDate class
class OrkestDateConverter {
@TypeConverter
fun fromOrkestDate(date: OrkestDate?): String? {
val gson = Gson()
- 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 173.
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