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

imaginarys96 iP #73

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

Conversation

imaginarys96
Copy link

No description provided.

@@ -1,10 +1,11 @@
public class Task {
protected String description;
protected boolean isDone;

public Task(String description) {
protected String type;

Choose a reason for hiding this comment

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

type is ambiguous, can be mistaken as a verb, recommend to use taskType

}
System.out.println("____________________________________________________________");
} else if ( input.startsWith("mark ") ) {
} else if (input.startsWith("mark ")) {
String number = input.replace("mark ", "").trim();

Choose a reason for hiding this comment

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

number is ambiguous, recommend to use taskNumber

}
System.out.println("____________________________________________________________");
} else if ( input.startsWith("mark ") ) {
} else if (input.startsWith("mark ")) {
String number = input.replace("mark ", "").trim();
int markTaskNo = Integer.parseInt(number);

Choose a reason for hiding this comment

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

noun should not be named with a verb in it, recommend to combine with previous line and use taskNumber as previously mentioned

if( markTaskNo > 0 ) {
tasks[markTaskNo-1].markAsDone();
if (markTaskNo > 0) {
tasks[markTaskNo - 1].markAsDone();

Choose a reason for hiding this comment

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

using -1 magical number, would be good to define what the -1 means

System.out.println("____________________________________________________________");
} else if ( input.startsWith("unmark ") ) {
} else if (input.startsWith("unmark ")) {
String number = input.replace("unmark ", "").trim();
int unmarkTaskNo = Integer.parseInt(number);

Choose a reason for hiding this comment

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

variable name can be mistaken as an action, recommend to use unmarkedTaskNo

System.out.println( " [" + tasks[unmarkTaskNo-1].getStatusIcon() + "] " + tasks[unmarkTaskNo-1].getDescription() );
System.out.println(" [" + tasks[unmarkTaskNo - 1].getStatusIcon() + "] " + tasks[unmarkTaskNo - 1].getDescription());
System.out.println("____________________________________________________________");
} else if ( input.startsWith("todo") ) {

Choose a reason for hiding this comment

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

unnecessary spaces for start and ends of brackets

@@ -19,4 +20,6 @@ public void markAsUndone() {
this.isDone = false;
}

public String getTypeIcon() { return type; }

Choose a reason for hiding this comment

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

curly bracket should start on a newline

Copy link

@Musfirahe0556596 Musfirahe0556596 left a comment

Choose a reason for hiding this comment

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

Overall good job but some coding quality and standards to follow!

@@ -0,0 +1,128 @@
package chatbot;

import chatbot.*;

Choose a reason for hiding this comment

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

Imported classes should always be listed explicitly (avoid *)


public class Chatbot {

public static void main(String[] args) throws Exception {

Choose a reason for hiding this comment

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

Avoid long methods of more than 30 LoC

System.out.println("____________________________________________________________");
System.out.println(" Here are the tasks in your list:");
for (int i = 0; i < numOfTasks; i++) {
//System.out.println(" " + (i + 1) + ".[" + tasks[i].getTypeIcon() + "][" + tasks[i].getStatusIcon() + "] " + tasks[i].getDescription());

Choose a reason for hiding this comment

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

Remove commented code

System.out.println(" [" + tasks[unmarkedTaskNo - 1].getStatusIcon() + "] " + tasks[unmarkedTaskNo - 1].getDescription());
System.out.println("____________________________________________________________");
} else if (input.startsWith("todo")) {
String msg = input.replace("todo", "").trim();

Choose a reason for hiding this comment

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

Avoid foreign language words, slang, and names (msg)

System.out.println(" Now you have " + String.valueOf(numOfTasks) + " tasks in the list.");
System.out.println("____________________________________________________________");
} else if (input.startsWith("deadline")) {
String msg = input.replace("deadline", "").trim();

Choose a reason for hiding this comment

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

Avoid foreign language words, slang, and names (msg)

}

String byDate = msg.substring(msg.indexOf("/by ") + 4).trim(); // will contain the byDate
String desc = msg.substring(0, msg.indexOf("/by")); // will contain the deadline description

Choose a reason for hiding this comment

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

Avoid foreign language words, slang, and names (desc)

System.out.println(" Now you have " + String.valueOf(numOfTasks) + " tasks in the list.");
System.out.println("____________________________________________________________");
} else if (input.startsWith("event")) {
String msg = input.replace("event", "").trim();

Choose a reason for hiding this comment

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

Avoid foreign language words, slang, and names (msg)

String dateRange = msg.substring(msg.indexOf("/from ") + 6).trim();
String fromDate = dateRange.substring(0, dateRange.indexOf("/to ")).trim();
String toDate = dateRange.substring(dateRange.indexOf("/to ") + 4).trim();
String desc = msg.substring(0, msg.indexOf("/from ")); // will contain the deadline description

Choose a reason for hiding this comment

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

Avoid foreign language words, slang, and names (desc)

farissirraj pushed a commit to farissirraj/ip that referenced this pull request Sep 22, 2023
text-ui-test/runtest.bat|sh scripts generate a file ACTUAL.TXT.
However, .gitignore uses ACTUAL.txt, which means the generated
file will not be ignored by Git on non-Windows OS.

Let's update .gitignore as ACTUAL.txt -> ACTUAL.TXT
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.

4 participants