Giter Site home page Giter Site logo

ip's People

Contributors

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

ip's Issues

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

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

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 105-107:

    /**
     * duke.Main driver code for duke class.
     */

Example from src/main/java/duke/GuiResponse.java lines 7-9:

    /**
     * Show welcome message.
     */

Example from src/main/java/duke/GuiResponse.java lines 14-16:

    /**
     * Show goodbye message.
     */

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


fixed toString error


  • Not in imperative mood (?)

possible problems in commit c650bbc:


Fixed find command


  • Not in imperative mood (?)

possible problems in commit 4290773:


Added User Guide


  • Not in imperative mood (?)

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

Suggestion: Avoid committing binary files (e.g., *.class, *.jar, *.exe) or third-party library files in to the repo.


โ— 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.

Sharing iP code quality feedback [for @tiif]

@tiif 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/Parser.java lines 121-121:

            boolean reached = false;

Example from src/main/java/duke/Parser.java lines 146-146:

            boolean reachFrom = false;

Example from src/main/java/duke/Parser.java lines 147-147:

            boolean reachTo = 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

Example from src/main/java/Duke.java lines 33-76:

    public String getResponse(String input) {
        String command = parser.parseCommand(input);
        String response = "";
        GuiResponse guiResponse = new GuiResponse();
        if (command.equals("list")) {
            response = guiResponse.getTaskList(tasks);
        } else if (command.equals("mark")) {
            int index = parser.parseToIndex();
            Task curr = tasks.getTask(index);
            curr.markAsDone();
            storage.store(tasks);
            response = guiResponse.getMark(curr, index);
        } else if (command.equals("unmark")) {
            int index = parser.parseToIndex();
            Task curr = tasks.getTask(index);
            curr.markAsNotDone();
            storage.store(tasks);
            response = guiResponse.getUnmark(curr, index);
        } else if (command.equals("bye")) {
            response = guiResponse.getGoodbyeMessage();
        } else if (command.equals("todo") || command.equals("deadline") || command.equals("event")) {
            Task curr = parser.parseToTask();
            if (curr == null) {
                //need some handling here todo
                return "";
            }
            tasks.addTask(curr);
            storage.store(tasks);
            response = guiResponse.getAddTask(curr, tasks.getSize());
        } else if (command.equals("delete")) {
            int index = parser.parseToIndex();
            Task curr = tasks.getTask(index);
            tasks.deleteTask(index);
            storage.store(tasks);
            response = guiResponse.getDelete(curr, tasks.getSize());
        } else if (command.equals("find")) {
            String query = parser.parseQuery();
            response = guiResponse.getQueryResult(tasks.searchTask(query));
        } else {
            //nothing found
            response = "OOPS!!! I'm sorry, but I don't know what that means :-(";
        }
        return response;
    }

Example from src/main/java/Duke.java lines 81-128:

    public void run() throws IOException {
        ui.printWelcomeMessage();
        boolean isExit = false;
        while (!isExit) {
            BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
            String str = bf.readLine();
            String command = parser.parseCommand(str);
            if (command.equals("list")) {
                ui.printTaskList(tasks);
            } else if (command.equals("mark")) {
                int index = parser.parseToIndex();
                Task curr = tasks.getTask(index);
                curr.markAsDone();
                storage.store(tasks);
                ui.printMark(curr, index);
            } else if (command.equals("unmark")) {
                int index = parser.parseToIndex();
                Task curr = tasks.getTask(index);
                curr.markAsNotDone();
                storage.store(tasks);
                ui.printUnmark(curr, index);
            } else if (command.equals("bye")) {
                ui.printGoodbyeMessage();
                isExit = true;
            } else if (command.equals("todo") || command.equals("deadline") || command.equals("event")) {
                Task curr = parser.parseToTask();
                if (curr == null) {
                    continue;
                }
                tasks.addTask(curr);
                storage.store(tasks);
                ui.printAddTask(curr, tasks.getSize());
            } else if (command.equals("delete")) {
                int index = parser.parseToIndex();
                Task curr = tasks.getTask(index);
                tasks.deleteTask(index);
                storage.store(tasks);
                ui.printDelete(curr, tasks.getSize());
            } else if (command.equals("find")) {
                String query = parser.parseQuery();
                ui.printQueryResult(tasks.searchTask(query));
            } else {
                //nothing found
                System.out.println("OOPS!!! I'm sorry, but I don't know what that means :-(");
            }
        }

    }

Example from src/main/java/duke/Parser.java lines 15-74:

    public String parseCommand(String fullCommmand) {
        String[] parsedStr = fullCommmand.split("\\s+");
        this.parsedStr = parsedStr;
        if (parsedStr[0].equals("find")) {
            this.command = "find";
            return "find";
        } else if (parsedStr[0].equals("list")) {
            if (parsedStr.length > 1) {
                //error handlinrg
                System.out.println("Do not input another argument beside list");
                return "";
            }
            this.command = "list";
            return "list";
        } else if (parsedStr[0].equals("mark")) {
            if (parsedStr.length < 2) {
                //error handling
                System.out.println("Please specify the index of the task");
                return "";
            } else if (parsedStr.length > 2) {
                System.out.println("Extra argument detected!");
                return "";
            }
            this.command = "mark";
            return "mark";
        } else if (parsedStr[0].equals("unmark")) {
            if (parsedStr.length < 2) {
                System.out.println("Please specify the index of the task");
                return "";
            } else if (parsedStr.length > 2) {
                System.out.println("Extra argument detected!");
                return "";
            }
            this.command = "unmark";
            return "unmark";
        } else if (fullCommmand.equals("bye")) {
            this.command = "bye";
            return "bye";
        } else if (parsedStr[0].equals("todo")) {
            int size = parsedStr.length;
            if (size < 2) {
                //error handling
                System.out.println("You do not specify the todo name");
                return "";
            }
            this.command = "todo";
            return "todo";
        } else if (parsedStr[0].equals("deadline")) {
            this.command = "deadline";
            return "deadline";
        } else if (parsedStr[0].equals("event")) {
            this.command = "event";
            return "event";
        } else if (parsedStr[0].equals("delete")) {
            this.command = "delete";
            return "delete";
        }
        this.command = "";
        return "";
    }

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

Example from src/main/java/Duke.java lines 78-80:

    /**
     * Main driver code for duke class.
     */

Example from src/main/java/duke/GuiResponse.java lines 7-9:

    /**
     * show welcome message
     */

Example from src/main/java/duke/GuiResponse.java lines 14-16:

    /**
     * show goodbye message
     */

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 9ae2432:


deleted some imports and comments


  • Not in imperative mood (?)

possible problems in commit a05953a:


Added Gui for chatbot


  • Not in imperative mood (?)

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

Aspect: Binary files in repo

Suggestion: Avoid committing binary files (e.g., *.class, *.jar, *.exe) or third-party library files in to the repo.


โ„น๏ธ 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.