domszy / 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
Example from src/main/java/duke/Task.java
lines 9-9
:
private boolean completed;
Suggestion: Follow the given naming convention for boolean variables/methods (e.g., use a boolean-soundingprefix).You may ignore the above if you think the name already follows the convention (the script can report false positives in some cases)
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/TaskList.java
lines 46-103
:
public TaskList(File memory) {
this.taskList = new ArrayList<Task>();
this.memory = new Storage(memory.getPath());
try {
memory.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
try {
File updated = new File("data/updated.txt");
BufferedReader reader = null;
reader = new BufferedReader(new FileReader(memory));
BufferedWriter writer = new BufferedWriter(new FileWriter(updated));
String currentLine = "";
int numberAdded = 1;
while ((currentLine = reader.readLine()) != null) {
assert currentLine.length() > 4;
String[] seperate1 = currentLine.toString().split(" ", 2);
String taskTypeText = seperate1[0];
String taskType;
String[] seperate2 = seperate1[1].toString().split(" ", 2);
boolean isCompleted = (seperate2[0].equals("[โ]")) ? true : false;
String eventInfo = seperate2[1];
switch (taskTypeText) {
case "[T]":
String eventname = eventInfo;
this.addTodo(eventname, false);
break;
case "[D]":
String[] seperateAgain = seperate2[1].split(" \\(by: ", 2);
String eventName = seperateAgain[0];
String deadline = seperateAgain[1].split("\\)", 2)[0];
this.addDeadline(eventName, deadline, false);
break;
case "[E]":
String[] seperateAgaining = seperate2[1].split(" \\(at: ", 2);
String event = seperateAgaining[0];
String timeline = seperateAgaining[1].split("\\)", 2)[0];
this.addEvent(event, timeline, false);
break;
default:
throw new DukeException("Generic");
}
if (isCompleted) {
this.updateTaskStatus(numberAdded, false);
}
numberAdded++;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Example from src/main/java/duke/TaskList.java
lines 125-171
:
public String updateTaskStatus(int userInput, boolean isInput) {
String output = "";
if (userInput > taskList.size()) {
output = "please enter a number that's between 1 and " + taskList.size();
System.out.println(output);
return output;
}
Task task = taskList.get(userInput - 1);
String lineToRemove = task.printName();
task.toggleComplete();
if (!task.isCompleted()) {
output += "I've marked this task as not done: \n" + task.printName();
return output;
}
if (isInput) {
output += "Nice! I've marked this task as done:\n" + task.printName();
System.out.println(output);
try {
File updated = new File("data/updated.txt");
BufferedReader reader = new BufferedReader(new FileReader(this.memory.load()));
BufferedWriter writer = new BufferedWriter(new FileWriter(updated));
String currentLine = "";
while ((currentLine = reader.readLine()) != null) {
if (currentLine.equals(lineToRemove)) {
writer.write(task.printName() + "\n");
continue;
}
writer.write(currentLine + "\n");
}
writer.close();
reader.close();
boolean successful = updated.renameTo(this.memory.load());
} catch (IOException e) {
e.printStackTrace();
}
}
return output;
}
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
Example from src/main/java/duke/Event.java
lines 53-57
:
/**
* printName() method returns the name and the task indicator of the Event object.
*
* @return a string representation of a Event object
*/
Example from src/main/java/duke/Parser.java
lines 20-25
:
/**
* parsing(String input) takes in a string from the given input and parses the string
* into the taskName, command and deadlineOrTimeline variables.
*
* @param input the given input by the user
*/
Example from src/main/java/duke/Parser.java
lines 70-73
:
/**
* getTimeline() returns the timeline or the deadline of the event/deadline respectively.
* @return the timeline/deadline of the task
*/
Suggestion: Ensure method/class header comments follow the format specified in the coding standard, in particular, the phrasing of the overview statement
possible problems in commit 3e03fed
:
Fixed issues when pushing to repository
possible problems in commit d25b45c
:
Merge commit '6981a3bb8c9bd3715f8ac8ba5bba0aec47a9fdea' into branch-JustToCheck
Suggestion: Follow the given conventions for Git commit messages for future commits (no need to modify past commit messages).
[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.