tanyutao544 / 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
@tanyutao544 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 ๐
Example from src/main/java/duke/tasks/Task.java
lines 10-10
:
protected boolean marked;
Suggestion: Follow the given naming convention for boolean variables/methods (e.g., use a boolean-sounding prefix).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 ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
Example from src/main/java/duke/commands/Command.java
lines 14-20
:
/**
* Abstract method for the execution of command
*
* @param tasks tasks list to be modified
* @param ui to help with printing of messages
* @param storage To deal with saving of task list
*/
Example from src/main/java/duke/parser/Parser.java
lines 24-29
:
/**
* Method to process the users input into respective command
* @param input Users input to be processed
* @return Corresponding command if valid input
* @throws DukeException if input is invalid or missing details
*/
Example from src/main/java/duke/parser/Parser.java
lines 89-93
:
/**
* Method to check input string is a valid string of integers
* @param input String input to be checked
* @return true if input is all integers false is not
*/
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 @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.
@tanyutao544 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/commands/AddCommand.java
lines 66-114
:
public String execute(TaskList tasks, Ui ui, Storage storage) throws DukeException {
assert tasks != null;
this.tasks = tasks;
String[] processedInput;
String time = null;
String details;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d/M/yyyy HHmm");
try {
switch (type) {
case "todo":
added = new ToDo(input);
break;
case "event":
processedInput = input.split("/at", 2);
if(processedInput.length != 2) {
throw new IncorrectFormatException();
}
details = processedInput[0];
if(details.isEmpty()){
throw new EmptyDescriptionException(type);
}
time = processedInput[1].trim();
LocalDateTime date = LocalDateTime.parse(time, formatter);
added = new Event(details, date);
break;
case "deadline":
processedInput = input.split("/by", 2);
if(processedInput.length != 2) {
throw new IncorrectFormatException();
}
details = processedInput[0];
if(details.isEmpty()){
throw new EmptyDescriptionException(type);
}
time = processedInput[1].trim();
LocalDateTime deadline = LocalDateTime.parse(time, formatter);
added = new Deadline(details, deadline);
break;
default:
break;
}
} catch (DateTimeParseException e) {
throw new WrongDateFormatException(time);
}
this.tasks.add(added);
storage.saveFile(tasks);
return ui.addMessage(added, tasks.size());
}
Example from src/main/java/duke/storage/Storage.java
lines 34-88
:
public TaskList load() throws IOException {
//load files
File directory = new File("data");
if (!directory.exists()) {
directory.mkdir();
}
File file = new File(filePath);
if (!file.exists()) {
file.createNewFile();
} else {
Scanner s = new Scanner(file);
String type;
String mark;
String detail;
String date;
Task toAdd = null;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d/M/yyyy HHmm");
LocalDateTime parsedDate;
while (s.hasNext()) {
String input = s.nextLine();
String[] inputSplit = input.split(" \\| ", 3);
type = inputSplit[0];
mark = inputSplit[1];
switch (type) {
case "T":
detail = inputSplit[2];
toAdd = new ToDo(detail);
break;
case "E":
inputSplit = inputSplit[2].split(" \\| ");
detail = inputSplit[0];
date = inputSplit[1];
parsedDate = LocalDateTime.parse(date, formatter);
toAdd = new Event(detail, parsedDate);
break;
case "D":
inputSplit = inputSplit[2].split(" \\| ");
detail = inputSplit[0];
date = inputSplit[1];
parsedDate = LocalDateTime.parse(date, formatter);
toAdd = new Deadline(detail, parsedDate);
break;
default:
break;
}
System.out.println(mark);
if (mark.equals("1")) {
toAdd.mark();
}
tasks.add(toAdd);
}
}
return tasks;
}
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/commands/Command.java
lines 14-20
:
/**
* Abstract method for the execution of command
*
* @param tasks tasks list to be modified
* @param ui to help with printing of messages
* @param storage To deal with saving of task list
*/
Example from src/main/java/duke/tasks/Task.java
lines 35-37
:
/**
* Abstract method to update Date of the task
*/
Example from src/main/java/duke/tasks/Task.java
lines 40-42
:
/**
* Abstract method to update Detail 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 46f9232
:
Renamed Ui.png to resolve issue with product site
Suggestion: Follow the given conventions for Git commit messages for future commits (no need to modify past commit messages).
No easy-to-detect issues
[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.