OrkestApp/sdp_2023

View on GitHub

Showing 50 of 109 total issues

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) {
Severity: Minor
Found in app/src/main/java/com/github/orkest/ui/authentication/SignIn.kt - About 1 day 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 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
Severity: Minor
Found in app/src/main/java/com/github/orkest/ui/NavigationBar.kt - About 6 hrs 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 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
Severity: Minor
Found in app/src/main/java/com/github/orkest/ui/profile/ProfileTopInterface.kt - About 6 hrs 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 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" +
Severity: Major
Found in app/src/main/java/com/github/orkest/domain/DeezerMockAPi.kt - About 6 hrs to fix

    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
    Severity: Minor
    Found in app/src/main/java/com/github/orkest/ui/DeezerWelcomeActivity.kt - About 4 hrs 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 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()
    Severity: Minor
    Found in app/src/main/java/com/github/orkest/bluetooth/ui/BluetoothActivity.kt - About 4 hrs 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

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

      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) {
      Severity: Major
      Found in app/src/main/java/com/github/orkest/ui/authentication/SignIn.kt - About 3 hrs to fix

        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
        Severity: Major
        Found in app/src/main/java/com/github/orkest/ui/search/SearchUserView.kt - About 3 hrs to fix

          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
          Severity: Minor
          Found in app/src/main/java/com/github/orkest/ui/feed/CreatePost.kt - About 3 hrs 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 createUI has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Composable
              fun createUI(bluetoothServiceManager: BluetoothInterface) {
                  val recompose by rememberUpdatedState(update)
          
                  //bluetoothServiceManager.acceptConnections()
          Severity: Major
          Found in app/src/main/java/com/github/orkest/bluetooth/ui/BluetoothActivity.kt - About 3 hrs to fix

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

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

                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
                Severity: Major
                Found in app/src/main/java/com/github/orkest/ui/NavigationBar.kt - About 2 hrs to fix

                  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

                    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

                      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
                        Severity
                        Category
                        Status
                        Source
                        Language