@Haris-Irfan 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/kietwoforone/parser/Parser.java lines 78-154:
public static Command parse(String command) throws KieTwoForOneException {
assert command != null: "Command cannot be null";
String[] instruction = command.split(" ", 2);
String[] taskDetails = new String[0];
try {
Instructions.valueOf(instruction[0].toUpperCase());
isCompleteInput(instruction);
} catch (IllegalArgumentException e) {
throw new KieTwoForOneException("Invalid input!");
} catch (KieTwoForOneException e) {
throw new KieTwoForOneException(e.getMessage());
}
if (instruction.length > 1) {
taskDetails = instruction[1].split(" /", 0);
}
switch (Instructions.valueOf(instruction[0].toUpperCase())) {
case LIST:
return new ListCommand();
case BYE:
return new ByeCommand();
case MARK:
return new MarkCommand(Integer.valueOf(instruction[1]));
case UNMARK:
return new UnmarkCommand(Integer.valueOf(instruction[1]));
case TAG:
try {
return new TagCommand(Integer.valueOf(taskDetails[0]), taskDetails[1]);
} catch (NumberFormatException e) {
throw new KieTwoForOneException("Please input your instruction in the format: tag (index) /(tag)");
} catch (ArrayIndexOutOfBoundsException e) {
throw new KieTwoForOneException("Please input a valid index and tag!");
}
case TODO:
return new AddCommand(new Todo(instruction[1]));
case EVENT:
try {
isCompleteEventInput(taskDetails);
} catch (KieTwoForOneException e) {
throw new KieTwoForOneException(e.getMessage());
}
try {
return new AddCommand(new Event(taskDetails[0], taskDetails[1], taskDetails[2]));
} catch (DateTimeException e) {
throw new KieTwoForOneException("Date must be valid and in the form YYYY-MM-DD!");
} catch (ArrayIndexOutOfBoundsException e) {
throw new KieTwoForOneException("Please input a date and time for your start and end time!");
}
case DEADLINE:
try {
isCompleteDeadlineInput(taskDetails);
} catch (KieTwoForOneException e) {
throw new KieTwoForOneException(e.getMessage());
}
try {
return new AddCommand(new Deadline(taskDetails[0], taskDetails[1]));
} catch (DateTimeException e) {
throw new KieTwoForOneException("Date must be valid and in the form YYYY-MM-DD!");
} catch (ArrayIndexOutOfBoundsException e) {
throw new KieTwoForOneException("Please input a date and time for your deadline!");
}
case DELETE:
return new DeleteCommand(Integer.valueOf(instruction[1]));
case DATE:
try {
return new FindDateCommand(instruction[1]);
} catch (IndexOutOfBoundsException e) {
throw new KieTwoForOneException("Please input a valid date!");
}
case FIND:
return new FindWordCommand(instruction[1]);
default:
throw new KieTwoForOneException("Invalid input!");
}
}
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 88b7389:
Update README.md
User guide for downloading the application not provided in README
Edit description to provide users more clarity on where they can find the release and how to run the JAR file
- body not wrapped at 72 characters: e.g.,
Edit description to provide users more clarity on where they can find the release and how to run the JAR file
possible problems in commit 853d82c:
Update README.md
User guide for downloading the application not provided in README
Include short description on where users can find the JAR file and how to start the chatbot
- body not wrapped at 72 characters: e.g.,
Include short description on where users can find the JAR file and how to start the chatbot
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 cs2103@comp.nus.edu.sg if you want to follow up on this post.
@Haris-Irfan 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/kietwoforone/parser/Parser.javalines78-154: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
88b7389:Edit description to provide users more clarity on where they can find the release and how to run the JAR filepossible problems in commit
853d82c:Include short description on where users can find the JAR file and how to start the chatbotSuggestion: 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
cs2103@comp.nus.edu.sgif you want to follow up on this post.