montypython28 / ip Goto Github PK
View Code? Open in Web Editor NEWThis project forked from nus-cs2103-ay2122s2/ip
This project forked from nus-cs2103-ay2122s2/ip
@MontyPython28 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.
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
Example from src/main/java/ui/Parser.java
lines 23-123
:
public static Command parse(String input) throws DukeException {
String[] words = input.split(" ", 2);
String commandWord = words[0];
String message = "";
if (words.length > 1) {
message = words[1].trim();
}
switch (commandWord) {
case "list":
return new ListCommand();
case "todo":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
Integer priority = null;
if (message.matches(".* :p[1-4]")) {
priority = Integer.parseInt(message.substring(message.length() - 1));
message = message.split(" :p[1-4]", 2)[0].trim();
}
return new TodoCommand(message, priority);
case "event":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
priority = null;
if (message.matches(".* :p[1-4]")) {
priority = Integer.parseInt(message.substring(message.length() - 1));
message = message.split(" :p[1-4]", 2)[0].trim();
}
String[] messageWords = message.split("/at ", 2);
if (messageWords.length == 1 || messageWords[1].isBlank()) {
throw new DukeException("Can't find the time! Have you typed it correctly?");
}
return new EventCommand(messageWords[0].trim(), messageWords[1].trim(), priority);
case "deadline":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
priority = null;
if (message.matches(".* :p[1-4]")) {
priority = Integer.parseInt(message.substring(message.length() - 1));
message = message.split(" :p[1-4]", 2)[0].trim();
}
messageWords = message.split("/by ", 2);
if (messageWords.length == 1 || messageWords[1].isBlank()) {
throw new DukeException("Can't find the time! Have you typed it correctly?");
}
return new DeadlineCommand(messageWords[0].trim(), messageWords[1].trim(), priority);
case "mark":
int serialNumber;
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
try {
serialNumber = Integer.parseInt(message);
} catch (NumberFormatException e) {
throw new DukeException("Have you typed in your number correctly in numerals?");
}
return new MarkCommand(serialNumber);
case "unmark":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
try {
serialNumber = Integer.parseInt(message);
} catch (NumberFormatException e) {
throw new DukeException("Have you typed in your number correctly in numerals?");
}
return new UnmarkCommand(serialNumber);
case "delete":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
try {
serialNumber = Integer.parseInt(message);
} catch (NumberFormatException e) {
throw new DukeException("Have you typed in your number correctly in numerals?");
}
return new DeleteCommand(serialNumber);
case "find":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
return new FindCommand(message);
default:
throw new DukeException("Sorry, but I don't know what that means :-(");
}
}
Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten methods. You may ignore this suggestion if you think a longer method is justified in a particular case.
No easy-to-detect issues ๐
No easy-to-detect issues ๐
possible problems in commit 4b0e3ae
:
Add Checkstyle config files and made appropriate changes to follow Java coding standards
Suggestion: Follow the given conventions for Git commit messages for future commits (no need to modify past commit messages).
โน๏ธ The bot account @nus-se-bot 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.
@MontyPython28 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.
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
Example from src/main/java/ui/Parser.java
lines 23-141
:
public static Command parse(String input) throws DukeException {
String[] words = input.split(" ", 2);
String commandWord = words[0];
String message = "";
if (words.length > 1) {
message = words[1].trim();
}
switch (commandWord) {
case "list":
return new ListCommand();
case "todo":
Integer priority = null;
message = message.trim();
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
String[] splitPriority = message.split(" :p[1-4]", 2);
if (splitPriority.length == 2) {
priority = Integer.parseInt(message.substring(message.length() - 1));
message = message.split(" :p[1-4]", 2)[0].trim();
}
return new TodoCommand(message, priority);
case "event":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
String[] messageWords = message.split("/at ", 2);
if (messageWords.length == 1 || messageWords[1].isBlank()) {
throw new DukeException("Can't find the time! Have you typed it correctly?");
}
message = messageWords[0].trim();
String date = messageWords[1].trim();
priority = null;
splitPriority = date.split(" :p[1-4]", 2);
if (splitPriority.length == 2) {
priority = Integer.parseInt(date.substring(date.length() - 1));
date = date.split(" :p[1-4]", 2)[0].trim();
}
if (message.isBlank()) {
throw new DukeException("Can't find any task description! Have you typed it correctly?");
}
return new EventCommand(message, date, priority);
case "deadline":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
messageWords = message.split("/by ", 2);
if (messageWords.length == 1 || messageWords[1].isBlank()) {
throw new DukeException("Can't find the time! Have you typed it correctly?");
}
message = messageWords[0].trim();
date = messageWords[1].trim();
priority = null;
splitPriority = date.split(" :p[1-4]", 2);
if (splitPriority.length == 2) {
priority = Integer.parseInt(date.substring(date.length() - 1));
date = date.split(" :p[1-4]", 2)[0].trim();
}
if (message.isBlank()) {
throw new DukeException("Can't find any task description! Have you typed it correctly?");
}
return new DeadlineCommand(message, date, priority);
case "mark":
int serialNumber;
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
try {
serialNumber = Integer.parseInt(message);
} catch (NumberFormatException e) {
throw new DukeException("Have you typed in your number correctly in numerals?");
}
return new MarkCommand(serialNumber);
case "unmark":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
try {
serialNumber = Integer.parseInt(message);
} catch (NumberFormatException e) {
throw new DukeException("Have you typed in your number correctly in numerals?");
}
return new UnmarkCommand(serialNumber);
case "delete":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
try {
serialNumber = Integer.parseInt(message);
} catch (NumberFormatException e) {
throw new DukeException("Have you typed in your number correctly in numerals?");
}
return new DeleteCommand(serialNumber);
case "find":
if (message.isBlank()) {
throw new DukeException("Can't find any info after your command! Have you typed it correctly?");
}
return new FindCommand(message);
default:
throw new DukeException("Sorry, but I don't know what that means :-(");
}
}
Suggestion: Consider applying SLAP (and other abstraction mechanisms) to shorten methods. You may ignore this suggestion if you think a longer method is justified in a particular case.
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.