Coder Social home page Coder Social logo

ip's Introduction

Hey there

About me:

I am a penultimate year computer science student from Singapore.

  • πŸ™‚ Feel free to view my projects here

  • πŸ“«Let's Connect! Linkedin Badge


πŸ› οΈ Languages and Tools :

JavaΒ  ReactΒ  Material UIΒ  Β  PytorchΒ  Tensorflow Β  Redux Β  CSSΒ  HTMLΒ  JavaScriptΒ  FirebaseΒ  MySQLΒ  NodeJSΒ 

πŸ”₯ My Stats :

alt text GitHub Streak Top Langs

ip's People

Contributors

damithc avatar douglch avatar j-lum avatar jiachen247 avatar seanleong339 avatar

ip's Issues

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

@Douglch 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/lele/task/TaskList.java lines 177-177:

        // assert this.listSize() >= inputIndex : "Index parameter queried should be within the task size";

Suggestion: Remove dead code from the codebase.

Aspect: Method Length

Example from src/main/java/lele/parser/Parser.java lines 54-148:

    public static Command parse(String fullCommand) throws UnknownCommandException, EmptyDescException {
        try {
            String[] inputArr = fullCommand.split(" ");
            Commands command = Commands.valueOf(inputArr[0].toUpperCase());
            String desc = "variable not initialised";
            StringBuilder sb = new StringBuilder();
            switch (command) {
            case TODO:
                if (inputArr.length == 1) {
                    throw new EmptyDescException("OOPS!!! The description of a todo cannot be empty.");
                }
                for (int i = 1; i < inputArr.length; i++) {
                    sb.append(inputArr[i]);
                    if (i != inputArr.length - 1) {
                        sb.append(" ");
                    }
                }
                Todo todo = new Todo(sb.toString().trim());
                return new TodoCommand(todo);
            case DEADLINE:
                if (inputArr.length == 1) {
                    throw new EmptyDescException("OOPS!!! The description of a deadline cannot be empty.");
                }
                for (int i = 1; i < inputArr.length; i++) {
                    if (inputArr[i].equals("/by")) {
                        desc = sb.toString();
                        sb.setLength(0);
                        continue;
                    }
                    sb.append(inputArr[i]);
                    if (i != inputArr.length - 1) {
                        sb.append(" ");
                    }
                }
                String[] dateTime = sb.toString().split(" ");
                assert !desc.isEmpty() : "desc (deadline description) should be filled, otherwise caught by exception";
                Deadline deadline = new Deadline(desc, dateTime[0], dateTime[1]);
                return new DeadlineCommand(deadline);
            case EVENT:
                if (inputArr.length == 1) {
                    throw new EmptyDescException("OOPS!!! The description of an event cannot be empty.");
                }
                String from = "local variable not initialised";
                for (int i = 1; i < inputArr.length; i++) {
                    if (inputArr[i].equals("/from")) {
                        desc = sb.toString();
                        sb.setLength(0);
                        continue;
                    } else if (inputArr[i].equals("/to")) {
                        from = sb.toString();
                        sb.setLength(0);
                        continue;
                    }
                    sb.append(inputArr[i]);
                    if (i != inputArr.length - 1) {
                        sb.append(" ");
                    }
                }
                assert !desc.isEmpty() : "desc (event description) should be filled, otherwise caught by exception";
                assert !from.isEmpty() : "from (event starting date) should be filled";
                Event event = new Event(desc, from, sb.toString().trim());
                return new EventCommand(event);
            case MARK:
                index = Integer.parseInt(inputArr[1]);
                return new MarkCommand(index);
            case UNMARK:
                index = Integer.parseInt(inputArr[1]);
                return new UnmarkCommand(index);
            case DELETE:
                index = Integer.parseInt(inputArr[1]);
                return new DeleteCommand(index);
            case LIST:
                return new ListCommand();
            case BYE:
                return new ByeCommand();
            case FIND:
                if (inputArr.length == 1) {
                    throw new EmptyDescException("OOPS!!! You need to specify what you want to find!");
                }
                return new FindCommand(inputArr[1]);
            case UNDO:
                if (inputArr.length == 1) {
                    throw new EmptyDescException("OOPS!!! Please specify how many CRUD versions you want to undo!");
                }
                int index = Integer.parseInt(inputArr[1]);
                return new UndoCommand(index);
            default:
                assert false; // Execution should never reach this point!
                throw new UnknownCommandException("OOPS!!! You need to give me an input :-(");
            }
        } catch (IllegalArgumentException e) {
            throw new UnknownCommandException("OOPS!!! I'm sorry, but I don't know what that means :-(");
        }

    }

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/lele/Lele.java lines 65-69:

    /**
     * The main method, initialises the program instance.
     *
     * @param args Takes in the command line argument.
     */

Example from src/main/java/lele/task/Deadline.java lines 43-47:

    /**
     * The date and time of the deadline, to be stored in the user's data.
     *
     * @return A string representation of the date and time of the deadline.
     */

Example from src/main/java/lele/task/Event.java lines 34-38:

    /**
     * The starting date and time of the event.
     *
     * @return String representation of the starting date and time set.
     */

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 (Subject Only)

possible problems in commit bdf730f:

Changed UG images folder name

  • 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

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.

Sharing iP code quality feedback [for @Douglch]

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

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/lele/storage/Storage.java lines 113-113:

        // System.out.println("entered update storage");

Example from src/main/java/lele/storage/Storage.java lines 121-121:

            // System.out.println("taskName: " + taskName);

Example from src/main/java/lele/task/TaskList.java lines 146-146:

        // assert list.contains(list.get(index - 1)) : "The task list should contain the task being marked.";

Suggestion: Remove dead code from the codebase.

Aspect: Method Length

Example from src/main/java/lele/parser/Parser.java lines 44-135:

    public static Command parse(String fullCommand) throws UnknownCommandException, EmptyDescException {
        try {
            String[] inputArr = fullCommand.split(" ");
            Commands command = Commands.valueOf(inputArr[0].toUpperCase());
            String desc = "variable not initialised";
            StringBuilder sb = new StringBuilder();
            switch (command) {
            case TODO:
                if (inputArr.length == 1) {
                    throw new EmptyDescException("OOPS!!! The description of a todo cannot be empty.");
                }
                for (int i = 1; i < inputArr.length; i++) {
                    sb.append(inputArr[i]);
                    if (i != inputArr.length - 1) {
                        sb.append(" ");
                    }
                }
                Todo todo = new Todo(sb.toString().trim());
                return new TodoCommand(todo);
            case DEADLINE:
                if (inputArr.length == 1) {
                    throw new EmptyDescException("OOPS!!! The description of a deadline cannot be empty.");
                }
                for (int i = 1; i < inputArr.length; i++) {
                    if (inputArr[i].equals("/by")) {
                        desc = sb.toString();
                        sb.setLength(0);
                        continue;
                    }
                    sb.append(inputArr[i]);
                    if (i != inputArr.length - 1) {
                        sb.append(" ");
                    }
                }
                String[] dateTime = sb.toString().split(" ");
                assert !desc.isEmpty() : "desc (deadline description) should be filled, otherwise caught by exception";
                Deadline deadline = new Deadline(desc, dateTime[0], dateTime[1]);
                return new DeadlineCommand(deadline);
            case EVENT:
                if (inputArr.length == 1) {
                    throw new EmptyDescException("OOPS!!! The description of an event cannot be empty.");
                }
                String from = "local variable not initialised";
                for (int i = 1; i < inputArr.length; i++) {
                    if (inputArr[i].equals("/from")) {
                        desc = sb.toString();
                        sb.setLength(0);
                        continue;
                    } else if (inputArr[i].equals("/to")) {
                        from = sb.toString();
                        sb.setLength(0);
                        continue;
                    }
                    sb.append(inputArr[i]);
                    if (i != inputArr.length - 1) {
                        sb.append(" ");
                    }
                }
                assert !desc.isEmpty() : "desc (event description) should be filled, otherwise caught by exception";
                assert !from.isEmpty() : "from (event starting date) should be filled";
                Event event = new Event(desc, from, sb.toString().trim());
                return new EventCommand(event);
            case MARK:
                index = Integer.parseInt(inputArr[1]);
                return new MarkCommand(index);
            case UNMARK:
                index = Integer.parseInt(inputArr[1]);
                return new UnmarkCommand(index);
            case DELETE:
                index = Integer.parseInt(inputArr[1]);
                return new DeleteCommand(index);
            case LIST:
                return new ListCommand();
            case BYE:
                return new ByeCommand();
            case FIND:
                if (inputArr.length == 1) {
                    throw new EmptyDescException("OOPS!!! You need to specify what you want to find!");
                }
                return new FindCommand(inputArr[1]);
            case UNDO:
                int index = Integer.parseInt(inputArr[1]);
                return new UndoCommand(index);
            default:
                assert false; // Execution should never reach this point!
                throw new UnknownCommandException("OOPS!!! You need to give me an input :-(");
            }
        } catch (IllegalArgumentException e) {
            throw new UnknownCommandException("OOPS!!! I'm sorry, but I don't know what that means :-(");
        }

    }

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/lele/Lele.java lines 39-43:

    /**
     * The function that handles the parsing, storage
     * and ui of Lele. Also handles the exceptions coming
     * from Command.
     */

Example from src/main/java/lele/Lele.java lines 65-70:

    /**
     * The main method. Initialises a Lele instance and
     * starts up the cogwheel.
     *
     * @param args Takes in the command line argument.
     */

Example from src/main/java/lele/task/Deadline.java lines 43-48:

    /**
     * The date and time of the deadline, to be
     * stored in the user's data.
     *
     * @return A string representation of the date and time of the deadline.
     */

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 (Subject Only)

possible problems in commit 15fc248:

Completed additional extension

  • Not in imperative mood (?)

possible problems in commit 248fefb:

Saving changes to remote

  • Not in imperative mood (?)

possible problems in commit f6a8e44:

Commented tests out

  • 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

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.

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.