Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing iP code quality feedback [for @MaYuehan] #2

Open
soc-se-bot-blue opened this issue Feb 17, 2024 · 0 comments
Open

Sharing iP code quality feedback [for @MaYuehan] #2

soc-se-bot-blue opened this issue Feb 17, 2024 · 0 comments

Comments

@soc-se-bot-blue
Copy link

@MaYuehan We did an automated analysis of your code to detect potential areas to improve the code quality. We are sharing the results below, to help you improve the iP code further.

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/duke/Tasks/Task.java lines 9-9:

    public boolean marked;

Example from src/test/java/duke/Tasks/Task.java lines 7-7:

    public boolean marked;

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

Example from src/main/java/duke/Command/Command.java lines 1-1:

package duke.Command;

Example from src/main/java/duke/Command/DeadlineCommand.java lines 1-1:

package duke.Command;

Example from src/main/java/duke/Command/DeleteCommand.java lines 1-1:

package duke.Command;

Suggestion: Follow the package naming convention specified by the coding standard.

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/duke/Duke.java lines 28-31:

    /**
     * You should have your own function to generate a response to user input.
     * Replace this stub with your completed method.
     */

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 Message

possible problems in commit 37fd70f:


Detect and Remove Duplicate Tasks

The new `DetectCommand` class is introduced to address the need for detecting and removing duplicate tasks from the task list. This command iterates through the task list, comparing each task's description character by character with descriptions of other tasks. If a duplicate is found, it adds the task to a list of duplicate tasks. After detecting duplicates, the command removes them from the task list and saves the updated task list to storage.

Changes made:
- Added a new `DetectCommand` class to the project.
- Implemented logic to compare task descriptions character by character and remove duplicates from the task list.
- Improved the `execute` method to provide feedback on duplicate removal, including listing duplicate tasks if any.
- Introduced a helper method `compareDescriptions` to facilitate character-by-character comparison of task descriptions.

The introduction of the `DetectCommand` class enhances the functionality of the application by ensuring task lists remain free of duplicates, leading to improved task management and user experience.


  • body not wrapped at 72 characters: e.g., The new DetectCommand class is introduced to address the need for detecting and removing duplicate tasks from the task list. This command iterates through the task list, comparing each task's description character by character with descriptions of other tasks. If a duplicate is found, it adds the task to a list of duplicate tasks. After detecting duplicates, the command removes them from the task list and saves the updated task list to storage.

possible problems in commit 96a2f49:


Refactor Storage class: Enhance save() function

1. Revamped the save() function in the Storage class to improve code
readability, error handling, and resource management.

2. Implemented try-with-resources for FileWriter to ensure proper closing of
the resource.
3. Streamlined the logic for checking task types during saving by removing
redundant condition checks.
4. Utilized String.format() for constructing task details to enhance
readability and maintainability.
5. Simplified the method signature by removing unnecessary parameters.


  • body not wrapped at 72 characters: e.g., 2. Implemented try-with-resources for FileWriter to ensure proper closing of

possible problems in commit db12626:


Lay out the code so that it adheres to the logical structure. Adjust the code to achieve higher code quality.


  • Longer than 72 characters
  • Subject line should not end with a period

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 👍


ℹ️ 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 [email protected] if you want to follow up on this post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant