dannylty / 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 ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
No easy-to-detect issues ๐
Example from src/main/java/duke/Duke.java
lines 61-136
:
public void start(Stage stage) {
//Step 1. Setting up required components
//The container for the content of the chat to scroll.
scrollPane = new ScrollPane();
dialogContainer = new VBox();
scrollPane.setContent(dialogContainer);
userInput = new TextField();
sendButton = new Button("Send");
AnchorPane mainLayout = new AnchorPane();
mainLayout.getChildren().addAll(scrollPane, userInput, sendButton);
scene = new Scene(mainLayout);
stage.setScene(scene);
stage.show();
// more code to be added here later
stage.setTitle("Duke");
stage.setResizable(false);
stage.setMinHeight(600.0);
stage.setMinWidth(400.0);
mainLayout.setPrefSize(400.0, 600.0);
scrollPane.setPrefSize(385, 535);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
scrollPane.setVvalue(1.0);
scrollPane.setFitToWidth(true);
// You will need to import `javafx.scene.layout.Region` for this.
dialogContainer.setPrefHeight(Region.USE_COMPUTED_SIZE);
userInput.setPrefWidth(325.0);
sendButton.setPrefWidth(55.0);
AnchorPane.setTopAnchor(scrollPane, 1.0);
AnchorPane.setBottomAnchor(sendButton, 1.0);
AnchorPane.setRightAnchor(sendButton, 1.0);
AnchorPane.setLeftAnchor(userInput , 1.0);
AnchorPane.setBottomAnchor(userInput, 1.0);
// more code to be added here later
sendButton.setOnMouseClicked((event) -> {
dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
userInput.clear();
});
userInput.setOnAction((event) -> {
dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
userInput.clear();
});
//Scroll down to the end every time dialogContainer's height changes.
dialogContainer.heightProperty().addListener((observable) -> scrollPane.setVvalue(1.0));
//Part 3. Add functionality to handle user input.
sendButton.setOnMouseClicked((event) -> {
handleUserInput();
});
userInput.setOnAction((event) -> {
handleUserInput();
});
dialogContainer.getChildren().addAll(
DialogBox.getDukeDialog(LOGO, IMAGE_DUKE)
);
}
Example from src/main/java/duke/Storage.java
lines 80-139
:
public ItemList loadState() {
ItemList items = new ItemList();
try {
Scanner fileReader = new Scanner(this.file);
while (fileReader.hasNextLine()) {
String currLine = fileReader.nextLine();
String[] currArgs = currLine.split(SEPARATOR);
Item toAdd = null;
String name = null;
String time = null;
String tag = null;
for (String s : currArgs) {
String[] flagArgs = s.split("&&&");
switch (flagArgs[0]) {
case "name":
name = flagArgs[1];
break;
case "time":
time = flagArgs[1];
break;
case "tag":
tag = flagArgs[1];
break;
default:
break;
}
}
switch (currArgs[0]) {
case "T":
toAdd = new ToDo(name);
break;
case "D":
toAdd = new Deadline(name, time);
break;
case "E":
toAdd = new Event(name, time);
break;
default:
throw new DukeException("Storage error");
}
if (currArgs[1].equals("X")) {
toAdd.markAsDone();
}
if (!Objects.isNull(tag)) {
toAdd.addTag(tag);
}
items.add(toAdd);
}
fileReader.close();
} catch (FileNotFoundException | DukeException e) {
e.printStackTrace();
}
return items;
}
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/Duke.java
lines 138-143
:
/**
* Iteration 1:
* Creates a label with the specified text and adds it to the dialog container.
* @param text String containing text to add
* @return a label with the specified text that has word wrap enabled.
*/
Example from src/main/java/duke/Duke.java
lines 152-156
:
/**
* Iteration 2:
* Creates two dialog boxes, one echoing user input and the other containing Duke's reply and then appends them to
* the dialog container. Clears the user input after processing.
*/
Example from src/main/java/duke/Duke.java
lines 172-175
:
/**
* You should have your own function to generate a response to user input.
* Replace this stub with your completed method.
*/
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.
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 ๐
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/Duke.java
lines 62-138
:
public void start(Stage stage) {
//Step 1. Setting up required components
//The container for the content of the chat to scroll.
scrollPane = new ScrollPane();
dialogContainer = new VBox();
scrollPane.setContent(dialogContainer);
userInput = new TextField();
sendButton = new Button("Send");
AnchorPane mainLayout = new AnchorPane();
mainLayout.getChildren().addAll(scrollPane, userInput, sendButton);
scene = new Scene(mainLayout);
stage.setScene(scene);
stage.show();
// more code to be added here later
stage.setTitle("Duke");
stage.setResizable(false);
stage.setMinHeight(600.0);
stage.setMinWidth(400.0);
mainLayout.setPrefSize(400.0, 600.0);
scrollPane.setPrefSize(385, 535);
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
scrollPane.setVvalue(1.0);
scrollPane.setFitToWidth(true);
// You will need to import `javafx.scene.layout.Region` for this.
dialogContainer.setPrefHeight(Region.USE_COMPUTED_SIZE);
userInput.setPrefWidth(325.0);
sendButton.setPrefWidth(55.0);
AnchorPane.setTopAnchor(scrollPane, 1.0);
AnchorPane.setBottomAnchor(sendButton, 1.0);
AnchorPane.setRightAnchor(sendButton, 1.0);
AnchorPane.setLeftAnchor(userInput , 1.0);
AnchorPane.setBottomAnchor(userInput, 1.0);
// more code to be added here later
sendButton.setOnMouseClicked((event) -> {
dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
userInput.clear();
});
userInput.setOnAction((event) -> {
dialogContainer.getChildren().add(getDialogLabel(userInput.getText()));
userInput.clear();
});
//Scroll down to the end every time dialogContainer's height changes.
dialogContainer.heightProperty().addListener((observable) -> scrollPane.setVvalue(1.0));
//Part 3. Add functionality to handle user input.
sendButton.setOnMouseClicked((event) -> {
handleUserInput();
});
userInput.setOnAction((event) -> {
handleUserInput();
});
Label startText = new Label(LOGO);
dialogContainer.getChildren().addAll(
DialogBox.getDukeDialog(startText, new ImageView(IMAGE_DUKE))
);
}
Example from src/main/java/duke/Storage.java
lines 80-139
:
public ItemList loadState() {
ItemList items = new ItemList();
try {
Scanner fileReader = new Scanner(this.file);
while (fileReader.hasNextLine()) {
String currLine = fileReader.nextLine();
String[] currArgs = currLine.split(SEPARATOR);
Item toAdd = null;
String name = null;
String time = null;
String tag = null;
for (String s : currArgs) {
String[] flagArgs = s.split("&&&");
switch (flagArgs[0]) {
case "name":
name = flagArgs[1];
break;
case "time":
time = flagArgs[1];
break;
case "tag":
tag = flagArgs[1];
break;
default:
break;
}
}
switch (currArgs[0]) {
case "T":
toAdd = new ToDo(name);
break;
case "D":
toAdd = new Deadline(name, time);
break;
case "E":
toAdd = new Event(name, time);
break;
default:
throw new DukeException("Storage error");
}
if (currArgs[1].equals("X")) {
toAdd.markAsDone();
}
if (!Objects.isNull(tag)) {
toAdd.addTag(tag);
}
items.add(toAdd);
}
fileReader.close();
} catch (FileNotFoundException | DukeException e) {
e.printStackTrace();
}
return items;
}
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/Duke.java
lines 140-145
:
/**
* Iteration 1:
* Creates a label with the specified text and adds it to the dialog container.
* @param text String containing text to add
* @return a label with the specified text that has word wrap enabled.
*/
Example from src/main/java/duke/Duke.java
lines 154-158
:
/**
* Iteration 2:
* Creates two dialog boxes, one echoing user input and the other containing Duke's reply and then appends them to
* the dialog container. Clears the user input after processing.
*/
Example from src/main/java/duke/Duke.java
lines 174-177
:
/**
* You should have your own function to generate a response to user input.
* Replace this stub with your completed method.
*/
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 51ae8b4
:
Cleanup
Suggestion: Follow the given conventions for Git commit messages
โน๏ธ 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.