BlindlyTeam/Blindly

View on GitHub

Showing 33 of 107 total issues

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

    private fun passionsAreCorrect(): Boolean {
        findViewById<TextView>(R.id.at_least_one_warning).visibility = INVISIBLE
        findViewById<TextView>(R.id.no_more_than_5_warning).visibility = INVISIBLE

        val ids = chipGroup.checkedChipIds
app/src/main/java/ch/epfl/sdp/blindly/main_screen/profile/edit/EditSexualOrientations.kt on lines 64..86

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

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

    private fun sexualOrientationsAreCorrect(): Boolean {
        findViewById<TextView>(R.id.at_least_1_warning).visibility = INVISIBLE
        findViewById<TextView>(R.id.no_more_than_3_warning).visibility = INVISIBLE

        val ids = chipGroup.checkedChipIds
app/src/main/java/ch/epfl/sdp/blindly/main_screen/profile/edit/EditPassions.kt on lines 61..83

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

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

Class UserDAO has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

/**
 * Class that contains all the queries that can be made for the local database
 *
 */
@Dao
Severity: Minor
Found in app/src/main/java/ch/epfl/sdp/blindly/database/localDB/UserDAO.kt - About 2 hrs to fix

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

            viewHolder.mapButton.setOnClickListener {
                if (myMatch.isDeleted) {
                    showNoLongerAvailableToast()
                } else {
                    val intent = Intent(context, UserMapActivity::class.java)
    app/src/main/java/ch/epfl/sdp/blindly/main_screen/my_matches/MyMatchesAdapter.kt on lines 145..154

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

    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

            viewHolder.profileButton.setOnClickListener {
                if (myMatch.isDeleted) {
                    showNoLongerAvailableToast()
                } else {
                    val intent = Intent(context, MatchProfileActivity::class.java)
    app/src/main/java/ch/epfl/sdp/blindly/main_screen/my_matches/MyMatchesAdapter.kt on lines 156..165

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

    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

        fun startSexualOrientationsEdit(view: View) {
            val intent = Intent(this, EditSexualOrientations::class.java)
            val sexualOrientations = arrayListOf<String>()
            sexualOrientationsText?.forEach {
                sexualOrientations.add(it)
    app/src/main/java/ch/epfl/sdp/blindly/main_screen/profile/edit/EditProfile.kt on lines 114..122

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

    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

        fun startPassionsEdit(view: View) {
            val intent = Intent(this, EditPassions::class.java)
            val passions = arrayListOf<String>()
            passionsText?.forEach {
                passions.add(it)
    app/src/main/java/ch/epfl/sdp/blindly/main_screen/profile/edit/EditProfile.kt on lines 101..112

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

    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 6 locations. Consider refactoring.
    Open

        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(R.layout.profile_setup_finished)
    
            val bundle = intent.extras
    app/src/main/java/ch/epfl/sdp/blindly/profile_setup/ProfileGender.kt on lines 25..31
    app/src/main/java/ch/epfl/sdp/blindly/profile_setup/ProfileGenderMore.kt on lines 23..29
    app/src/main/java/ch/epfl/sdp/blindly/profile_setup/ProfileOrientation.kt on lines 27..33
    app/src/main/java/ch/epfl/sdp/blindly/profile_setup/ProfilePassions.kt on lines 26..32
    app/src/main/java/ch/epfl/sdp/blindly/profile_setup/ProfileShowMe.kt on lines 23..29

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

            /**
             * Converts the document received from firestore back into a User
             *
             * @return a User
             */
    Severity: Minor
    Found in app/src/main/java/ch/epfl/sdp/blindly/user/User.kt - About 1 hr to fix

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

          @TypeConverter
          fun fromStringToLocation(str: String): List<Double> {
              val values = str.split(",")
              return listOf(values[0].toDouble(), values[1].toDouble())
          }
      app/src/main/java/ch/epfl/sdp/blindly/database/localDB/UserConverter.kt on lines 49..53

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

      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

          @TypeConverter
          fun fromStringToIntList(str: String): List<Int> {
              val values = str.split(",")
              return listOf(values[0].toInt(), values[1].toInt())
          }
      app/src/main/java/ch/epfl/sdp/blindly/database/localDB/UserConverter.kt on lines 17..21

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

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

          override fun onCreate(savedInstanceState: Bundle?) {
              super.onCreate(savedInstanceState)
              setContentView(R.layout.activity_edit_gender)
      
              val uid = userHelper.getUserId()

        Method onBindViewHolder has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
        Open

            /**
             * Binds all the content to the view, and handles click listeners.
             * This function is invoked by the layout manager.
             *
             * @param viewHolder the ViewHolder of the current item

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

            @RequiresApi(Build.VERSION_CODES.O)
            override fun onCreate(savedInstanceState: Bundle?) {
                super.onCreate(savedInstanceState)
                setContentView(R.layout.activity_match_profile)
        
        

          Method onCreate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              override fun onCreate(savedInstanceState: Bundle?) {
                  super.onCreate(savedInstanceState)
                  setContentView(R.layout.activity_edit_profile)
          
                  val uid = userHelper.getUserId()

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

                private fun hideAllWarnings() {
                    findViewById<TextView>(R.id.please_specify_warning).visibility = INVISIBLE
                    findViewById<TextView>(R.id.use_only_letters_warning).visibility = INVISIBLE
                }
            app/src/main/java/ch/epfl/sdp/blindly/main_screen/profile/edit/EditGender.kt on lines 102..105

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

            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

                private fun showGenderEditor() {
                    findViewById<EditText>(R.id.edit_gender).visibility = VISIBLE
                    findViewById<Button>(R.id.update_gender_more).visibility = VISIBLE
                }
            app/src/main/java/ch/epfl/sdp/blindly/main_screen/profile/edit/EditGender.kt on lines 107..110

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

            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

                @TypeConverter
                fun fromLocationToString(loc: List<Double>): String {
                    return loc[0].toString() + "," + loc[1].toString()
                }
            app/src/main/java/ch/epfl/sdp/blindly/database/localDB/UserConverter.kt on lines 44..47

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

            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

                @TypeConverter
                fun fromIntListToString(il: List<Int>): String {
                    return il[0].toString() + "," + il[1].toString()
                }
            app/src/main/java/ch/epfl/sdp/blindly/database/localDB/UserConverter.kt on lines 12..15

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

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

                /**
                 * Gets the name of the user as input, checks it to be alphabetical and within
                 * character limits, if so passes it to builder and then fires Birthday Activity,
                 * if not outputs error message
                 *
            Severity: Minor
            Found in app/src/main/java/ch/epfl/sdp/blindly/profile_setup/ProfileName.kt - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language