Giter Club home page Giter Club logo

ip's People

Contributors

damithc avatar j-lum avatar jiachen247 avatar thisisdax avatar

Watchers

 avatar

ip's Issues

Sharing iP code quality feedback [for @thisisdax]

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

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

    public void parse(String input) throws DukeException {
        this.text = input.split(" ");
        String date = "";
        switch (text[0].toLowerCase()) {
            case "bye":
                this.setExit();
                this.isTask = false;
                break;
            case "list":
                Ui.printList();
                this.isTask = false;
                break;
            case "todo":
                this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length));
                try {
                    this.addTodo(this.body);
                    this.isTask = true;
                } catch (DukeException e) {
                    e.printErrorMessage();
                    this.isTask = false;
                }
                break;
            case "deadline":
                this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length-2));
                date = String.join(" ", Arrays.copyOfRange(text, text.length-2, text.length));
                try {
                    this.addDeadline(this.body, date);
                    this.isTask = true;
                } catch (DukeException e) {
                    e.printErrorMessage();
                    this.isTask = false;
                }
                break;
            case "event":
                this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length-3));
                date = String.join(" ", Arrays.copyOfRange(text, text.length-3, text.length-1));
                try {
                    this.addEvent(this.body, date, text[text.length-1]);
                    this.isTask = true;
                } catch (DukeException e) {
                    e.printErrorMessage();
                    this.isTask = false;
                }
                break;
            case "delete":
                if (text[1].isEmpty() || text[1].isBlank()) {
                    throw new DukeException("\t☹ OOPS!!! Please specify a task to delete!");
                }
                try {
                    int index = Integer.parseInt(text[1]);
                    if (index > todoList.size()) {
                        Ui.specifyValidNumber();
                        this.body = "";
                        this.isTask = false;
                        break;
                    }
                    if (index > 0) {
                        Ui.removedTask(todoList.remove(index - 1).toString());
                        this.isTask = false;
                    }
                } catch (NumberFormatException e ) {
                    throw new DukeException("\t☹ OOPS!!! Please specify a valid number instead. E.g. 'delete 1'");
                }
                break;
            case "find":
                if (text[1].isEmpty() || text[1].isBlank()) {
                    throw new DukeException("\t☹ OOPS!!! Please specify a word to find!");
                }
                Ui.searchList(text[1]);
                this.body = "";
                this.isTask = false;
                break;
            case "done":
                if (text[1].isEmpty() || text[1].isBlank()) {
                    throw new DukeException("\t☹ OOPS!!! Please specify a task to be marked as done!");
                }
                try {
                    int index = Integer.parseInt(text[1]);
                    if (index > todoList.size()) {
                        Ui.specifyValidNumber();
                        this.body = "";
                        this.isTask = false;
                        break;
                    }
                    if (index > 0) {
                        todoList.get(index - 1).markAsDone();
                        Ui.markAsDone(todoList.get(index - 1).toString());
                        this.isTask = false;
                    }
                } catch (NumberFormatException e ) {
                    throw new DukeException("\t☹ OOPS!!! Please specify a valid number instead. E.g. 'delete 1'");
                }
                break;
            default:
                this.body = "";
                this.isTask = false;
                throw new DukeException("\t☹ OOPS!!! I'm sorry, but I don't know what that means :-(");
        }
    }

Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten 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 👍

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 @nus-se-bot 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 @thisisdax] - Round 2

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

Example from src/main/java/seedu/duke/Parser.java lines 30-149:

    public void parse(String input) throws DukeException {
        this.text = input.split(" ");
        String date;
        switch (text[0].toLowerCase()) {
        case "bye":
            this.setExit();
            this.isTask = false;
            break;
        case "list":
            Ui.printList();
            this.isTask = false;
            break;
        case "todo":
            this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length));
            try {
                this.addTodo(this.body);
                this.isTask = true;
            } catch (DukeException e) {
                e.printErrorMessage();
                this.isTask = false;
            }
            break;
        case "deadline":
            this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length - 2));
            date = String.join(" ", Arrays.copyOfRange(text, text.length - 2, text.length));
            try {
                this.addDeadline(this.body, date);
                this.isTask = true;
            } catch (DukeException e) {
                e.printErrorMessage();
                this.isTask = false;
            }
            break;
        case "event":
            this.body = String.join(" ", Arrays.copyOfRange(text, 1, text.length - 3));
            date = String.join(" ", Arrays.copyOfRange(text, text.length - 3, text.length - 1));
            try {
                this.addEvent(this.body, date, text[text.length - 1]);
                this.isTask = true;
            } catch (DukeException e) {
                e.printErrorMessage();
                this.isTask = false;
            }
            break;
        case "delete":
            if (text[1].isEmpty() || text[1].isBlank()) {
                throw new DukeException("\t☹ OOPS!!! Please specify a task to delete!");
            }
            try {
                int index = Integer.parseInt(text[1]);
                if (index > todoList.size()) {
                    Ui.specifyValidNumber();
                    this.body = "";
                    this.isTask = false;
                    break;
                }
                if (index > 0) {
                    Ui.removedTask(todoList.remove(index - 1).toString());
                    this.isTask = false;
                }
            } catch (NumberFormatException e) {
                throw new DukeException("\t☹ OOPS!!! Please specify a valid number instead. E.g. 'delete 1'");
            }
            break;
        case "find":
            if (text[1].isEmpty() || text[1].isBlank()) {
                throw new DukeException("\t☹ OOPS!!! Please specify a word to find!");
            }
            Ui.searchList(text[1]);
            this.body = "";
            this.isTask = false;
            break;
        case "update":
            if (text[1].isEmpty() || text[1].isBlank()) {
                throw new DukeException("\t☹ OOPS!!! Please specify a task to update!");
            }
            try {
                int index = Integer.parseInt(text[1]);
                if (index > todoList.size()) {
                    Ui.specifyValidNumber();
                    this.body = "";
                    this.isTask = false;
                    break;
                }
                if (index > 0) {
                    this.updateTask(index, text);
                    Ui.updateTask(todoList.get(index - 1).toString());
                    this.isTask = false;
                }
            } catch (NumberFormatException e) {
                throw new DukeException("\t☹ OOPS!!! Please specify a valid number instead. E.g. 'delete 1'");
            }
            break;
        case "done":
            if (text[1].isEmpty() || text[1].isBlank()) {
                throw new DukeException("\t☹ OOPS!!! Please specify a task to be marked as done!");
            }
            try {
                int index = Integer.parseInt(text[1]);
                if (index > todoList.size()) {
                    Ui.specifyValidNumber();
                    this.body = "";
                    this.isTask = false;
                    break;
                }
                if (index > 0) {
                    todoList.get(index - 1).markAsDone();
                    Ui.markAsDone(todoList.get(index - 1).toString());
                    this.isTask = false;
                }
            } catch (NumberFormatException e) {
                throw new DukeException("\t☹ OOPS!!! Please specify a valid number instead. E.g. 'delete 1'");
            }
            break;
        default:
            this.body = "";
            this.isTask = false;
            throw new DukeException("\t☹ OOPS!!! I'm sorry, but I don't know what that means :-(");
        }
    }

Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten 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 (Subject Only)

possible problems in commit 38cecc2:

removed i/o redirection test

  • Not in imperative mood (?)

possible problems in commit a3df916:

fixed checkstyle error

  • Not in imperative mood (?)

possible problems in commit 8323198:

A-CI

  • Perhaps too short (?)

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 @nus-se-bot 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.