Skip to content

Sharing iP code quality feedback [for @angjozee] - Round 2 #4

@soc-se-bot

Description

@soc-se-bot

@angjozee 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

Example from src/main/java/plato/command/FindCommand.java lines 34-34:

        boolean found = false;

Suggestion: Follow the given naming convention for boolean variables/methods (e.g., use a boolean-sounding prefix).You may ignore the above if you think the name already follows the convention (the script can report false positives in some cases)

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

No easy-to-detect issues 👍

Aspect: Class size

No easy-to-detect issues 👍

Aspect: Header Comments

Example from src/main/java/plato/Plato.java lines 65-69:

    /**
     * The main entry point of the Plato application.
     *
     * @param args Command-line arguments (not used).
     */

Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.

Aspect: Recent Git Commit Messages

possible problems in commit f4be24c:


Fix priority parsing, storage, and display in tasks

Previously, task priorities were not correctly identified when adding a
task. If a priority (e.g., HIGH, MEDIUM, LOW) was provided, it was being
treated as part of the task description. Additionally, the priority
was stored incorrectly in tasks.txt for Deadline and Event tasks,
leading to duplicate priority values in both file storage and display.

This commit implements the following fixes:

- **Correctly parses priority levels** when adding tasks:
  - Users can now specify priority at the end of their command.
  - If no priority is provided, the task defaults to MEDIUM.
  - Example: `todo Read book HIGH` correctly assigns HIGH priority.

- **Fixes duplicate priority in tasks.txt**:
  - `Deadline` and `Event` tasks previously appended an extra priority.
  - Now, tasks are saved correctly:
    - Before: `D ||   || sleep || MEDIUM || 2003-02-09 0012 || MEDIUM`
    - After:  `D ||   || sleep || 2003-02-09 0012 || MEDIUM`

- **Fixes duplicate priority in console output**:
  - `toString()` for `Deadline` and `Event` was printing priority twice.
  - Now, priority appears only once when displaying tasks.

- **Refactored `AddCommand` to properly extract priority**:
  - A helper method `isValidPriority()` ensures only valid priorities are parsed.
  - Prevents cases where an invalid priority is mistaken for part of the description.


  • body not wrapped at 72 characters: e.g., - A helper methodisValidPriority() ensures only valid priorities are parsed.

possible problems in commit 508e284:


Refactor Command execution to return responses & enable JavaFX exit on "bye"


  • Longer than 72 characters

Suggestion: Follow the given conventions for Git commit messages for future commits (do not modify past commit messages as doing so will change the commit timestamp that we used to detect your commit timings).

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