nheyek/SDP-2018

View on GitHub

Showing 124 of 124 total issues

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

package ch.epfl.sweng.studyup.DisplayQuestionActivityTest;

import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutTitleTest.java on lines 1..28
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutTrueFalseTest.java on lines 1..28
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutUriTest.java on lines 1..28

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

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

package ch.epfl.sweng.studyup.DisplayQuestionActivityTest;

import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutAnswerTest.java on lines 1..28
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutTitleTest.java on lines 1..28
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutTrueFalseTest.java on lines 1..28

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

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

package ch.epfl.sweng.studyup.DisplayQuestionActivityTest;

import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutAnswerTest.java on lines 1..28
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutTitleTest.java on lines 1..28
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutUriTest.java on lines 1..28

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

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

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

        if(tooRecentAPI()) {
            setContentView(R.layout.activity_schedule_teacher_api_higher_than_27);
        } else {
            setContentView(R.layout.activity_schedule_teacher);
            weekView = findViewById(R.id.weekView);
app/src/main/java/ch/epfl/sweng/studyup/player/ScheduleActivityStudent.java on lines 97..106

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

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

package ch.epfl.sweng.studyup.DisplayQuestionActivityTest;

import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutAnswerTest.java on lines 1..28
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutTrueFalseTest.java on lines 1..28
app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/LaunchIntentWithoutUriTest.java on lines 1..28

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

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

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

        if(tooRecentAPI()) {
            setContentView(R.layout.activity_schedule_student_api_higher_than_27);
        } else {
            setContentView(R.layout.activity_schedule_student);
            weekView = findViewById(R.id.weekView);
app/src/main/java/ch/epfl/sweng/studyup/teacher/ScheduleActivityTeacher.java on lines 152..161

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

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

    public void selectImage(View v) {
        String col = getSharedPreferences(USER_PREFS, MODE_PRIVATE)
                .getString(COLOR_SETTINGS_KEYWORD, SETTINGS_COLOR_RED);
        AlertDialog.Builder dialogBuilder = col.equals(SETTINGS_COLOR_DARK) ?
                new AlertDialog.Builder(this, AlertDialog.THEME_DEVICE_DEFAULT_DARK) : new AlertDialog.Builder(this);
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/studyup/player/CustomActivity.java - About 1 hr to fix

    Method editAndCheckQuestionHelper has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void editAndCheckQuestionHelper(final int newAnswerNumber, final boolean changeType, final boolean isTrueFalseBeforeEdition) throws Throwable {
            mActivityRule.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    mActivityRule.getActivity().findViewById(R.id.addOrEditQuestionButton).callOnClick();

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

          public  UserData(String sciperNum,
                           String firstName,
                           String lastName,
                           HashMap<String, List<String>> answeredQuestions,
                           List<Course> courses,
      app/src/main/java/ch/epfl/sweng/studyup/player/QuestsActivityStudent.java on lines 139..147

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

      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

              QuestListViewAdapterStudent(Context cnx, int idLayout, List<Question> questions, List<Integer> ids,
                                                 List<Integer> lang, List<Double> progressBars) {
                  this.cnx = cnx;
                  this.questions = questions;
                  this.idLayout = idLayout;
      app/src/main/java/ch/epfl/sweng/studyup/player/UserData.java on lines 21..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 71.

      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 static void setImageOrTextBasedRadioButtonFirstTime(Activity act, int imageOrTextQuestionId) {
              if (imageOrTextQuestionId == R.id.text_radio_button) {
                  RadioButton tRadio = act.findViewById(R.id.text_radio_button);
                  tRadio.setChecked(true);
              } else {
      app/src/main/java/ch/epfl/sweng/studyup/questions/AddOrEditQuestionActivityHelperMethods.java on lines 62..70

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

      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 static void setTrueFasleMCQRadioButtonFirstTime(Activity act, int trueFalseOrMCQId) {
              if (trueFalseOrMCQId == R.id.true_false_radio) {
                  RadioButton tfRadio = act.findViewById(R.id.true_false_radio);
                  tfRadio.setChecked(true);
              } else {
      app/src/main/java/ch/epfl/sweng/studyup/questions/AddOrEditQuestionActivityHelperMethods.java on lines 244..252

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

      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 setupListViews has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public void setupListViews(){
              List<Course> otherCourses = new ArrayList<>(Arrays.asList(Course.values()));
              otherCourses.remove(FakeCourse);
              if(MOCK_ENABLED) otherCourses = new ArrayList<>(Arrays.asList(FakeCourse));
      
      

      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 onActivityResult has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public void onActivityResult(int requestCode, int resultCode, Intent data) {
      
              super.onActivityResult(requestCode, resultCode, data);
              if (resultCode == RESULT_CANCELED) {
      Severity: Minor
      Found in app/src/main/java/ch/epfl/sweng/studyup/player/CustomActivity.java - About 55 mins 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 getStudentRankingsForCourse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static List<Pair<String, Integer>> getStudentRankingsForCourse(List<UserData> studentsInCourse, final List<String> courseQuestionIds) {
      
              List<Pair<String, Integer>> studentRankings = new ArrayList<>();
      
              for (UserData student : studentsInCourse) {
      Severity: Minor
      Found in app/src/main/java/ch/epfl/sweng/studyup/utils/StatsUtils.java - About 55 mins 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 onLocationUpdate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public void onLocationUpdate(LatLng latLong) {
              if (latLong != null) {
                  Log.d("GPS_MAP", "New position map: " + latLong.toString());
                  if (mMap != null) {
                      if (location != null) {
      Severity: Minor
      Found in app/src/main/java/ch/epfl/sweng/studyup/map/MapsActivity.java - About 55 mins 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

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

              } else {
                  Player.get().setRole(Constants.Role.teacher);
                  setRoleInCache(Constants.Role.teacher);
                  i = new Intent(SettingsActivity.this, QuestsActivityTeacher.class);
                  Toast.makeText(SettingsActivity.this, R.string.student_to_teacher, Toast.LENGTH_SHORT).show();
      app/src/main/java/ch/epfl/sweng/studyup/settings/SettingsActivity.java on lines 91..96

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

      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

              if(Player.get().isTeacher()) {
                  Player.get().setRole(Constants.Role.student);
                  setRoleInCache(Constants.Role.student);
                  i = new Intent(SettingsActivity.this, HomeActivity.class);
                  Toast.makeText(SettingsActivity.this, R.string.teacher_to_student, Toast.LENGTH_SHORT).show();
      app/src/main/java/ch/epfl/sweng/studyup/settings/SettingsActivity.java on lines 96..101

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

      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

          @Test
          public void launchIntentWithoutDurationTest(){
              Intent i = getIntentForDisplayQuestion(InstrumentationRegistry.getTargetContext(), new Question("abc","test", true, 0, Constants.Course.SWENG.name(), "en"));
              i.removeExtra(DISPLAY_QUESTION_DURATION);
              mActivityRule.launchActivity(i);
      app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/MoreDisplayTest.java on lines 21..27

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

      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

          @Test
          public void launchIntentWithoutUriTest(){
              Intent i = getIntentForDisplayQuestion(InstrumentationRegistry.getTargetContext(), new Question("abc","test", true, 0, Constants.Course.SWENG.name(), "en"));
              i.removeExtra(DISPLAY_QUESTION_ID);
              mActivityRule.launchActivity(i);
      app/src/androidTest/java/ch/epfl/sweng/studyup/DisplayQuestionActivityTest/MoreDisplayTest.java on lines 29..35

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

      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