meili-epfl/Meili

View on GitHub

Showing 36 of 52 total issues

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

private fun initViews() {
listPostsView = findViewById(R.id.list_posts)
createPostButton = findViewById(R.id.create_post)
 
editPostView = findViewById(R.id.edit_post)
app/src/main/java/com/github/epfl/meili/profile/ProfileActivity.kt on lines 110..121

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

private fun initializeButtons() {
profileEditButton = findViewById(R.id.profile_edit_button)
saveButton = findViewById(R.id.save)
cancelButton = findViewById(R.id.cancel)
seeFriendsButton = findViewById(R.id.list_friends_button)
app/src/main/java/com/github/epfl/meili/posts/forum/ForumActivity.kt on lines 100..113

Class PhotoEditActivity has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

/**
* An activity which is launched after a photo has been taken by the camera activity. It lets the user edit the photo by drawing, adding filters, etc.
*/
class PhotoEditActivity : AppCompatActivity() {
private lateinit var binding: ActivityPhotoEditBinding
Severity: Minor
Found in app/src/main/java/com/github/epfl/meili/photo/PhotoEditActivity.kt - About 3 hrs to fix

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

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder =
    CommentViewHolder(
    LayoutInflater.from(parent.context).inflate(R.layout.comment, parent, false),
    listener
    )
    app/src/main/java/com/github/epfl/meili/posts/PostListRecyclerAdapter.kt on lines 30..34
    app/src/main/java/com/github/epfl/meili/profile/friends/FriendsListRecyclerAdapter.kt on lines 18..22
    app/src/main/java/com/github/epfl/meili/review/ReviewsRecyclerAdapter.kt on lines 17..18

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

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder =
    FriendViewHolder(
    LayoutInflater.from(parent.context).inflate(R.layout.friend, parent, false),
    clickListener
    )
    app/src/main/java/com/github/epfl/meili/posts/CommentsRecyclerAdapter.kt on lines 19..23
    app/src/main/java/com/github/epfl/meili/posts/PostListRecyclerAdapter.kt on lines 30..34
    app/src/main/java/com/github/epfl/meili/review/ReviewsRecyclerAdapter.kt on lines 17..18

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

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) =
    (holder as ReviewViewHolder).bind(items[position].second.second, items[position].second.first)
    app/src/main/java/com/github/epfl/meili/posts/CommentsRecyclerAdapter.kt on lines 25..29

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

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) =
    (holder as CommentViewHolder).bind(
    items[position].second.second,
    items[position].second.first
    )
    app/src/main/java/com/github/epfl/meili/review/ReviewsRecyclerAdapter.kt on lines 20..21

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

    Auth.isLoggedIn.observe(this) { loggedIn ->
    val isWriteEnabled = WritingPolicy.isWriteEnabled(loggedIn, poiStatus)
    floatingActionButton.isEnabled = isWriteEnabled
    floatingActionButton.isVisible = isWriteEnabled
    }
    app/src/main/java/com/github/epfl/meili/posts/forum/ForumActivity.kt on lines 178..182

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

    Auth.isLoggedIn.observe(this) { loggedIn ->
    val isWriteEnabled = WritingPolicy.isWriteEnabled(loggedIn, poiStatus)
    createPostButton.isEnabled = isWriteEnabled
    createPostButton.isVisible = isWriteEnabled
    }
    app/src/main/java/com/github/epfl/meili/review/ReviewsActivity.kt on lines 190..194

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

    fun orderList(list: List<Pair<String, Pair<T, User>>>): List<Pair<String, Pair<T, User>>>
    Severity: Major
    Found in app/src/main/java/com/github/epfl/meili/util/ListSorter.kt and 2 other locations - About 40 mins to fix
    app/src/main/java/com/github/epfl/meili/posts/PostActivity.kt on lines 146..146
    app/src/main/java/com/github/epfl/meili/posts/PostListActivity.kt on lines 80..80

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

    override fun orderList(list: List<Pair<String, Pair<Comment, User>>>): List<Pair<String, Pair<Comment, User>>> {
    Severity: Major
    Found in app/src/main/java/com/github/epfl/meili/posts/PostActivity.kt and 2 other locations - About 40 mins to fix
    app/src/main/java/com/github/epfl/meili/posts/PostListActivity.kt on lines 80..80
    app/src/main/java/com/github/epfl/meili/util/ListSorter.kt on lines 32..32

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

    override fun orderList(list: List<Pair<String, Pair<Post, User>>>): List<Pair<String, Pair<Post, User>>> {
    app/src/main/java/com/github/epfl/meili/posts/PostActivity.kt on lines 146..146
    app/src/main/java/com/github/epfl/meili/util/ListSorter.kt on lines 32..32

    Consider simplifying this complex logical expression.
    Open

    if (other != null && other::class.java == PointOfInterest::class.java) {
    val otherPoi = other as PointOfInterest
    return otherPoi.latitude == latitude && otherPoi.longitude == longitude && otherPoi.name == name
    && otherPoi.uid == uid && otherPoi.icon == icon
    }
    Severity: Major
    Found in app/src/main/java/com/github/epfl/meili/models/PointOfInterest.kt - About 40 mins to fix

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

      if (result.resultCode == RESULT_OK && result.data != null && result.data!!.data != null) {
      app/src/main/java/com/github/epfl/meili/map/MapActivity.kt on lines 127..127

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

      if (result.resultCode == RESULT_OK && result.data != null && result.data!!.data != null) {
      Severity: Minor
      Found in app/src/main/java/com/github/epfl/meili/map/MapActivity.kt and 1 other location - About 40 mins to fix
      app/src/main/java/com/github/epfl/meili/posts/forum/ForumActivity.kt on lines 60..60

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

      fun onUsersInfoReceived(users: Map<String, User>, map: Map<String, T>) {
      app/src/main/java/com/github/epfl/meili/review/ReviewsActivity.kt on lines 174..174
      app/src/main/java/com/github/epfl/meili/util/ListSorter.kt on lines 56..56

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

      override fun onUsersInfoReceived(users: Map<String, User>, map: Map<String, Review>) {
      app/src/main/java/com/github/epfl/meili/profile/UserProfileLinker.kt on lines 14..14
      app/src/main/java/com/github/epfl/meili/util/ListSorter.kt on lines 56..56

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

      override fun onUsersInfoReceived(users: Map<String, User>, map: Map<String, T>) {
      Severity: Minor
      Found in app/src/main/java/com/github/epfl/meili/util/ListSorter.kt and 2 other locations - About 40 mins to fix
      app/src/main/java/com/github/epfl/meili/profile/UserProfileLinker.kt on lines 14..14
      app/src/main/java/com/github/epfl/meili/review/ReviewsActivity.kt on lines 174..174

      Method onActivityResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      activity: Activity,
      requestCode: Int,
      result: Int,
      data: Intent?,
      onComplete: () -> Unit

        Method onActivityResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        activity: Activity,
        requestCode: Int,
        result: Int,
        data: Intent?,
        onComplete: () -> Unit
        Severity: Minor
        Found in app/src/main/java/com/github/epfl/meili/auth/AuthenticationService.kt - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language