nheyek/SDP-2018

View on GitHub

Showing 124 of 124 total issues

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

        ListQuestionStatAdapter(Context cnx,
                                List<String> questions,
                                ArrayList<Integer> rates,
                                ArrayList<Integer> nb_answer,
                                int total_quests_for_course) {
app/src/main/java/ch/epfl/sweng/studyup/teacher/DisplayCourseStatsActivity.java on lines 135..145

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

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

        ListUserAdapter(Context cnx,
                        List<UserData> user,
                        ArrayList<Integer> rates,
                        ArrayList<Integer> nb_answer,
                        int total_quests_for_course) {
app/src/main/java/ch/epfl/sweng/studyup/teacher/DisplayCourseStatsActivity.java on lines 199..209

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

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 enrollInCoursesTest() {
        Player.get().setRole(Role.student);
        List<Course> testCourseList = new ArrayList<>();
        testCourseList.add(Course.Blacksmithing);
Severity: Minor
Found in app/src/androidTest/java/ch/epfl/sweng/studyup/PlayerTest.java and 1 other location - About 45 mins to fix
app/src/androidTest/java/ch/epfl/sweng/studyup/PlayerTest.java on lines 76..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 57.

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 addTeachingCourseTest() {
        Player.get().setRole(Role.teacher);
        List<Course> testCourseList = new ArrayList<>();
        testCourseList.add(Course.Blacksmithing);
Severity: Minor
Found in app/src/androidTest/java/ch/epfl/sweng/studyup/PlayerTest.java and 1 other location - About 45 mins to fix
app/src/androidTest/java/ch/epfl/sweng/studyup/PlayerTest.java on lines 67..74

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

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 testLanguageChoosingPopupFrench() {
        onView(withId(R.id.languageChoiceButton)).perform(click());
        onView(withText(LANGUAGES[1]))
                .inRoot(isDialog())
app/src/androidTest/java/ch/epfl/sweng/studyup/SettingsTest/SettingsActivityTest.java on lines 125..134

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

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 consumeItemCurrencyTest() throws Exception {
        Player.get().addItem(Items.COIN_SACK);
        int currency = Player.get().getCurrency();
        Player.get().consumeItem(Items.COIN_SACK);
Severity: Minor
Found in app/src/androidTest/java/ch/epfl/sweng/studyup/PlayerTest.java and 1 other location - About 45 mins to fix
app/src/androidTest/java/ch/epfl/sweng/studyup/PlayerTest.java on lines 51..57

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

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

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_course_selection);

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 setupWeekView has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static void setupWeekView(WeekView weekView,
                                           WeekView.EventLongPressListener eventLongPressListener,
                                           DateTimeInterpreter dateTimeInterpreter,
                                           MonthLoader.MonthChangeListener monthChangeListener,
                                           WeekView.EventClickListener eventClickListener,
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/studyup/utils/Utils.java - About 45 mins to fix

    Method equals has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            @Override
            public boolean equals(Object o){
                if(o == null || !(o instanceof CourseRequest)) {
                    return false;
                } else {

    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

        @Test
        public void z_testLanguageChoosingPopupEnglish() {
            onView(withId(R.id.languageChoiceButton)).perform(click());
            onView(withText(LANGUAGES[0]))
                    .inRoot(isDialog())
    app/src/androidTest/java/ch/epfl/sweng/studyup/SettingsTest/SettingsActivityTest.java on lines 113..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 55.

    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 consumeItemXpTest() {
            Player.get().addItem(Items.XP_POTION);
            int xp = Player.get().getExperience();
            Player.get().consumeItem(Items.XP_POTION);
    Severity: Minor
    Found in app/src/androidTest/java/ch/epfl/sweng/studyup/PlayerTest.java and 1 other location - About 45 mins to fix
    app/src/androidTest/java/ch/epfl/sweng/studyup/PlayerTest.java on lines 59..65

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

    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

            ownedItems.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    Items item = (Items)listItemAdapter.getItem(position);
                    startActivity(new Intent(parent.getContext(), DisplayItemActivity.class).putExtra(DisplayItemActivity.class.getName(), item.getName()));
    app/src/main/java/ch/epfl/sweng/studyup/items/ShopActivity.java on lines 41..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 51.

    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

            itemsToBuy.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    Items item = (Items) listItemAdapter.getItem(position);
                    startActivity(new Intent(parent.getContext(), BuyItemActivity.class).putExtra(BuyItemActivity.class.getName(), item.getName()));
    Severity: Minor
    Found in app/src/main/java/ch/epfl/sweng/studyup/items/ShopActivity.java and 1 other location - About 40 mins to fix
    app/src/main/java/ch/epfl/sweng/studyup/items/InventoryActivity.java on lines 44..50

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

    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

    Consider simplifying this complex logical expression.
    Open

            if (!intent.hasExtra(DISPLAY_QUESTION_TITLE) || !intent.hasExtra(DISPLAY_QUESTION_ID) || !intent.hasExtra(DISPLAY_QUESTION_ANSWER)
                    || !intent.hasExtra(DISPLAY_QUESTION_TRUE_FALSE) || !intent.hasExtra(DISPLAY_QUESTION_LANG) || !intent.hasExtra(DISPLAY_QUESTION_DURATION)) {
                quit(); return false;
            }

      Consider simplifying this complex logical expression.
      Open

              if (!Player.get().getKnownNPCs().contains(name)
                      && GlobalAccessVariables.NPCInteractionState
                      && !(currentActivity instanceof MapsActivity)
                      && Rooms.distanceBetweenTwoLatLng(npcLatLng, playerLatLng) < Constants.NPC_RANGE
                      && (counter >= MAX_COUNTER || isFirstInteraction)) {
      Severity: Major
      Found in app/src/main/java/ch/epfl/sweng/studyup/npc/NPC.java - About 40 mins to fix

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

            Items(int nameId, int descriptionId, int price, int image) {
                this.nameId = nameId;
                this.descriptionId = descriptionId;
                this.price = price;
                this.image = image;
        Severity: Major
        Found in app/src/main/java/ch/epfl/sweng/studyup/items/Items.java and 4 other locations - About 40 mins to fix
        app/src/main/java/ch/epfl/sweng/studyup/specialQuest/SpecialQuestType.java on lines 46..51
        app/src/main/java/ch/epfl/sweng/studyup/teacher/ManageCourseActivity.java on lines 293..298
        app/src/main/java/ch/epfl/sweng/studyup/teacher/QuestsActivityTeacher.java on lines 117..122
        app/src/main/java/ch/epfl/sweng/studyup/utils/adapters/SpecialQuestListViewAdapter.java on lines 22..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 49.

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

                CourseRequest(Course course, String sciper, String firstname, String lastname) {
                    this.course = course;
                    this.sciper = sciper;
                    this.firstname = firstname;
                    this.lastname = lastname;
        app/src/main/java/ch/epfl/sweng/studyup/items/Items.java on lines 82..87
        app/src/main/java/ch/epfl/sweng/studyup/specialQuest/SpecialQuestType.java on lines 46..51
        app/src/main/java/ch/epfl/sweng/studyup/teacher/QuestsActivityTeacher.java on lines 117..122
        app/src/main/java/ch/epfl/sweng/studyup/utils/adapters/SpecialQuestListViewAdapter.java on lines 22..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 49.

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

            public SpecialQuestListViewAdapter(Context context, int idLayout, List<SpecialQuest> specialQuests, List<Integer> ids) {
                this.context = context;
                this.specialQuests = specialQuests;
                this.idLayout = idLayout;
                this.ids = ids;
        app/src/main/java/ch/epfl/sweng/studyup/items/Items.java on lines 82..87
        app/src/main/java/ch/epfl/sweng/studyup/specialQuest/SpecialQuestType.java on lines 46..51
        app/src/main/java/ch/epfl/sweng/studyup/teacher/ManageCourseActivity.java on lines 293..298
        app/src/main/java/ch/epfl/sweng/studyup/teacher/QuestsActivityTeacher.java on lines 117..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 49.

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

            SpecialQuestType(int titleId, int descriptionId, int goal, SpecialQuestUpdateFlag updateFlag) {
                this.titleId = titleId;
                this.descriptionId = descriptionId;
                this.goal = goal;
                this.updateFlag = updateFlag;
        app/src/main/java/ch/epfl/sweng/studyup/items/Items.java on lines 82..87
        app/src/main/java/ch/epfl/sweng/studyup/teacher/ManageCourseActivity.java on lines 293..298
        app/src/main/java/ch/epfl/sweng/studyup/teacher/QuestsActivityTeacher.java on lines 117..122
        app/src/main/java/ch/epfl/sweng/studyup/utils/adapters/SpecialQuestListViewAdapter.java on lines 22..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 49.

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

                public QuestListViewAdapterTeacher(Context cnx, int idLayout, List<Question> questions, List<Integer> lang) {
                    this.cnx = cnx;
                    this.questions = questions;
                    this.idLayout = idLayout;
                    this.lang = lang;
        app/src/main/java/ch/epfl/sweng/studyup/items/Items.java on lines 82..87
        app/src/main/java/ch/epfl/sweng/studyup/specialQuest/SpecialQuestType.java on lines 46..51
        app/src/main/java/ch/epfl/sweng/studyup/teacher/ManageCourseActivity.java on lines 293..298
        app/src/main/java/ch/epfl/sweng/studyup/utils/adapters/SpecialQuestListViewAdapter.java on lines 22..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 49.

        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