Giter Site home page Giter Site logo

ip's Introduction

Hello!! ๐Ÿง

ip's People

Contributors

damithc avatar j-lum avatar jessicajacelyn avatar jiachen247 avatar

ip's Issues

Sharing iP code quality feedback [for @jessicajacelyn]

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

Example from src/main/java/duke/Storage.java lines 81-82:

            }
            else {

Suggestion: As specified by the coding standard, use egyptian style braces.

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/Deadline.java lines 30-30:

//    public String toString() {

Example from src/main/java/duke/Deadline.java lines 31-31:

//        return "[D]" + super.toString() + " (by: " + by + ")";

Example from src/main/java/duke/Deadline.java lines 32-32:

//    }

Suggestion: Remove dead code from the codebase.

Aspect: Method Length

Example from src/main/java/duke/Duke.java lines 39-127:

    public void start(Stage stage) throws IOException {

        storage = new Storage("data/duke.txt");
        assert storage != null;
        tasks = new TaskList(storage.load(), storage.getNumberOfTasks());


        //Step 1. Formatting the window to look as expected.

        //The container for the content of the chat to scroll.
        scrollPane = new ScrollPane();
        dialogContainer = new VBox();
        scrollPane.setContent(dialogContainer);

        userInput = new TextField();
        sendButton = new Button("Send");

        AnchorPane mainLayout = new AnchorPane();
        mainLayout.getChildren().addAll(scrollPane, userInput, sendButton);

        scene = new Scene(mainLayout);

        stage.setScene(scene);
        stage.show();

        //Step 2. Formatting the window to look as expected
        stage.setTitle("Duke");
        stage.setResizable(false);
        stage.setMinHeight(600.0);
        stage.setMinWidth(400.0);

        mainLayout.setPrefSize(400.0, 600.0);

        scrollPane.setPrefSize(385, 535);
        scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
        scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);

        scrollPane.setVvalue(1.0);
        scrollPane.setFitToWidth(true);

        // You will need to import `javafx.scene.layout.Region` for this.
        dialogContainer.setPrefHeight(Region.USE_COMPUTED_SIZE);

        userInput.setPrefWidth(325.0);

        sendButton.setPrefWidth(55.0);

        AnchorPane.setTopAnchor(scrollPane, 1.0);

        AnchorPane.setBottomAnchor(sendButton, 1.0);
        AnchorPane.setRightAnchor(sendButton, 1.0);

        AnchorPane.setLeftAnchor(userInput , 1.0);
        AnchorPane.setBottomAnchor(userInput, 1.0);

        //Step 3. Add functionality to handle user input.
        sendButton.setOnMouseClicked((event) -> {
            dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
            userInput.clear();
        });

        userInput.setOnAction((event) -> {
            dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
            userInput.clear();
        });


        //Scroll down to the end every time dialogContainer's height changes.
        dialogContainer.heightProperty().addListener((observable) -> scrollPane.setVvalue(1.0));

        //Part 3. Add functionality to handle user input.
        sendButton.setOnMouseClicked((event) -> {
            try {
                handleUserInput();
            } catch (IOException e) {
                e.printStackTrace();
            }
        });

        userInput.setOnAction((event) -> {
            try {
                handleUserInput();
            } catch (IOException e) {
                e.printStackTrace();
            }
        });

        // more code to be added here later
    }

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

    public String getResponse() throws IOException {
            StringBuilder sb = new StringBuilder();

//         "bye" to end the program
            switch (words[0]) {
            case "bye" -> System.out.println("    Bye!! See you again soon!!");

            // if user requests to list their tasks
            case "list" -> {
                sb = new StringBuilder();

                sb.append("    Here are the tasks in your lists:");
                int n = 1;
                for (int i = 0; i < tasks.getNumberOfTasks(); i++) {
                    Task t = tasks.get(i);
                    String by = "";
                    if (t.getType().equals("D") || t.getType().equals("E"))
                        by = t.getBy().format(DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM));
                    sb.append("    ").append(n).append(". [").append(t.getType()).append("][").append(t.getDone()).append("] ").append(t.desc).append(by).append("\n");
                    n++;
                }
                return sb.toString();
            }
            case "mark" -> {
                wf.flush(); // need to flush first cause updates were stored in buffer
                int n = Integer.parseInt(words[1]) - 1;
                assert n <= tasks.getNumberOfTasks();
                tasks.set(n, tasks.get(n).mark());
                Task temp = tasks.get(n);
                if (!(temp instanceof ToDo)) {
                    String date = temp.getBy().format(DateTimeFormatter.ofPattern("dd-MM-yyyy HHmm"));
                    tasks.updateTask(n + 1, tasks.get(n).type + " 1 " + tasks.get(n).desc + " | " + date);

                } else
                    tasks.updateTask(n + 1, tasks.get(n).type + " 1 " + tasks.get(n).desc);

                return "    Alright! I've marked this as done:\n      [" + temp.getDone() + "] " + temp.desc;
            }
            case "unmark" -> {
                wf.flush(); // need to flush first cause updates were stored in buffer
                int n = Integer.parseInt(words[1]) - 1;
                assert n <= tasks.getNumberOfTasks();
                tasks.set(n, tasks.get(n).unmark());
                Task temp = tasks.get(n);
                if (!(temp instanceof ToDo)) {
                    String date = temp.getBy().format(DateTimeFormatter.ofPattern("dd-MM-yyyy HHmm"));
                    tasks.updateTask(n + 1, tasks.get(n).type + " 0 " + tasks.get(n).desc + " | " + date);
                } else
                    tasks.updateTask(n + 1, tasks.get(n).type + " 0 " + tasks.get(n).desc);

                return
                        "    Alright! I've marked this as not done:\n      [" + temp.getDone() + "] " + temp.desc;
            }
            case "delete" -> {
                wf.flush(); // need to flush first cause updates were stored in buffer
                int n = Integer.parseInt(words[1]) - 1; // the task number to be deleted
                assert n <= tasks.getNumberOfTasks();
                Task t = tasks.get(n);
                tasks.remove(n);
                tasks.deleteTask(n + 1);
                String by = "";
                if (t.getBy() != null) {
                    by = t.getBy().format(DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM));

                }
                return"    Alright! This task has been deleted:\n      [" + t.getType() + "]["
                        + t.getDone() + "] " + t.desc + by;

            }
            case "find" -> {
                wf.flush(); // need to flush first cause updates were stored in buffer
                String key = words[1]; // keyword to be found
                int[] ind = new int[tasks.getNumberOfTasks()]; // indexes of task with keyword
                int noOfMatched = 0;
                for (int i = 0; i < tasks.getNumberOfTasks(); i++) {
                    String[] split = tasks.get(i).desc.split(" ");

                    for(String s : split) {
                        if(s.equals(key)) {
                            ind[noOfMatched] = i;
                            noOfMatched++;
                            break;
                        }
                    }
                }
                sb = new StringBuilder();
                sb.append("    Here are the matching tasks in your list:\n");
                for(int i = 0; i < noOfMatched; i++) {
                    Task t = tasks.get(ind[i]);
                    String by = "";
                    if (t.getType().equals("D") || t.getType().equals("E"))
                        by = t.getBy().format(DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM));
                    sb.append("    ").append(i).append(1).append(". [").append(t.getType()).append("][").append(t.getDone()).append("] ").append(t.desc).append(by).append("\n");
                    return sb.toString();
                }
            }

            // user add a todo task
            case "todo" -> {
                words = command.split(" ", 2);
                if (words.length < 2) {
                    return "    Oops!! Description of ToDo can't be empty!!\n ";
                } else {
                    sb = new StringBuilder();
                    sb.append("    Okay! I've added this task:\n");
                    tasks.add(new ToDo(words[1]));
                    sb.append("      [T][ ] ").append(words[1]);
                    wf.println("T 0 " + words[1]);
                    sb.append("\n    Now you have ").append(tasks.getNumberOfTasks()).append(" tasks on your list");
                    return sb.toString();
                }
            }
            // user add a event task
            case "event" -> {
                sb = new StringBuilder();
                words = findDate(command.split(" "));
                sb.append("    Okay! I've added this task into the list:\n  ");
                tasks.add(new Event(words[0], LocalDateTime.parse(words[1], formatter)));
                sb.append("      [E][ ] ").append(words[0]);
                wf.println("E 0 " + words[0] + " | " + words[1]);
                sb.append("\n    Now you have ").append(tasks.getNumberOfTasks()).append(" tasks on your list");
                return sb.toString();
            }
            // user add a deadline task
            case "deadline" -> {
                sb = new StringBuilder();
                words = findDate(command.split(" "));
                sb.append("    Okay! I've added this task:\n  ");
                tasks.add(new Deadline(words[0], LocalDateTime.parse(words[1], formatter)));
                sb.append("      [D][ ] ").append(words[0]);
                wf.println("D 0 " + words[0] + " | " + words[1]);
                sb.append("\n    Now you have ").append(tasks.getNumberOfTasks()).append(" tasks on your list");
                return sb.toString();

            }
            // user add items to list
                default -> {
                    return sb.toString();

                }
            }
        wf.close();
        return  "    Sorry! I don't know what that means :'(";
    }

Example from src/main/java/duke/Storage.java lines 42-100:

    public ArrayList<Task> load() throws IOException {
        BufferedReader readFile
                = new BufferedReader(new FileReader(this.file));
        ArrayList<Task> tasks = new ArrayList<>();
        StringBuilder sb;
        String line = "";

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HHmm");

        while((line = readFile.readLine()) != null) {
            items++;
            String[] words = line.split(" ");
            String type = words[0];

            // check whether the task is marked
            boolean isDone = !words[1].equals("0");

            if(words[0].equals("T")) {
                sb = new StringBuilder();
                for(int i = 2; i < words.length; i++) {
                    sb.append(words[i]).append(" "); // get the description
                }
                tasks.add(new ToDo(sb.toString(), isDone));
            }
            else if(words[0].equals("D")) {
                sb = new StringBuilder();
                int count = 2;
                for(int i = 2; i < words.length; i++) {
                    count++;
                    if(words[i].equals("|"))
                        break;
                    sb.append(words[i]).append(" "); // get the description
                }
                String description = sb.toString();
                sb = new StringBuilder();

                sb.append(words[count]).append(" ");
                sb.append(words[count+1]);
                tasks.add(new Deadline(description, LocalDateTime.parse(sb.toString(), formatter), isDone));
            }
            else {
                sb = new StringBuilder();
                int count = 2;
                for(int i = 2; i < words.length; i++) {
                    count++;
                    if(words[i].equals("|"))
                        break;
                    sb.append(words[i]).append(" "); // get the description
                }
                String description = sb.toString();
                sb = new StringBuilder();

                sb.append(words[count]).append(" ");
                sb.append(words[count+1]);
                tasks.add(new Event(description, LocalDateTime.parse(sb.toString(), formatter), isDone));
            }
        }
        return tasks;
    }

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

Example from src/main/java/duke/Duke.java lines 129-134:

    /**
     * Iteration 1:
     * Creates a label with the specified text and adds it to the dialog container.
     * @param text String containing text to add
     * @return a label with the specified text that has word wrap enabled.
     */

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

    /**
     * Iteration 2:
     * Creates two dialog boxes, one echoing user input and the other containing Duke's reply and then appends them to
     * the dialog container. Clears the user input after processing.
     */

Example from src/main/java/duke/Duke.java lines 158-161:

    /**
     * You should have your own function to generate a response to user input.
     * Replace this stub with your completed method.
     */

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 32a3a7a:

Merge remote-tracking branch 'origin/add-gradle-support' into branch-Gradle

  • Longer than 72 characters

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 @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 @jessicajacelyn] - Round 2

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

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

                    }
                    else {

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

                    }
                    else {

Example from src/main/java/duke/Storage.java lines 95-96:

            }
            else {

Suggestion: As specified by the coding standard, use egyptian style braces.

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/DialogBox.java lines 43-43:

//        setHgrow(dialog, Priority.ALWAYS);

Example from src/main/java/duke/DialogBox.java lines 44-44:

//        BackgroundFill bf = new BackgroundFill(Color.web("#e8a7a7"), new CornerRadii(90), null);

Example from src/main/java/duke/DialogBox.java lines 45-45:

//        hBox.setBackground(new Background(bf));

Suggestion: Remove dead code from the codebase.

Aspect: Method Length

Example from src/main/java/duke/Duke.java lines 41-124:

    public void start(Stage stage) throws IOException {



        //Step 1. Formatting the window to look as expected.

        //The container for the content of the chat to scroll.
        scrollPane = new ScrollPane();
        dialogContainer = new VBox();
        scrollPane.setContent(dialogContainer);

        userInput = new TextField();
        sendButton = new Button("Send");

        AnchorPane mainLayout = new AnchorPane();
        mainLayout.getChildren().addAll(scrollPane, userInput, sendButton);

        scene = new Scene(mainLayout);

        stage.setScene(scene);
        stage.show();

        //Step 2. Formatting the window to look as expected
        stage.setTitle("Duke");
        stage.setResizable(false);
        stage.setMinHeight(600.0);
        stage.setMinWidth(400.0);

        mainLayout.setPrefSize(400.0, 600.0);

        scrollPane.setPrefSize(385, 535);
        scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
        scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);

        scrollPane.setVvalue(1.0);
        scrollPane.setFitToWidth(true);

        // You will need to import `javafx.scene.layout.Region` for this.
        dialogContainer.setPrefHeight(Region.USE_COMPUTED_SIZE);

        userInput.setPrefWidth(325.0);

        sendButton.setPrefWidth(55.0);

        AnchorPane.setTopAnchor(scrollPane, 1.0);

        AnchorPane.setBottomAnchor(sendButton, 1.0);
        AnchorPane.setRightAnchor(sendButton, 1.0);

        AnchorPane.setLeftAnchor(userInput , 1.0);
        AnchorPane.setBottomAnchor(userInput, 1.0);

        //Step 3. Add functionality to handle user input.
        sendButton.setOnMouseClicked((event) -> {
            dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
            userInput.clear();
        });

        userInput.setOnAction((event) -> {
            dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
            userInput.clear();
        });


        //Scroll down to the end every time dialogContainer's height changes.
        dialogContainer.heightProperty().addListener((observable) -> scrollPane.setVvalue(1.0));

        //Part 3. Add functionality to handle user input.
        sendButton.setOnMouseClicked((event) -> {
            try {
                handleUserInput();
            } catch (IOException e) {
                e.printStackTrace();
            }
        });

        userInput.setOnAction((event) -> {
            try {
                handleUserInput();
            } catch (IOException e) {
                e.printStackTrace();
            }
        });
    }

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

    public String getResponse() throws IOException {
            StringBuilder sb = new StringBuilder();
            FileWriter fw = new FileWriter(storage.getPath(), true);
            PrintWriter wf = new PrintWriter(fw);
            switch (words[0]) {
                case "list" -> {
                wf.flush();
                sb = new StringBuilder();
                sb.append("    Here are the tasks on your list:\n");
                int n = 1;
                for (int i = 0; i < tasks.getNumberOfTasks(); i++) {
                    Task t = tasks.get(i);
                    String by = "";
                    if (t.getType().equals("D") || t.getType().equals("E")) {
                        by = dateTimeFormatter(t.getBy());
                        sb.append(n).append(". [").append(t.getType()).append("][").append(t.getDone()).append("] ").append(t.desc).append("on " ).append(by).append("\n");
                    }
                    else {
                        sb.append(n).append(". [").append(t.getType()).append("][").append(t.getDone()).append("] ").append(t.desc).append("\n");
                    }
                    n++;
                }
                return sb.toString();
            }
            case "mark" -> {
                wf.flush();
                int n = Integer.parseInt(words[1]) - 1;
                assert n <= tasks.getNumberOfTasks();
                tasks.set(n, tasks.get(n).mark());
                Task temp = tasks.get(n);
                if (!(temp instanceof ToDo)) {
                    String date = temp.getBy().format(DateTimeFormatter.ofPattern("dd-MM-yyyy HHmm"));
                    tasks.updateTask(n + 1, tasks.get(n).type + " 1 " + tasks.get(n).desc + " | " + date);

                } else
                    tasks.updateTask(n + 1, tasks.get(n).type + " 1 " + tasks.get(n).desc);

                return "Alright! I've marked this as done:\n      [" + temp.getDone() + "] " + temp.desc;
            }
            case "unmark" -> {
                wf.flush();
                int n = Integer.parseInt(words[1]) - 1;
                assert n <= tasks.getNumberOfTasks();
                tasks.set(n, tasks.get(n).unmark());
                Task temp = tasks.get(n);
                if (!(temp instanceof ToDo)) {
                    LocalDateTime dateTime = temp.getBy();
                    String date = dateTime.format(DateTimeFormatter.ofPattern("dd-MM-yyyy HHmm"));
                    tasks.updateTask(n + 1, tasks.get(n).type + " 0 " + tasks.get(n).desc + " | " + date);
                } else
                    tasks.updateTask(n + 1, tasks.get(n).type + " 0 " + tasks.get(n).desc);

                return
                        "Alright! I've marked this as not done:\n      [" + temp.getDone() + "] " + temp.desc;
            }
            case "delete" -> {
                wf.flush();
                int n = Integer.parseInt(words[1]) - 1; // task number to be deleted
                assert n <= tasks.getNumberOfTasks();
                Task t = tasks.get(n);
                tasks.remove(n);
                tasks.deleteTask(n + 1);

                String by = "";
                if (t.getBy() != null) {
                    by = dateTimeFormatter(t.getBy());
                }
                return "Alright! This task has been deleted:\n      [" + t.getType() + "]["
                        + t.getDone() + "] " + t.desc + by;

            }
            case "today" -> {
                wf.flush();
                int noOfMatched = 0;
                int dayOfYear = LocalDateTime.now().getDayOfYear();

                int[] ind = new int[tasks.getNumberOfTasks()]; // indexes of task with keyword
                for (int i = 0; i < tasks.getNumberOfTasks(); i++) {
                    if (!(tasks.get(i) instanceof ToDo)) {
                        LocalDateTime date = tasks.get(i).getBy();
                        if (dayOfYear == date.getDayOfYear()) {
                            ind[noOfMatched] = i;
                            noOfMatched++;
                        }
                    }
                }
                sb = new StringBuilder();
                sb.append("Here are the tasks you have today:\n");
                for(int i = 0; i < noOfMatched; i++) {
                    Task t = tasks.get(ind[i]);
                    String by = "";
                    by = dateTimeFormatter(t.getBy());
                    sb.append(i+1).append(". [").append(t.getType()).append("][").append(t.getDone()).append("] ").append(t.desc).append("on " ).append(by).append("\n");
                }
                return sb.toString();
            }


            case "find" -> {
                wf.flush();
                String key = words[1]; // keyword to be found
                int[] ind = new int[tasks.getNumberOfTasks()]; // indexes of task with keyword
                int noOfMatched = 0;
                for (int i = 0; i < tasks.getNumberOfTasks(); i++) {
                    String[] split = tasks.get(i).desc.split(" ");
                    for(String s : split) {
                        if(s.equals(key)) {
                            ind[noOfMatched] = i;
                            noOfMatched++;
                            break;
                        }
                    }
                }
                sb = new StringBuilder();
                sb.append("    Here are the matching tasks on your list:\n");
                for(int i = 0; i < noOfMatched; i++) {
                    Task t = tasks.get(ind[i]);
                    String by = "";
                    if (t.getType().equals("D") || t.getType().equals("E")) {
                        by = dateTimeFormatter(t.getBy());
                        sb.append(i+1).append(". [").append(t.getType()).append("][").append(t.getDone()).append("] ").append(t.desc).append("on " ).append(by).append("\n");
                    }
                    else {
                        sb.append(i+1).append(". [").append(t.getType()).append("][").append(t.getDone()).append("] ").append(t.desc).append("\n");
                    }
                }
                return sb.toString();
            }
            case "todo" -> {
                words = command.split(" ", 2);
                if (words.length < 2) {
                    return "Oops!! Description of ToDo can't be empty!!\n ";
                } else {
                    sb = new StringBuilder();
                    sb.append("Okay! I've added this task:\n");
                    tasks.add(new ToDo(words[1]));
                    sb.append("      [T][ ] ").append(words[1]);
                    wf.println("T 0 " + words[1]);
                    wf.close();
                    sb.append("\nNow you have ").append(tasks.getNumberOfTasks()).append(" tasks on your list");
                    return sb.toString();
                }
            }
            case "event" -> {
                sb = new StringBuilder();
                words = findDate(command.split(" "));
                sb.append("Okay! I've added this task into the list:\n  ");
                tasks.add(new Event(words[0], LocalDateTime.parse(words[1], formatter)));
                sb.append("      [E][ ] ").append(words[0]);
                wf.println("E 0 " + words[0] + " | " + words[1]);
                wf.close();
                sb.append("\nNow you have ").append(tasks.getNumberOfTasks()).append(" tasks on your list");
                return sb.toString();
            }
            // user add a deadline task
            case "deadline" -> {
                sb = new StringBuilder();
                words = findDate(command.split(" "));
                sb.append("    Okay! I've added this task:\n  ");
                tasks.add(new Deadline(words[0], LocalDateTime.parse(words[1], formatter)));
                sb.append("      [D][ ] ").append(words[0]);
                wf.println("D 0 " + words[0] + " | " + words[1]);
                wf.close();
                sb.append("\nNow you have ").append(tasks.getNumberOfTasks()).append(" tasks on your list");
                return sb.toString();
            }
                default -> {
                    return "Sorry! I don't know what that means :'(";
                }
            }
    }

