Progress: Trello board
metildachee / duke Goto Github PK
View Code? Open in Web Editor NEWThis project forked from nus-tic2002-2021/duke
This project forked from nus-tic2002-2021/duke
Progress: Trello board
@metildachee 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/Duke.java
lines 71-142
:
public static void main(String[] args) {
System.out.println(STMT_START);
Scanner in = new Scanner(System.in);
ArrayList<Task> list = new ArrayList<>();
String input = in.nextLine();
ArrayList<String> tokens = new ArrayList(Arrays.asList(input.split(" ")));
String instruction = tokens.get(0);
Integer id = 0;
String taskInfo = tokens // TODO: Fix this (duh)
.subList(1, tokens.size())
.toString()
.replace(",", "")
.replace("[", "")
.replace("]", "")
.trim();
while (!instruction.toLowerCase(Locale.ROOT).equals(DETECT_END)) {
if (instruction.toLowerCase(Locale.ROOT).equals(DETECT_LIST)) {
try {
list(list);
} catch (Exception e) {
printErrorMessage(Message.EMPTY_LIST);
}
} else if (instruction.toLowerCase(Locale.ROOT).equals(DETECT_DONE) && tokens.size() >= 2) {
markDone(list, Integer.parseInt((tokens.get(1))));
} else if (instruction.toLowerCase(Locale.ROOT).equals(DETECT_DELETE) && tokens.size() >= 2) {
try {
markDelete(list, Integer.parseInt((tokens.get(1))));
} catch (Exception e) {
printErrorMessage(Message.UNKNOWN_OBJECT);
}
} else {
Task task = null;
switch (instruction) {
case DETECT_ADD_TODO:
task = new Todo(taskInfo, id);
break;
case DETECT_ADD_EVENT:
ArrayList<String> addInfo = new ArrayList(Arrays.asList(taskInfo.split("/at")));
task = new Event(addInfo.get(0), addInfo.get(1), id);
break;
case DETECT_ADD_DEADLINE:
ArrayList<String> deadlineInfo = new ArrayList(Arrays.asList(taskInfo.split("/by")));
task = new Deadline(deadlineInfo.get(0), deadlineInfo.get(1), id);
break;
}
try {
add(list, task);
} catch (Exception e) {
printErrorMessage(Message.ERROR_UNRECOGNISED);
}
}
input = in.nextLine();
System.out.println("input: " + input);
tokens = new ArrayList(Arrays.asList(input.split(" ")));
instruction = tokens.get(0);
System.out.println("instruction: " + instruction);
taskInfo = tokens
.subList(1, tokens.size())
.toString()
.replace(",", "")
.replace("[", "")
.replace("]", "")
.trim();
System.out.println("task info:" + taskInfo);
id = list.size();
}
System.out.println(STMT_END);
}
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 ๐
โน๏ธ 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.
@metildachee 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/Duke.java
lines 71-142
:
public static void main(String[] args) {
System.out.println(STMT_START);
Scanner in = new Scanner(System.in);
ArrayList<Task> list = new ArrayList<>();
String input = in.nextLine();
ArrayList<String> tokens = new ArrayList(Arrays.asList(input.split(" ")));
String instruction = tokens.get(0);
Integer id = 0;
String taskInfo = tokens // TODO: Fix this (duh)
.subList(1, tokens.size())
.toString()
.replace(",", "")
.replace("[", "")
.replace("]", "")
.trim();
while (!instruction.toLowerCase(Locale.ROOT).equals(DETECT_END)) {
if (instruction.toLowerCase(Locale.ROOT).equals(DETECT_LIST)) {
try {
list(list);
} catch (Exception e) {
printErrorMessage(Message.EMPTY_LIST);
}
} else if (instruction.toLowerCase(Locale.ROOT).equals(DETECT_DONE) && tokens.size() >= 2) {
markDone(list, Integer.parseInt((tokens.get(1))));
} else if (instruction.toLowerCase(Locale.ROOT).equals(DETECT_DELETE) && tokens.size() >= 2) {
try {
markDelete(list, Integer.parseInt((tokens.get(1))));
} catch (Exception e) {
printErrorMessage(Message.UNKNOWN_OBJECT);
}
} else {
Task task = null;
switch (instruction) {
case DETECT_ADD_TODO:
task = new Todo(taskInfo, id);
break;
case DETECT_ADD_EVENT:
ArrayList<String> addInfo = new ArrayList(Arrays.asList(taskInfo.split("/at")));
task = new Event(addInfo.get(0), addInfo.get(1), id);
break;
case DETECT_ADD_DEADLINE:
ArrayList<String> deadlineInfo = new ArrayList(Arrays.asList(taskInfo.split("/by")));
task = new Deadline(deadlineInfo.get(0), deadlineInfo.get(1), id);
break;
}
try {
add(list, task);
} catch (Exception e) {
printErrorMessage(Message.ERROR_UNRECOGNISED);
}
}
input = in.nextLine();
System.out.println("input: " + input);
tokens = new ArrayList(Arrays.asList(input.split(" ")));
instruction = tokens.get(0);
System.out.println("instruction: " + instruction);
taskInfo = tokens
.subList(1, tokens.size())
.toString()
.replace(",", "")
.replace("[", "")
.replace("]", "")
.trim();
System.out.println("task info:" + taskInfo);
id = list.size();
}
System.out.println(STMT_END);
}
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 ๐
โน๏ธ 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.
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.