Giter VIP home page Giter VIP logo

ip's Introduction

  • ๐Ÿ‘‹ Hi there, I'm Farrel Dwireswara Salim, usually known as sugiyem in various platforms.
  • ๐ŸŒฑ I'm currently learning Computer Science and Mathematics at the National University of Singapore (NUS).
  • ๐Ÿ“ซ How to reach me: [email protected]

Top Langs

ip's People

Contributors

damithc avatar j-lum avatar jiachen247 avatar sugiyem avatar

ip's Issues

Sharing iP code quality feedback [for @sugiyem]

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

No easy-to-detect issues ๐Ÿ‘

Aspect: Method Length

Example from src/main/java/duke/parser/Parser.java lines 45-83:

    public Command parseText(String text) throws DukeException {
        List<String> commands = Arrays.stream(text.trim().split(" ", 2))
                .map(String::trim)
                .collect(Collectors.toList());

        String mainCommand = commands.get(0);
        String description = commands.size() > 1 ? commands.get(1) : "";

        if (mainCommand.equals("bye")) {
            this.isListening = false;
            return new ByeCommand();
        } else if (mainCommand.equals("list")) {
            return new ListCommand();
        } else if (mainCommand.equals("mark")) {
            return new MarkCommand(description);
        } else if (mainCommand.equals("unmark")) {
            return new UnmarkCommand(description);
        } else if (mainCommand.equals("delete")) {
            return new DeleteCommand(description);
        } else if (mainCommand.equals("todo")) {
            return new ToDoCommand(description);
        } else if (mainCommand.equals("deadline")) {
            return new DeadlineCommand(description);
        } else if (mainCommand.equals("event")) {
            return new EventCommand(description);
        } else if (mainCommand.equals("find")) {
            return new FindCommand(description);
        } else if (mainCommand.equals("at")) {
            return new AtCommand(description);
        } else if (mainCommand.equals("any")) {
            return new AnyCommand(description);
        } else if (mainCommand.equals("all")) {
            return new AllCommand(description);
        } else if (mainCommand.isEmpty()) {
            throw new EmptyCommandException();
        } else {
            throw new DukeException();
        }
    }

Example from src/main/java/duke/storage/Storage.java lines 61-111:

    public TaskList loadTasksInStorage() {
        TaskList loadedTaskList;

        try {
            List<Task> loadedTasks = new ArrayList<>();
            BufferedReader storageReader = new BufferedReader(new FileReader(this.filePath));
            String taskString = storageReader.readLine();

            while (taskString != null && !taskString.isEmpty()) {
                int dateSeparatorIndex = taskString.lastIndexOf("|");
                int tagsIndex = taskString.indexOf("#");

                String taskType = taskString.substring(0, 1);
                String taskStatus = taskString.substring(2, 3);
                String description = dateSeparatorIndex == 3
                        ? taskString.substring(4, tagsIndex)
                        : taskString.substring(4, dateSeparatorIndex);
                String taskDate = taskString.substring(dateSeparatorIndex + 1, tagsIndex);

                String[] tags;
                if (tagsIndex == taskString.length() - 1) {
                    tags = new String[0];
                } else {
                    tags = Arrays.stream(taskString.substring(tagsIndex + 1).split(","))
                            .map(String::trim)
                            .filter(text -> !text.isEmpty())
                            .toArray(String[]::new);
                }

                Task currentLoadedTask = taskType.equals("D")
                        ? new Deadline(description, taskDate, tags)
                        : taskType.equals("E")
                        ? new Event(description, taskDate, tags)
                        : new ToDo(description, tags);

                if (taskStatus.equals("X")) {
                    currentLoadedTask.markAsFinished();
                }

                loadedTasks.add(currentLoadedTask);
                taskString = storageReader.readLine();
            }

            storageReader.close();
            loadedTaskList = new TaskList(loadedTasks);
        } catch (DukeException | IOException error) {
            loadedTaskList = new TaskList();
        }

        return loadedTaskList;
    }

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

    /**
     * Save the list of string to Duke's storage.
     *
     * @param taskListString the list of string to be saved.
     * @throws DukeException If the storage fails to save the list of string.
     */

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 ๐Ÿ‘

โ„น๏ธ 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 @sugiyem] - Round 2

@sugiyem We did an automated analysis of your code to detect potential areas to improve the code quality. The script did not detect any issues in your code (nice!).

IMPORTANT: Note that the script looked for just a few easy-to-detect problems only 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

No easy-to-detect issues ๐Ÿ‘

Aspect: Recent Git Commit Message (Subject Only)

No easy-to-detect issues ๐Ÿ‘

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.