Example from src/main/java/duke/Storage.java lines 56-114:

    public ArrayList<Task> load() throws IOException {
        BufferedReader readFile
                = new BufferedReader(new FileReader(this.file));
        ArrayList<Task> tasks = new ArrayList<>();
        StringBuilder sb;
        String line = "";

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HHmm");

        while((line = readFile.readLine()) != null) {
            items++;
            String[] words = line.split(" ");
            String type = words[0];

            // check whether the task is marked
            boolean isDone = !words[1].equals("0");

            if(words[0].equals("T")) {
                sb = new StringBuilder();
                for(int i = 2; i < words.length; i++) {
                    sb.append(words[i]).append(" "); // get the description
                }
                tasks.add(new ToDo(sb.toString(), isDone));
            }
            else if(words[0].equals("D")) {
                sb = new StringBuilder();
                int count = 2;
                for(int i = 2; i < words.length; i++) {
                    count++;
                    if(words[i].equals("|"))
                        break;
                    sb.append(words[i]).append(" "); // get the description
                }
                String description = sb.toString();
                sb = new StringBuilder();

                sb.append(words[count]).append(" ");
                sb.append(words[count+1]);
                tasks.add(new Deadline(description, LocalDateTime.parse(sb.toString(), formatter), isDone));
            }
            else {
                sb = new StringBuilder();
                int count = 2;
                for(int i = 2; i < words.length; i++) {
                    count++;
                    if(words[i].equals("|"))
                        break;
                    sb.append(words[i]).append(" ");
                }
                String description = sb.toString();
                sb = new StringBuilder();

                sb.append(words[count]).append(" ");
                sb.append(words[count+1]);
                tasks.add(new Event(description, LocalDateTime.parse(sb.toString(), formatter), isDone));
            }
        }
        return tasks;
    }

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

Example from src/main/java/duke/Storage.java lines 50-55:

    /**
     * Load tasks that is stored in the file
     * and returns it in ArrayList
     *
     * @return ArrayList of Task
     */

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

    /**
     * Method to update the task in the file
     * if changes were made by the user.
     *
     * @param lineNumber  The line in the file to be updated.
     * @param data    New string to replace the old one.
     */

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

    /**
     * Method to delete a line in the file.
     *
     * @param lineNumber  The line in the file to be deleted.
     */

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)

No easy-to-detect issues ๐Ÿ‘

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.