Skip to content

Commit b81ffa0

Browse files
committed
fix: fix code style issues
1 parent a01e780 commit b81ffa0

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/main/java/procrastinaid/task/Storage.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Storage class to handle saving and loading of tasks to and from a file.
1212
*/
1313
public class Storage {
14-
private final String FILEPATH;
14+
private final String filepath;
1515

1616
/**
1717
* Constructor for Storage class.
@@ -20,10 +20,10 @@ public class Storage {
2020
*/
2121
public Storage(String filename) {
2222
assert filename != null : "File path should not be null";
23-
this.FILEPATH = filename;
24-
if (!new File(this.FILEPATH).exists()) {
23+
this.filepath = filename;
24+
if (!new File(this.filepath).exists()) {
2525
try {
26-
new File(this.FILEPATH).createNewFile();
26+
new File(this.filepath).createNewFile();
2727
} catch (IOException e) {
2828
e.printStackTrace();
2929
}
@@ -37,7 +37,7 @@ public Storage(String filename) {
3737
*/
3838
public void saveToFile(TaskList tasks) {
3939
try {
40-
FileWriter fw = new FileWriter(this.FILEPATH);
40+
FileWriter fw = new FileWriter(this.filepath);
4141
for (Task task : tasks.getTasks()) {
4242
String writeString = task.toFileFormat();
4343
fw.write(writeString);
@@ -57,7 +57,7 @@ public void saveToFile(TaskList tasks) {
5757
public TaskList loadFromFile() {
5858
TaskList tasks = new TaskList();
5959
try {
60-
Scanner scanner = new Scanner(new File(this.FILEPATH));
60+
Scanner scanner = new Scanner(new File(this.filepath));
6161
while (scanner.hasNextLine()) {
6262
String line = scanner.nextLine();
6363
Task newTask = TaskFactory.createTaskFromFile(line);

src/main/java/procrastinaid/ui/ProcrastinAid.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ public String addTask(String userInp, TaskType type, Storage storage) throws Pro
9393
};
9494

9595
assert newTask != null : "New task should not be null";
96-
9796
storage.saveToFile(tasks);
9897
returnString += Ui.showTask(newTask) + "\n";
9998
returnString += Ui.showTaskListSize(tasks.getSize());

0 commit comments

Comments
 (0)