Skip to content

Sharing iP code quality feedback [for @yooplo] - Round 2 #8

@nus-se-bot

Description

@nus-se-bot

@yooplo We did an automated analysis of your code to detect potential areas to improve the code quality. We are sharing the results below, so that you can avoid similar problems in your tP code (which will be graded more strictly for code quality).

IMPORTANT: Note that the script looked for just a few easy-to-detect problems only, and at-most three example are given i.e., there can be other areas/places to improve.

Aspect: Tab Usage

No easy-to-detect issues 👍

Aspect: Naming boolean variables/methods

No easy-to-detect issues 👍

Aspect: Brace Style

No easy-to-detect issues 👍

Aspect: Package Name Style

No easy-to-detect issues 👍

Aspect: Class Name Style

No easy-to-detect issues 👍

Aspect: Dead Code

No easy-to-detect issues 👍

Aspect: Method Length

Example from src/main/java/regina/Ui.java lines 36-72:

    public String greet(String name) {
        String greetingMessage = String.format("""
                Hey there! I'm %s
                I am a chatbot designed to help you track your activities.
                You can add tasks using the following formats:
                1. To add a To-Do task: todo <task_description>
                   Example: todo Finish homework
                2. To add a Deadline task: deadline <task_description> /by <deadline>
                   Example: deadline Submit report /by 2/12/2024 1800
                3. To add an Event task: event <task_description> /from <start_time> /to <end_time>
                   Example: event Team meeting /from 2/12/2024 1600 /to 2/12/2024 1800
                You can also:
                1. Mark a task as done: mark <task_number>
                   Example: mark 1
                2. Unmark a task: unmark <task_number>
                   Example: unmark 1
                3. Delete a task: delete <task_number>
                   Example: delete 1
                4. List tasks: type 'list' to see all your tasks
                5. Delete all current tasks: type 'clear'
                6. Find out current date and time: type 'now'
                7. To snooze the deadline by
                      default value of 30 minutes: snooze <task_number>
                      custom value: snooze <task_number> /by <duration_value> <duration_type>
                      The 3 duration types are: day, hour and minute
                   Example: snooze 1 /by 3 hours
                8. List out all tasks occurring at a specified date and time: occurring <date_and_time>
                   Example: occurring 2/12/2024 1800
                9. For help: type 'help'
                10. To exit the app: type 'bye'
                What can I do for you?
                """, name
        );

        System.out.println(greetingMessage);
        return greetingMessage;
    }

Example from src/test/java/regina/UiTest.java lines 24-57:

    public void testGreet() {
        ui.greet("regina.Regina");
        String expectedOutput = """
                Hey there! I'm regina.Regina
                I am a chatbot designed to help you track your activities.
                You can add tasks using the following formats:
                1. To add a To-Do task: todo <task_description>
                   Example: todo Finish homework
                2. To add a Deadline task: deadline <task_description> /by <deadline>
                   Example: deadline Submit report /by 2/12/2024 1800
                3. To add an Event task: event <task_description> /from <start_time> /to <end_time>
                   Example: event Team meeting /from 2/12/2024 1600 /to 2/12/2024 1800
                You can also:
                1. Mark a task as done: mark <task_number>
                   Example: mark 1
                2. Unmark a task: unmark <task_number>
                   Example: unmark 1
                3. Delete a task: delete <task_number>
                   Example: delete 1
                4. List tasks: type 'list' to see all your tasks
                5. Delete all current tasks: type 'clear'
                6. Find out current date and time: type 'now'
                7. To snooze the deadline by
                      default value of 30 minutes: snooze <task_number>
                      custom value: snooze <task_number> /by <duration_value> <duration_type>
                      The 3 duration types are: day, hour and minute
                   Example: snooze 1 /by 3 hours
                8. List out all tasks occurring at a specified date and time: occurring <date_and_time>
                   Example: occurring 2/12/2024 1800
                9. For help: type 'help'
                What can I do for you?
                """;
        assertEquals(expectedOutput.trim(), outContent.toString().trim());
    }

Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten methods e.g., extract some code blocks into separate methods. You may ignore this suggestion if you think a longer method is justified in a particular case.

Aspect: Class size

No easy-to-detect issues 👍

Aspect: Header Comments

No easy-to-detect issues 👍

Aspect: Recent Git Commit Message

No easy-to-detect issues 👍

Aspect: Binary files in repo

No easy-to-detect issues 👍


❗ You are not required to (but you are welcome to) fix the above problems in your iP, unless you have been separately asked to resubmit the iP due to code quality issues.

ℹ️ The bot account used to post this issue is un-manned. Do not reply to this post (as those replies will not be read). Instead, contact cs2103@comp.nus.edu.sg if you want to follow up on this post.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions