You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@potaotototo 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.
Suggestion: Follow the given naming convention for boolean variables/methods (e.g., use a boolean-sounding prefix).You may ignore the above if you think the name already follows the convention (the script can report false positives in some cases)
publicstaticCommandparse(StringfullCommand) throwsNoosyException {
String[] separated = fullCommand.split(" ", 2);
StringfirstWord = separated[0];
Stringinput = separated.length > 1 ? separated[1] : null;
switch (firstWord) {
case"bye":
returnnewExitCommand();
case"list":
returnnewListCommand();
case"mark":
if (input == null) {
thrownewNoosyException("Which task do you want to mark?");
}
returnnewMarkCommand(Integer.parseInt(input.trim()) - 1);
case"unmark":
if (input == null) {
thrownewNoosyException("Which task do you want to unmark?");
}
returnnewUnmarkCommand(Integer.parseInt(input.trim()) - 1);
case"delete":
if (input == null) {
thrownewNoosyException("Which task do you want to delete?");
}
returnnewDeleteCommand(Integer.parseInt(input.trim()) - 1);
case"find":
if (input == null) {
thrownewNoosyException("I can't see the keyword. Try typing it.");
}
returnnewFindCommand(input);
case"on":
if (input == null) {
thrownewNoosyException("You forgot the date! \n" +
"It should be formatted as: yyyy-MM-dd");
}
try {
LocalDatedate = LocalDate.parse(input, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
returnnewOnCommand(date);
} catch (DateTimeParseExceptione) {
thrownewNoosyException("Uh oh! Date should be in the format: yyyy-MM-dd");
}
case"todo":
if (input == null) {
thrownewNoosyException("Okay surezies but what do you want to do?");
}
returnnewAddCommand(newTodo(input));
case"deadline":
if (input == null) {
thrownewNoosyException("Okay surezies but what do you want to do?");
}
String[] withDue = input.split(" /by ");
if (withDue.length < 2) {
thrownewNoosyException("I think you forgot the deadline. \n" +
"Remember to type in the task and /by the deadline!");
}
try {
DateTimeFormatterformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDatedeadline = LocalDate.parse(withDue[1], formatter);
returnnewAddCommand(newDeadline(withDue[0], deadline));
} catch (DateTimeExceptione) {
thrownewNoosyException("The date should be formatted as: yyyy-MM-dd");
}
case"event":
if (input == null) {
thrownewNoosyException("Okay surezies but what do you want to do?");
}
String[] withDuration = input.split(" /from | /to ");
if (withDuration.length < 3) {
thrownewNoosyException("I think you forgot the duration. \n" +
"Remember to type in the task and /from the start /to the end!");
}
try {
DateTimeFormatterformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HHmm");
LocalDateTimefrom = LocalDateTime.parse(withDuration[1], formatter);
LocalDateTimeto = LocalDateTime.parse(withDuration[2], formatter);
returnnewAddCommand(newEvent(withDuration[0], from, to));
} catch (DateTimeExceptione) {
thrownewNoosyException("Date time format should be: yyyy-MM-dd HHmm");
}
default:
thrownewNoosyException("Beep Boop. Noosy is confused... \n" +
"Noosy only understands: \n" +
"list – listing your tasks \n" +
"mark i– mark task i as complete \n" +
"unmark i – unmark task i \n" +
"delete i – delete task i \n" +
"todo – add a task with no time associated \n" +
"deadline – add a task with a deadline \n" +
"event – add a task with duration \n" +
"on – check tasks on a certain date \n" +
"bye – say goodbye to Noosy \n");
}
}
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.
/** * The main entry point for the Noosy application. * Creates a new Noosy instance and starts its execution. * * @param args Command line arguments (not used). */
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
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.
The text was updated successfully, but these errors were encountered:
@potaotototo 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
Example from
src/main/java/noosy/commands/OnCommand.java
lines45-45
:Example from
src/main/java/noosy/task/Task.java
lines10-10
:Suggestion: Follow the given naming convention for boolean variables/methods (e.g., use a boolean-sounding prefix).You may ignore the above if you think the name already follows the convention (the script can report false positives in some cases)
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/noosy/gui/MainWindow.java
lines54-54
:// DialogBox.getNoosyDialog(welcome, noosyImage, );
Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from
src/main/java/noosy/parser/Parser.java
lines27-139
: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/noosy/Noosy.java
lines57-62
: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
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.The text was updated successfully, but these errors were encountered: