OrkestApp/sdp_2023

View on GitHub

Showing 109 of 109 total issues

Method onCreate has 56 lines of code (exceeds 25 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: Major
Found in app/src/main/java/com/github/orkest/ui/sharing/SharingActivity.kt - About 2 hrs to fix

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

                        currentUserRef.update(
                            "profile.nbFollowings",
                            user.profile.nbFollowings,
                            "followings",
                            user.followings
    app/src/main/java/com/github/orkest/ui/profile/ProfileViewModel.kt on lines 131..141

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

    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

                        userRef.update(
                            "profile.nbFollowers",
                            user.profile.nbFollowers,
                            "followers",
                            user.followers
    app/src/main/java/com/github/orkest/ui/profile/ProfileViewModel.kt on lines 175..184

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

    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

    Method updatePostLikesInDatabase has a Cognitive Complexity of 30 (exceeds 20 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

    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 WelcomeOperation has 47 lines of code (exceeds 25 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
    Severity: Minor
    Found in app/src/main/java/com/github/orkest/ui/DeezerWelcomeActivity.kt - About 1 hr to fix

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

                      Text(
                          modifier = Modifier
                              .align(Alignment.CenterHorizontally)
                              .padding(start = 20.dp),
                          text = "Follow Nearby Users",
      app/src/main/java/com/github/orkest/bluetooth/ui/BluetoothActivity.kt on lines 216..223

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

      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

                      Text(
                          modifier = Modifier
                              .align(Alignment.CenterHorizontally)
                              .padding(start = 20.dp),
                          text = "Click on a user to follow them",
      app/src/main/java/com/github/orkest/bluetooth/ui/BluetoothActivity.kt on lines 204..211

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

      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

          /**
           * This class is used to deserialize tracks from the Deezer API
           */
          @Serializable
          data class Artist(val id:String, val name:String, val link:String, val picture:String,
      app/src/main/java/com/github/orkest/domain/DeezerModelClasses.kt on lines 27..33

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

      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

          /**
           * This class is used to deserialize tracks from the Deezer API
           */
          @Serializable
          data class Album(val id: String , val title:String, val cover :String, val cover_small:String,
      app/src/main/java/com/github/orkest/domain/DeezerModelClasses.kt on lines 19..25

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

      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

      Method Playlist has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      /*
          * This is a Composable that fetches the songs from the database and displays them.
       */
      @Composable
      fun Playlist(playlistViewModel: PlaylistViewModel,
      Severity: Minor
      Found in app/src/main/java/com/github/orkest/ui/sharing/PlaylistActivity.kt - About 1 hr to fix

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

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

                      usersPosts.get().addOnSuccessListener{
                          // Get all posts documents as a list of posts objects
                          val list: MutableList<Post> =  it.toObjects(Post::class.java)
              
                          future.complete(list)
              app/src/main/java/com/github/orkest/domain/FireStoreDatabaseAPI.kt on lines 304..312

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

              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

                      usersPosts.get().addOnSuccessListener{
                          // Get all posts documents as a list of posts objects
                          val list: MutableList<Comment> =  it.toObjects(Comment::class.java)
              
                          future.complete(list)
              app/src/main/java/com/github/orkest/domain/FireStoreDatabaseAPI.kt on lines 283..291

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

              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

              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

                  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) {
                  app/src/main/java/com/github/orkest/ui/PermissionConstants.kt on lines 34..44

                  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

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language