Coder Social home page Coder Social logo

ip's People

Contributors

damithc avatar eclipse-dominator avatar j-lum avatar jiachen247 avatar jianyangg avatar seanleong339 avatar

ip's Issues

Sharing iP code quality feedback [for @jianyangg]

@jianyangg 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/Task.java lines 9-9:

    private boolean prioritySet;

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

Example from src/main/java/duke/TaskList.java lines 25-25:

        // this.taskList.addAll(savedTaskList);

Example from src/main/java/duke/Ui.java lines 22-22:

        // System.out.println("\nWelcome to Chatty.\n" + LOGO);

Example from src/main/java/duke/Ui.java lines 26-26:

    // private String sendGreeting() {

Suggestion: Remove dead code from the codebase.

Aspect: Method Length

Example from src/main/java/duke/Duke.java lines 74-177:

    private String handleTextInput(String inputString) {
        assert inputString != null : "Input string cannot be null";
        assert !inputString.isEmpty() : "Input string cannot be empty";
        // handle key logic here.
        String command = inputString.split(" ")[0];
        int taskIndex;

        switch (command) {
        case "bye":
            return ui.sendFarewell();

        case "list":
            return ui.printTaskList(tasks.toString());

        case "mark":
            // taskIndex is the second word in the input string
            taskIndex = Integer.parseInt(inputString.split(" ")[1]) - 1;

            tasks.markTaskAsDone(taskIndex);

            return ui.markTaskAsDoneMessage(tasks.taskToString(taskIndex));

        case "unmark":
            taskIndex = Integer.parseInt(inputString.split(" ")[1]) - 1;
            tasks.unmarkTaskAsDone(taskIndex);
            return ui.unmarkTaskAsDoneMessage(tasks.taskToString(taskIndex));

        case "todo":
            try {
                String taskName = inputString.substring(5);
                Task newTask = new ToDo(taskName);
                tasks.addToTaskList(newTask);
                assert !tasks.isEmpty() : "Task list should not be empty";

                return ui.addTaskOutputText(newTask, tasks.size());
            } catch (StringIndexOutOfBoundsException e) {
                return ui.showErrorMessage("\tโ˜น OOPS!!! The description of a todo cannot be empty.");
            }
        case "deadline":
            try {
                // stop before /by
                String taskName = inputString.substring(9, inputString.indexOf("/by") - 1);
                // get day
                String deadline = inputString.substring(inputString.indexOf("/by") + 4);
                try {
                    Task newTask = new Deadline(taskName, deadline);

                    tasks.addToTaskList(newTask);

                    return ui.addTaskOutputText(newTask, tasks.size());
                } catch (java.time.format.DateTimeParseException e) {
                    return ui.showErrorMessage("\tInvalid date format. Please use yyyy-mm-dd.");
                }
            } catch (StringIndexOutOfBoundsException e) {
                return ui.showErrorMessage("\tโ˜น OOPS!!! The description of a deadline cannot be empty.");
            }
        case "event":
            try {
                String taskName = inputString.substring(6, inputString.indexOf("/from") - 1);
                String from = inputString.substring(inputString.indexOf("/from") + 6, inputString.indexOf("/to") - 1);
                String to = inputString.substring(inputString.indexOf("/to") + 4);
                Task newTask = new Event(taskName, from, to);

                tasks.addToTaskList(newTask);

                return ui.addTaskOutputText(newTask, tasks.size());
            } catch (StringIndexOutOfBoundsException e) {
                return ui.showErrorMessage("\tโ˜น OOPS!!! The description of an event cannot be empty.");
            }
        case "delete":
            taskIndex = Integer.parseInt(inputString.split(" ")[1]) - 1;
            String msg = ui.printDeleteMessage(tasks.taskToString(taskIndex), taskIndex, tasks.size());
            tasks.deleteTask(taskIndex);
            return msg;
            
        case "find":
            String keyword = inputString.substring(5);
            String outputString = "";
            for (int i = 0; i < tasks.size(); i++) {
                if (tasks.taskToString(i).contains(keyword)) {
                    outputString += tasks.taskToString(i) + "\n";
                }
            }
            return ui.printTaskList(outputString);

        case "priority":
            // the format will be priority <index> <priority>
            // priority is an integer
            // index is an integer
            // priority is between 1 and 5
            // index is between 1 and taskList.size()
            String[] inputArr = inputString.split(" ");
            int priority = Integer.parseInt(inputArr[2]);
            taskIndex = Integer.parseInt(inputArr[1]) - 1;
            tasks.setPriority(taskIndex, priority);
            return ui.printPriorityMessage(tasks.taskToString(taskIndex), priority);

        default:
            return ui.showErrorMessage(
                    "\tโ˜น OOPS!!! I'm sorry, but I don't know what that means. Try again using either mark <index>,"
                            + "unmark <index>, todo <task>, deadline <task /by ..>, event <task /from .. /to ..>, or bye.");
        }

    }

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

possible problems in commit 746fb28:


Add C-Priority extension to Duke

Priority is represented using exclamation marks, printed after the task name. It ranges from 0 - 5, which in turn represents the number of exclamation mark, with 0 being the least and 5 being the highest priority


  • body not wrapped at 72 characters: e.g., Priority is represented using exclamation marks, printed after the task name. It ranges from 0 - 5, which in turn represents the number of exclamation mark, with 0 being the least and 5 being the highest priority

possible problems in commit 351d80f:


Add assertions where appropriate to validate function arguments

The addition of these assertions should help us validate our assumptions,

thus making it easier for errors and bugs to be detected.

As there are not much logic involved in this project, focus is mainly placed

on validating the input to the functions


  • body not wrapped at 72 characters: e.g., The addition of these assertions should help us validate our assumptions,

possible problems in commit 6e89ab7:


Improve the code quality in accordance with the CS2103T textbook

Code quality were improved with respect to areas such as comments,

line spacing to separate groups of related statements,

and avoided complicated expressions by breaking them down into simpler logic blocks


  • body not wrapped at 72 characters: e.g., and avoided complicated expressions by breaking them down into simpler logic blocks

Suggestion: Follow the given conventions for Git commit messages for future commits (no need to modify past commit messages).

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.

Sharing iP code quality feedback [for @jianyangg] - Round 2

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

Example from src/main/java/duke/gui/MainWindow.java lines 71-71:

//      dialogContainer.getChildren().add(DialogBox.getDukeDialog("Exiting in 2 seconds", dukeImage));

Suggestion: Remove dead code from the codebase.

Aspect: Method Length

No easy-to-detect issues ๐Ÿ‘

Aspect: Class size

No easy-to-detect issues ๐Ÿ‘

Aspect: Header Comments

No easy-to-detect issues ๐Ÿ‘

Aspect: Recent Git Commit Message

possible problems in commit 1c038e7:


Create a JAR file for the latest Chatty version.

JAR file should not actually be included here.

It'll be released instead as v0.2


  • Subject line should not end with a period

possible problems in commit b558549:


Added Chatty name website User Guide title


  • Not in imperative mood (?)

possible problems in commit 746fb28:


Add C-Priority extension to Duke

Priority is represented using exclamation marks, printed after the task name. It ranges from 0 - 5, which in turn represents the number of exclamation mark, with 0 being the least and 5 being the highest priority


  • body not wrapped at 72 characters: e.g., Priority is represented using exclamation marks, printed after the task name. It ranges from 0 - 5, which in turn represents the number of exclamation mark, with 0 being the least and 5 being the highest priority

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.