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, so that you can avoid similar problems in your tP code (which will be graded more strictly for code quality).
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.
Refactor Parser to utilise Command subclasses
The Command class and its subclasses hide the command execution logic from the Parser class. This helps to declutter the processInput() function in the Parser class
body not wrapped at 72 characters: e.g., The Command class and its subclasses hide the command execution logic from the Parser class. This helps to declutter the processInput() function in the Parser class
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 👍
❗ You are not required to (but you are welcome to) fix the above problems in your iP, unless you have been separately asked to resubmit the iP due to code quality 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, so that you can avoid similar problems in your tP code (which will be graded more strictly for code quality).
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
lines64-159
:Example from
src/main/java/chatbot/logic/TaskList.java
lines171-213
: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
No easy-to-detect issues 👍
Aspect: Recent Git Commit Message
possible problems in commit
938eb5a
:Updated UI screenshot to be consistent with the current version of the program
possible problems in commit
88d3e7a
:README is meant for the users to understand the use cases and commands present in the program
possible problems in commit
dba5dfd
:The Command class and its subclasses hide the command execution logic from the Parser class. This helps to declutter the processInput() function in the Parser class
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 👍
❗ You are not required to (but you are welcome to) fix the above problems in your iP, unless you have been separately asked to resubmit the iP due to code quality 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: