nheyek/SDP-2018

View on GitHub

Showing 66 of 124 total issues

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

    @Test
    public void getItemName() {
        assertEquals(mActivityRule.getActivity().getString(Items.XP_POTION_NAME_ID), (Items.XP_POTION).getName());
        assertEquals(mActivityRule.getActivity().getString(Items.COIN_SACK_NAME_ID), (Items.COIN_SACK).getName());
    }
app/src/androidTest/java/ch/epfl/sweng/studyup/ItemsTest/ItemsInstrumentationTest.java on lines 96..100

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

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

    @Test
    public void editTrueFalseQuestionAnswer1to0Test() throws Throwable {
        q = new Question(questionUUID, this.getClass().getName(), true, 1, Constants.Course.SWENG.name(), "en");
        editAndCheckQuestion(R.id.radio_answer1, 0, false);
    }
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

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

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

    @Test
    public void editMCQQuestionAnswer4to1Test() throws Throwable {
        q = new Question(questionUUID, this.getClass().getName(), false, 3, Constants.Course.SWENG.name(), "en");
        editAndCheckQuestion(R.id.radio_answer1, 0, false);
    }
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

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

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 getItemDescription() {
        assertEquals(mActivityRule.getActivity().getString(Items.XP_POTION_DESCRIPTION_ID), (Items.XP_POTION).getDescription());
        assertEquals(mActivityRule.getActivity().getString(Items.COIN_SACK_DESCRIPTION_ID), (Items.COIN_SACK).getDescription());
    }
app/src/androidTest/java/ch/epfl/sweng/studyup/ItemsTest/ItemsInstrumentationTest.java on lines 102..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 47.

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 consumeTombolaTicketGivesMoney() {
        Player.get().resetPlayer();
        int currency = Player.get().getCurrency();
        Items.TOMBOLA.consume();
app/src/androidTest/java/ch/epfl/sweng/studyup/ItemsTest/ItemsInstrumentationTest.java on lines 61..67

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

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

    @Test
    public void editMCQQuestionAnswer0to1Test() throws Throwable {
        q = new Question(questionUUID, this.getClass().getName(), false, 0, Constants.Course.SWENG.name(), "en");
        editAndCheckQuestion(R.id.radio_answer2, 1, false);
    }
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

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

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

    @Test
    public void editMCQQuestionAnswer1to2Test() throws Throwable {
        q = new Question(questionUUID, this.getClass().getName(), false, 0, Constants.Course.SWENG.name(), "en");
        editAndCheckQuestion(R.id.radio_answer2, 1, false);
    }
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

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

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

    @Test
    public void editTrueFalseQuestionAnswer0to1Test()  throws Throwable {
        q = new Question(questionUUID, this.getClass().getName(), true, 0, Constants.Course.SWENG.name(), "en");
        editAndCheckQuestion(R.id.radio_answer2, 1, false);
    }
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

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

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

    @Test
    public void editMCQQuestionAnswer3to2Test() throws Throwable {
        q = new Question(questionUUID, this.getClass().getName(), false, 2, Constants.Course.SWENG.name(), "en");
        editAndCheckQuestion(R.id.radio_answer2, 1, false);
    }
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 160..164
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

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

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

    @Test
    public void editTrueFalseToMCQAnswer0To3Test() throws Throwable {
        q = new Question(questionUUID, this.getClass().getName(), true, 0, Constants.Course.SWENG.name(), "en");
        editAndCheckQuestion(R.id.radio_answer3, 2, true);
    }
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 145..149
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 153..157
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 166..170
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 172..176
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 178..182
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 184..188
app/src/androidTest/java/ch/epfl/sweng/studyup/QuestionsTest/EditQuestionActivityTest.java on lines 190..194

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

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 consumeUnstablePotionGrantsXP() {
        Player.get().resetPlayer();
        int xp = Player.get().getExperience();
        Items.UNSTABLE_POTION.consume();
app/src/androidTest/java/ch/epfl/sweng/studyup/ItemsTest/ItemsInstrumentationTest.java on lines 69..75

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

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

                            try {
                                teachers = (List<String>) doc.getData().get(FB_TEACHING_STAFF);
                            } catch(ClassCastException e) { Log.d(TAG, "onComplete: The info for the teacher of "+c.name()+" is incorrect."); return; }
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/studyup/firebase/Firestore.java and 1 other location - About 35 mins to fix
app/src/main/java/ch/epfl/sweng/studyup/firebase/Firestore.java on lines 264..269

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

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

                                try {
                                    teachers = (List<String>) doc.getData().get(FB_TEACHING_STAFF);
                                } catch (ClassCastException e) {
                                    Log.d(TAG, "onComplete: The info for the teacher of " + c.name() + " is incorrect.");
                                    return;
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/studyup/firebase/Firestore.java and 1 other location - About 35 mins to fix
app/src/main/java/ch/epfl/sweng/studyup/firebase/Firestore.java on lines 301..303

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

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

    private void setCalendarToRightWeek(Calendar calendar) {
        calendar.set(Calendar.YEAR, Constants.YEAR_OF_SCHEDULE);
        calendar.set(Calendar.MONTH, Constants.MONTH_OF_SCHEDULE);
        calendar.set(Calendar.WEEK_OF_MONTH, Constants.WEEK_OF_MONTH_SCHEDULE);
    }
app/src/androidTest/java/ch/epfl/sweng/studyup/PlayerTest.java on lines 129..133

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

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

    private void setCalendarToRightWeek(Calendar calendar) {
        calendar.set(Calendar.YEAR, Constants.YEAR_OF_SCHEDULE);
        calendar.set(Calendar.MONTH, Constants.MONTH_OF_SCHEDULE);
        calendar.set(Calendar.WEEK_OF_MONTH, Constants.WEEK_OF_MONTH_SCHEDULE);
    }
Severity: Minor
Found in app/src/androidTest/java/ch/epfl/sweng/studyup/PlayerTest.java and 1 other location - About 35 mins to fix
app/src/androidTest/java/ch/epfl/sweng/studyup/LocationTest/ServiceGetLocationAndCheckRoomTest.java on lines 174..178

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

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

        onView(withId(R.id.levelText)).check(matches(withText(mActivityRule.getActivity().getResources().getString(R.string.text_level) +" "+ Player.get().getLevel())));
app/src/androidTest/java/ch/epfl/sweng/studyup/HomeActivityTests/BasicHomeActivityTest.java on lines 54..54
app/src/androidTest/java/ch/epfl/sweng/studyup/HomeActivityTests/BasicHomeActivityTest.java on lines 76..76

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

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

            onView(withId(R.id.levelText)).check(matches(withText(mActivityRule.getActivity().getResources().getString(R.string.text_level) +" "+ Player.get().getLevel())));
app/src/androidTest/java/ch/epfl/sweng/studyup/HomeActivityTests/BasicHomeActivityTest.java on lines 54..54
app/src/androidTest/java/ch/epfl/sweng/studyup/HomeActivityTests/BasicHomeActivityTest.java on lines 66..66

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

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

        onView(withId(R.id.currText)).check(matches(withText(mActivityRule.getActivity().getResources().getString(R.string.text_money) +" "+ Player.get().getCurrency())));
app/src/androidTest/java/ch/epfl/sweng/studyup/HomeActivityTests/BasicHomeActivityTest.java on lines 66..66
app/src/androidTest/java/ch/epfl/sweng/studyup/HomeActivityTests/BasicHomeActivityTest.java on lines 76..76

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

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

    private final MonthLoader.MonthChangeListener monthChangeListener = new MonthLoader.MonthChangeListener() {
        @Override
        public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth) {
            if(newMonth == MONTH_OF_SCHEDULE + 1 && newYear == YEAR_OF_SCHEDULE) {
                return weekViewEvents;
app/src/main/java/ch/epfl/sweng/studyup/teacher/ScheduleActivityTeacher.java on lines 47..56

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

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

    private final MonthLoader.MonthChangeListener monthChangeListener = new MonthLoader.MonthChangeListener() {
        @Override
        public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth) {
            if(newMonth == MONTH_OF_SCHEDULE + 1 && newYear == YEAR_OF_SCHEDULE) {
                return weekViewEvents;
app/src/main/java/ch/epfl/sweng/studyup/player/ScheduleActivityStudent.java on lines 38..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 43.

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