Skip to content

Sharing iP code quality feedback [for @jiangsuwangjing] #4

@soc-se-bot-red

Description

@soc-se-bot-red

@jiangsuwangjing 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/alex/command/MarkCommand.java lines 9-9:

    private boolean markDone;

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/alex/Storage.java lines 57-60:

    /**
     * Load all the tasks stored in the file directory
     * @return a TaskList containing all the tasks
     */

Example from src/main/java/alex/Storage.java lines 99-103:

    /**
     * Delete a line in file
     * @param index the index of the line starting from 1
     * @throws IOException
     */

Example from src/main/java/alex/Storage.java lines 111-116:

    /**
     * Update the line of the index with a new String
     * @param index index of line counting from 1
     * @param updated the new string to replace the original line
     * @throws IOException
     */

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 fb83f79:


Use stream for finding tasks

Used java Streams and filter to filter out the tasks containing the keywords.


  • body not wrapped at 72 characters: e.g., Used java Streams and filter to filter out the tasks containing the keywords.

possible problems in commit cdc09e6:


Refactor and improve code quality

Cleaned up the zombie code that are commented out or not used anywhere from Alex.

Extracted the logic of parsing command details from the Parser to the specific Command classes. This reduces the long parse function and adheres to SLAP. Even though extracting the commands with switch is still long, it is still necessary and may be improved in future iterations.


  • body not wrapped at 72 characters: e.g., Cleaned up the zombie code that are commented out or not used anywhere from Alex.

possible problems in commit f4a794e:


Add assert feature

Use assertions to document assumptions in various points in the code. The assertions added include checking for null values and range of index parameters and length of arrays carrying variables.

Parser is untouched as it is the first point of entry from user input and errors are mostly caused by users and are already handled.


  • body not wrapped at 72 characters: e.g., Use assertions to document assumptions in various points in the code. The assertions added include checking for null values and range of index parameters and length of arrays carrying variables.

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