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
@shizy 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.
publicStringsort(SortOrderorder) {
if (order == SortOrder.ASC) {
this.tasks.sort((t1, t2) -> {
if ((t1instanceofTimeTasknewT1) && (t2instanceofTimeTasknewT2)) {
if (newT2.getTime().isBefore(newT1.getTime())) {
return1; // move t2 up in the list
} elseif (newT1.getTime().isBefore(newT2.getTime())) {
return -1; // move t1 up in the list
} else {
return0; // order can stay the same
}
} elseif (t1instanceofTimeTask) { // t2 is not a TimeTaskreturn1; // move t2 up in the list
} elseif (t2instanceofTimeTask) {
return -1; // move t1 up in the list
} else {
return0; // order can stay the same
}
});
return"List has been sorted in ascending order!";
} elseif (order == SortOrder.DESC) {
this.tasks.sort((t1, t2) -> {
if ((t1instanceofTimeTasknewT1) && (t2instanceofTimeTasknewT2)) {
if (newT2.getTime().isBefore(newT1.getTime())) {
return -1; // move t1 up the list
} elseif (newT1.getTime().isBefore(newT2.getTime())) {
return1; // move t2 up the list
} else {
return0; // order can stay the same
}
} elseif (t1instanceofTimeTask) { // t2 is not a TimeTaskreturn1; // move t2 up in the list
} elseif (t2instanceofTimeTask) {
return -1; // move t1 up in the list
} else {
return0; // order can stay the same
}
});
return"List has been sorted in descending order!";
} else {
return"Invalid ordering!"; // this line should be unreachable
}
}
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.
/** * Main method that serves as the entry point into the application * * @param args Irrelevant for now */
Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement.
Add sort functionality to chatbot
Users can sort the task list with the sort command, with either the asc argument or the desc argument to sort in ascending and descending orders respectively
body not wrapped at 72 characters: e.g., Users can sort the task list with the sort command, with either the asc argument or the desc argument to sort in ascending and descending orders respectively
Change TaskList find and listTasks implementation from for loops to streams
While this technically overcomplicates the method implementations, since for loops are simpler and sufficient for the job, this was done to review the java stream concept
Longer than 72 characters
body not wrapped at 72 characters: e.g., While this technically overcomplicates the method implementations, since for loops are simpler and sufficient for the job, this was done to review the java stream concept
Suggestion: Follow the given conventions for Git commit messages for future commits (do not modify past commit messages as doing so will change the commit timestamp that we used to detect your commit timings).
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:
@shizy 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/chatbot/logic/Parser.java
lines49-179
:Example from
src/main/java/chatbot/logic/TaskList.java
lines166-208
: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/chatbot/Launcher.java
lines9-13
: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
possible problems in commit
72bff45
:Users can sort the task list with the sort command, with either the asc argument or the desc argument to sort in ascending and descending orders respectively
possible problems in commit
0b3d74e
:Removed unused imports from the Deadline and Event classes to fulfill checkstyle
possible problems in commit
798f42f
:While this technically overcomplicates the method implementations, since for loops are simpler and sufficient for the job, this was done to review the java stream concept
Suggestion: Follow the given conventions for Git commit messages for future commits (do not modify past commit messages as doing so will change the commit timestamp that we used to detect your commit timings).
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: