OrkestApp/sdp_2023

View on GitHub

Showing 50 of 109 total issues

Method EditPostScreen has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
@Composable
fun EditPostScreen(viewModel: PostViewModel, activity: ComponentActivity) {

    //Create editable fields for the post
Severity: Minor
Found in app/src/main/java/com/github/orkest/ui/feed/CreatePost.kt - About 1 hr to fix

    Method CapturedMedia has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
    Open

    @OptIn(ExperimentalCoilApi::class)
    @Composable
    fun CapturedMedia(
        capturedUri: Uri?,
        isVideo: Boolean
    Severity: Minor
    Found in app/src/main/java/com/github/orkest/ui/feed/CreatePost.kt - About 1 hr to fix

    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 a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
    Open

        /**
         * This override of the onCreate method is used to get the text from the intent
         * The text corresponds to a spotify song URL that is used to get the song ID and
         * song name.
         *
    Severity: Minor
    Found in app/src/main/java/com/github/orkest/ui/sharing/SharingActivity.kt - About 1 hr to fix

    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 StyledOrkest has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            @Composable
            fun StyledOrkest() {
                Box(modifier = Modifier.fillMaxWidth(),
                    contentAlignment = Alignment.Center) {
                    Row() {
    Severity: Minor
    Found in app/src/main/java/com/github/orkest/ui/search/SearchUserView.kt - About 1 hr to fix

      Method spotifyAuthorization has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          /**
           * This function is used to connect to the Spotify API and get the song name
           *
           */
          private fun spotifyAuthorization(){
      Severity: Minor
      Found in app/src/main/java/com/github/orkest/ui/sharing/SharingActivity.kt - About 1 hr to fix

        Method FollowList has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        @Composable
        fun FollowList(activity: ComponentActivity, viewModel: FollowListViewModel){
            Column {
                Row(
                    Modifier
        Severity: Minor
        Found in app/src/main/java/com/github/orkest/ui/FollowListActivity.kt - About 1 hr to fix

          Method CreateProfilePreview has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          @Composable
          fun CreateProfilePreview(user: String, intent: Intent? = null){
              val context = LocalContext.current
              Row(modifier = Modifier
                  .padding(all = paddingValue)
          Severity: Minor
          Found in app/src/main/java/com/github/orkest/ui/FollowListActivity.kt - About 1 hr to fix

            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()
            
            
            Severity: Minor
            Found in app/src/main/java/com/github/orkest/data/SpotifyMultimedia.kt - About 1 hr to fix

              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
                   */
              Severity: Minor
              Found in app/src/main/java/com/github/orkest/ui/profile/ProfileViewModel.kt - About 1 hr to fix

                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()
                Severity: Minor
                Found in app/src/main/java/com/github/orkest/data/SpotifyMultimedia.kt - About 1 hr to fix

                  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("")) }
                  Severity: Minor
                  Found in app/src/main/java/com/github/orkest/ui/sharing/SharingActivity.kt - About 1 hr to fix

                    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> {
                    Severity: Minor
                    Found in app/src/main/java/com/github/orkest/ui/profile/ProfileViewModel.kt - About 1 hr to fix

                      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
                      Severity: Minor
                      Found in app/src/main/java/com/github/orkest/domain/FireStoreDatabaseAPI.kt - About 1 hr to fix

                        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.
                        Severity: Minor
                        Found in app/src/main/java/com/github/orkest/ui/sharing/sharedMusicPost.kt - About 1 hr to fix

                          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" +
                          Severity: Minor
                          Found in app/src/main/java/com/github/orkest/domain/DeezerMockAPi.kt - About 1 hr to fix

                            Method CapturedMedia has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            @OptIn(ExperimentalCoilApi::class)
                            @Composable
                            fun CapturedMedia(
                                capturedUri: Uri?,
                                isVideo: Boolean
                            Severity: Minor
                            Found in app/src/main/java/com/github/orkest/ui/feed/CreatePost.kt - About 1 hr to fix

                              Method discoverDevices has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  override fun discoverDevices(
                                      context: Context,
                                      receiver: BroadcastReceiver,
                                      requestBluetooth: ActivityResultLauncher<Intent>
                                  ) {

                                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() {
                                  Severity: Minor
                                  Found in app/src/main/java/com/github/orkest/ui/notification/Notification.kt - About 1 hr to fix

                                    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
                                    Severity: Minor
                                    Found in app/src/main/java/com/github/orkest/ui/feed/CreatePost.kt - About 1 hr to fix

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language