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
@Acerizm 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)
publicStringconvertToUserInput(String[] input, TypeOfTaskaction, Stringlimiter) throwsDukeException {
switch(action) {
casefind: {
StringuserInput = String.join(" ", Arrays.copyOfRange(input, 0, input.length));
if (userInput.equals("") || userInput == null) {
thrownewDukeException(TypeOfTask.find, 0);
} else {
returnuserInput;
}
}
casetodo: {
// changed the way the string is outputted from the arrayStringuserInput = String.join(" ", Arrays.copyOfRange(input, 0, input.length));
if (userInput.equals("") || userInput == null) {
thrownewDukeException(TypeOfTask.todo, 0);
} else {
returnuserInput;
}
}
casedeadline: { // added braces to scope the variables below locally to each case// algo to detect deadline's input contentStringuserInput = "";
if (!limiter.equals("/by")) {
for (inti = 0; i < input.length; i++) {
if (input[i].equals("/by")) {
break;
} else {
userInput += input[i] + " ";
}
}
} else {
// to get the date and time after "/by"for (inti = 0; i < input.length; i++) {
if (input[i].equals("/by")) {
for (intj = i + 1; j < input.length; j++) {
userInput += input[j] + " ";
}
break;
}
}
}
if (userInput.equals("") || userInput == null) {
thrownewDukeException(TypeOfTask.deadline, 0);
} else {
returnuserInput;
}
}
caseevent: {
StringuserInput = "";
if (limiter.equals("/from")) {
for (inti = 0; i < input.length; i++) {
if (input[i].equals("/from")) {
for (intj = i + 1; j < input.length; j++) {
if (input[j].equals("/to")) {
break;
} else {
userInput += input[j] + " ";
}
}
break;
}
}
} elseif (limiter.equals("/to")) {
for (inti = 0; i < input.length; i++) {
if (input[i].equals("/to")) {
for (intj = i + 1; j < input.length; j++) {
userInput += input[j] + " ";
}
break;
}
}
} else {
// to get the user's input before the "/from" limiterfor (inti = 0; i < input.length; i++) {
if (input[i].equals("/from")) {
break;
} else {
userInput += input[i] + " ";
}
}
}
if (userInput.equals("") || userInput == null) {
thrownewDukeException(TypeOfTask.event, 0);
} else {
returnuserInput;
}
}
casedelete: {
if (input.length == 0) {
thrownewDukeException(TypeOfTask.delete, 0);
} elseif (input.length > 1) {
thrownewDukeException(TypeOfTask.delete, 1);
} else {
returninput[0];
}
}
default:
thrownewDukeException();
}
}
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.
/** * Abstract method that allows commands to process the inputs from the user * @param taskList List of tasks * @param ui Ui object * @param storage Storage object * @throws DukeException When execute() fails due to errors during run time */
Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.
Suggestion: Avoid committing binary files (e.g., *.class, *.jar, *.exe) or third-party library files in to the repo.
ℹ️ 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:
@Acerizm 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/duke/command/Command.java
lines19-19
: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/duke/Duke.java
lines77-77
://return "Duke heard: " + input;
Example from
src/main/java/duke/action/Deadline.java
lines55-55
://return "[D]" + super.getDescription() + " (by: " + this.day + ")";
Example from
src/main/java/duke/command/DeleteCommand.java
lines33-33
://System.out.println("Noted! I've removed this task:");
Suggestion: Remove dead code from the codebase.
Aspect: Method Length
Example from
src/main/java/duke/exception/DukeException.java
lines21-139
:Example from
src/main/java/duke/parser/Parser.java
lines45-145
: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/Duke.java
lines63-67
:Example from
src/main/java/duke/Duke.java
lines71-74
:Example from
src/main/java/duke/command/Command.java
lines48-54
: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
docs\member-search-index.zip
docs\package-search-index.zip
docs\type-search-index.zip
Suggestion: Avoid committing binary files (e.g.,
*.class
,*.jar
,*.exe
) or third-party library files in to the repo.ℹ️ 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: