Skip to content

Commit

Permalink
Merge branch 'A-CheckStyle' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
danadi7 committed Sep 6, 2020
2 parents 4d17b6c + 82eed80 commit 740a6f4
Show file tree
Hide file tree
Showing 12 changed files with 434 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ shadowJar {
}

checkstyle {
toolVersion = '8.23'
toolVersion = '8.32'
}

run{
Expand Down
403 changes: 403 additions & 0 deletions config/checkstyle/checkstyle.xml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>
<suppress checks="JavadocType" files=".*Test\.java"/>
<suppress checks="MissingJavadocMethodCheck" files=".*Test\.java"/>
</suppressions>
2 changes: 1 addition & 1 deletion src/main/java/duke/exceptions/DukeException.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Custom Exception for Duke.
*/
public class DukeException extends Exception{
public class DukeException extends Exception {

public DukeException(String errorMessage) {
super(errorMessage);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/duke/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
/**
* Handles 'deadline', 'event' and 'todo' command input by user.
*/
public class AddCommand extends Command{
public class AddCommand extends Command {

/**
* Constructor for AddCommand class.
*
* @param command String input by user.
*/
public AddCommand(String command){
public AddCommand(String command) {
super(command);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/logic/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* Handles 'delete' commands input by user.
*/
public class DeleteCommand extends Command{
public class DeleteCommand extends Command {

/**
* Constructor for DeleteCommand class
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/logic/commands/DoneCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* Handles 'done' command input by user.
*/
public class DoneCommand extends Command{
public class DoneCommand extends Command {

/**
* Constructor for DoneCommand class.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/logic/commands/ExitCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Handles 'bye' command input by user.
*/
public class ExitCommand extends Command{
public class ExitCommand extends Command {

/**
* Constructor for ExitCommand class.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/logic/commands/ListCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Handles 'list' command input by user.
*/
public class ListCommand extends Command{
public class ListCommand extends Command {

/**
* Constructor for ListCommand class.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/duke/model/TaskManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public TaskManager(ArrayList<Task> taskList) {
*
* @param task Task to be added.
*/
public void addTask(Task task){
public void addTask(Task task) {
taskList.add(task);
}

Expand Down
8 changes: 6 additions & 2 deletions src/main/java/duke/storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.time.LocalDate;
import java.util.ArrayList;

import duke.exceptions.DukeException;
import duke.model.task.Deadline;
import duke.model.task.Event;
import duke.model.task.Task;
Expand All @@ -24,7 +25,7 @@ public class Storage {
*
* @param saveFilePath Location of save file.
*/
public Storage(String saveFilePath){
public Storage(String saveFilePath) {
this.saveFilePath = saveFilePath;
}

Expand Down Expand Up @@ -53,7 +54,7 @@ public void save(ArrayList<Task> taskList) throws IOException {
* @return ArrayList of Tasks.
* @throws IOException If unable to access or find the save file.
*/
public ArrayList<Task> load() throws IOException {
public ArrayList<Task> load() throws IOException, DukeException {
ArrayList<Task> taskList = new ArrayList<>();
BufferedReader br = new BufferedReader(new FileReader(saveFilePath));
String line;
Expand All @@ -74,6 +75,9 @@ public ArrayList<Task> load() throws IOException {
LocalDate eventDate = LocalDate.parse(taskLine[3]);
Event event = new Event(taskLine[2], Boolean.parseBoolean(taskLine[1]), eventDate);
taskList.add(event);
break;
default:
throw new DukeException("Error parsing save file.");
}
}
return taskList;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/duke/ui/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Deals with user interactions.
*/
public class Ui {
private final String WELCOME = "Hello. I am Claude! What may I do for you today?";
private final String GOODBYE = "Goodbye! Hope to see you again soon!";
private final String LINE = "______________________________";
static final String WELCOME = "Hello. I am Claude! What may I do for you today?";
static final String GOODBYE = "Goodbye! Hope to see you again soon!";
static final String LINE = "______________________________";
private Scanner sc;

public Ui() {
Expand All @@ -24,7 +24,7 @@ public Ui() {
* @return String to be processed by parser.
*/
public String readCommand() {
if (sc.hasNext()){
if (sc.hasNext()) {
return sc.nextLine();
} else {
return "";
Expand Down Expand Up @@ -64,9 +64,9 @@ public void showDetails(String s) {
* Prints a given ArrayList of Tasks.
* @param taskList ArrayList of Tasks to be printed.
*/
public void showTaskList(ArrayList<Task> taskList){
public void showTaskList(ArrayList<Task> taskList) {
String s = "";
for (int i= 0; i < taskList.size(); i++) {
for (int i = 0; i < taskList.size(); i++) {
s = s = s + (i + 1) + ". " + taskList.get(i) + "\n";
}
showDetails(s);
Expand Down

0 comments on commit 740a6f4

Please sign in to comment.