Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hyizhak] iP #448

Open
wants to merge 60 commits into
base: master
Choose a base branch
from
Open

[hyizhak] iP #448

wants to merge 60 commits into from

Conversation

hyizhak
Copy link

@hyizhak hyizhak commented Feb 3, 2025

Bard (iP) Update

“Your mind is for having ideas, not holding them.” – David Allen

Bard (iP) frees your mind from the burden of memorization. It's:

  • Text-based
  • Easy to learn
  • Fast SUPER FAST to use

Here are some steps to get started:

  1. Download the latest release.
  2. Copy the jar file into an empty folder. Open a command window in that folder.
  3. Run the command
java -jar "bard.jar"
  1. Add your tasks.
  2. Let Bard manage them for you 😉

Features

  • Managing tasks
  • Managing deadlines and events
  • Reminders (coming soon)

If you are a Java programmer, you can use Bard to practice Java too. Here’s the main method for reference:

public class Bard {
    public static void main(String[] args) {
        Bard bard = new Bard();
        bard.run();
    }
}

damithc and others added 14 commits July 11, 2024 16:52
In build.gradle, the dependencies on distZip and/or distTar causes
the shadowJar task to generate a second JAR file for which the
mainClass.set("seedu.duke.Duke") does not take effect.
Hence, this additional JAR file cannot be run.
For this product, there is no need to generate a second JAR file
to begin with.

Let's remove this dependency from the build.gradle to prevent the
shadowJar task from generating the extra JAR file.
Merge Level-7 Save Branch to the master
Copy link

@TanJieHaoAmos TanJieHaoAmos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just missing the packages for the classes as well as the javadocs. Code looks clean.

public static void main(String[] args){
Bard bard = new Bard();
bard.run();
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No JavaDocs written for the methods and the class

@@ -0,0 +1,10 @@
public class BardException extends Exception {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, no JavaDocs written for this class.

@@ -0,0 +1,164 @@
import java.time.LocalDate;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,10 @@
public class BardException extends Exception {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,83 @@
import java.io.File;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public String toFileString() {
return "E | " + super.toFileString() + " | " + from + "-" + to;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing JavaDocs for the class and its methods.

@@ -0,0 +1,31 @@
public class Task {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


public Task(String description) {
this.description = description;
this.isDone = false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing JavaDocs for the class and its methods.

@@ -0,0 +1,18 @@
public class Todo extends Task {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public String toFileString() {
return "T | " + super.toFileString();
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing JavaDocs for the class and its methods.

Copy link

@Zonnie-23 Zonnie-23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, in terms of coding syntax, it is mostly compliant. The only missing things are the javaDoc and the packaging of the classes. Code is easily understandable, although packaging it into packages would make it easier to understand how the various function interact.

case "fri", "friday" -> DayOfWeek.FRIDAY;
case "sat", "saturday" -> DayOfWeek.SATURDAY;
case "sun", "sunday" -> DayOfWeek.SUNDAY;
default -> throw new IllegalArgumentException("Invalid day: " + day);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting use of switch case to directly return the right enum variable . The formatting looks correct

tasks.remove(taskNumber - 1);
System.out.println(" Now you have " + tasks.size()
+ " tasks in the list." + "\n" + horizontalLine);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to package all functions above in a command package/parser package

…function from Text UI

- Added assertions in the command parser to validate critical assumptions before executing commands.
- Integrated assertions in the main program to ensure that key invariants are maintained.
- Implemented the exit function from the Text UI, allowing for a controlled shutdown of the application.

These changes enhance the overall robustness and reliability of the application, ensuring that failures in critical areas are caught early and the exit behavior is clearly defined.
- Refactored the command parser's createTask method:
  - Replaced the if-else chain with a switch statement for better clarity.
  - Introduced guard clauses and input trimming to validate command inputs early.
  - Improved error handling by throwing descriptive exceptions for missing or malformed arguments.

- Refactored the DateParser class:
  - Consolidated time parsing logic to avoid redundancy and improve maintainability.
  - Enhanced input validation and error messaging for both date and day formats.
  - Added a private constructor to enforce the utility class pattern.

These improvements result in more robust, readable, and maintainable parsing logic across the application.
- Replaced switch statement in CommandParser.parse with enhanced switch
feat: Add assertions in command parser and main program; set up exit function from Text UI
- Merged latest changes from master into the PR branch.
- Manually resolved conflicts in src/main/java/bard/parser/CommandParser.java by integrating modifications from both branches.
- Ensured that command parsing logic remains consistent and all tests pass post-resolution.
- Cleaned up redundant code and aligned with upstream changes to maintain feature integrity.
- Added a new workflow file ("Java CI") to automatically build and test the project on push and pull_request events.
- Configured a build matrix to run on ubuntu-latest, macos-latest, and windows-latest for broad platform coverage.
- Included steps to:
  - Check out the repository (with a specific checkout for the master branch).
  - Merge the current commit using a forceful checkout.
  - Validate the Gradle Wrapper via the gradle/wrapper-validation-action.
  - Set up JDK 17 with JavaFX support using actions/setup-java.
  - Build the project and run tests using './gradlew check'.
  - Execute IO redirection tests on Linux, macOS, and Windows with respective scripts.

These changes ensure consistent, automated testing and build verification across multiple operating systems.
CI: set up cross-platform Java CI pipeline with GitHub Actions
- Added comprehensive Javadoc comments to public classes and methods across the project (e.g., TaskList, CommandParser, DateParser, etc.).
- Reorganized import orders and adjusted whitespace to address Checkstyle violations.
- Ran Spotless to auto-apply formatting fixes, ensuring that the code conforms to our style rules.

These changes enhance code readability, documentation quality, and maintain consistent style throughout the codebase.
Add required JavaDoc so the code can pass CI
- Implemented a new compareTo method for tasks:
  - Incomplete tasks are prioritized over completed ones.
  - Deadline tasks are sorted based on their 'by' time.
  - Event tasks are sorted based on their 'from' time.
- Ensured tasks marked as done always appear at the bottom.
- Integrated the updated sorting logic into the chatbot functionality to enhance task management.

This update improves task prioritization and overall user experience within the chatbot.
feat: Add task sorting and integrate into chatbot functionality
Add more JUnit testing for Task class
Modify the styling css to highlight errors
Adjust the logic of storage-related exception
Add the user guide in readme.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants