Java MicroServices training exercises and projects
ramapriyan912001 / ip Goto Github PK
View Code? Open in Web Editor NEWThis project forked from nus-cs2103-ay2122s1/ip
This project forked from nus-cs2103-ay2122s1/ip
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 ๐
Example from src/main/java/duke/Storage/Storage.java
lines 1-1
:
package duke.Storage;
Suggestion: Follow the package naming convention specified by the coding standard.
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/Command.java
lines 11-15
:
/**
* Add a task to the list.
* @param task The string of the task.
* @param type The type of the task: event, deadline, or other type.
*/
Example from src/main/java/duke/Command.java
lines 26-29
:
/**
* Check task off as done in the list.
* @param taskNumber index of task in list.
*/
Example from src/main/java/duke/Command.java
lines 40-43
:
/**
* Delete task from the list.
* @param taskNumber index of task in list.
*/
Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement
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 @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.
Hi,
I followed all the instructions provided in the docs.
I have tried manually inputting the test commands, and see no issue in the outputs.
As such, I copied these outputs directly from the terminal and pasted them in my EXPECTED.txt file.
The corresponding inputs are in my input.txt file.
However, when I run the .sh script, I see the tests fail and the actual.txt file only shows a fraction of the output that should be seen.
I also see some kind of error "dos2unix command not found" pertaining to a command in the .sh file, in the terminal window.
I have included screenshots of my actual.txt, input.txt, expected.txt, and my terminal upon running the script.
Kindly help me resolve this issue.
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 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 ๐
Example from src/main/java/duke/Parser.java
lines 30-30
:
Boolean done = false;
Example from src/main/java/duke/Parser.java
lines 83-83
:
Boolean valid = true;
Example from src/main/java/duke/Task.java
lines 12-12
:
private Boolean done;
Suggestion: Follow the given naming convention for boolean variables/methods
No easy-to-detect issues ๐
Example from src/main/java/duke/Storage/Storage.java
lines 1-1
:
package duke.Storage;
Suggestion: Follow the package naming convention specified by the coding standard.
No easy-to-detect issues ๐
No easy-to-detect issues ๐
Example from src/main/java/duke/Parser.java
lines 21-59
:
public static ArrayList<Task> loadTasks(List<String> tasks) throws FileParseErrorException {
ArrayList<Task> finalTasks = new ArrayList<>();
for (int i = 0; i < tasks.size(); i++) {
String taskString = tasks.get(i);
String[] tokens = taskString.split(",");
if (tokens.length < 3) {
throw new FileParseErrorException();
}
String interpretedString = "";
Boolean done = false;
if (tokens[1].equals("0")) {
done = false;
} else if (tokens[1].equals("1")) {
done = true;
} else {
throw new FileParseErrorException();
}
LocalDateTime localDateTime = LocalDateTime.now();
Type type;
if (tokens[0].equals("D") && tokens.length == 4) {
type = Type.DEADLINE;
interpretedString = tokens[2];
localDateTime = parseDate(tokens[3]);
} else if (tokens[0].equals("E") && tokens.length == 4) {
type = Type.EVENT;
interpretedString = tokens[2];
localDateTime = parseDate(tokens[3]);
} else if (tokens[0].equals("T") && tokens.length == 3) {
type = Type.TODO;
interpretedString = tokens[2];
localDateTime = null;
} else {
throw new FileParseErrorException();
}
Task task = TaskList.initialiseByType(interpretedString, type, done, localDateTime);
finalTasks.add(task);
}
return finalTasks;
}
Example from src/main/java/duke/Parser.java
lines 80-113
:
public static String interpretInput(String input, List<Task> tasks) throws DukeException {
String response = "";
// Use Java Assertions to check for unacceptable commands
Boolean valid = true;
if (input.equals("bye")) {
response = BYE_STRING;
} else if (input.equals("list")) {
response = listResponse(tasks);
} else if (input.equals("hello")) {
response = helloResponse();
} else if (input.startsWith("done ")) {
response = doneResponse(input, tasks);
} else if (input.startsWith("todo ")) {
response = todoResponse(input, tasks);
} else if (input.startsWith("deadline ")) {
response = deadlineResponse(input, tasks);
} else if (input.startsWith("event ")) {
response = eventResponse(input, tasks);
} else if (input.startsWith("delete ")) {
response = deleteResponse(input, tasks);
} else if (input.startsWith("find ")) {
response = findResponse(input, tasks);
} else if (input.startsWith("sort events and deadlines")
|| input.startsWith("sort deadlines and events")) {
response = sortResponse(tasks);
} else {
valid = false;
}
assert valid : "COMMAND NOT FOUND";
writeToStorage(tasks);
System.out.println(response);
return response;
}
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.
Example from src/main/java/duke/Command.java
lines 11-15
:
/**
* Method to add a task to our list.
* @param task The string of the task.
* @param type The type of the task: event, deadline, or other type.
*/
Example from src/main/java/duke/Command.java
lines 26-29
:
/**
* Method to check the task off as done in the list.
* @param taskNumber The number of the task in our list.
*/
Example from src/main/java/duke/Command.java
lines 40-43
:
/**
* Method to delete the task from the list.
* @param taskNumber The number of the task in our list.
*/
Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement
No easy-to-detect issues ๐
โน๏ธ The bot account @cs2103-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.