-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A-RexCodeQuality #221
A-RexCodeQuality #221
Conversation
LGTM!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor indentation issues, otherwise LGTM!!👍
@@ -67,4 +67,5 @@ activate CustomerList | |||
Parser <-- CustomerList : return | |||
deactivate CustomerList | |||
deactivate Parser | |||
hide footbox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!! 👍
src/main/java/file/CustomerFile.java
Outdated
try { | ||
if(FileHandler.containEmptyParameter(parameters)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could add a space here after the if
and the closing )
bracket.
src/main/java/file/FileHandler.java
Outdated
@@ -99,6 +100,15 @@ private static void createFolder() { | |||
} | |||
} | |||
|
|||
public static boolean containEmptyParameter(String[] parameters){ | |||
for(int i = 0; i < parameters.length ; i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here maybe?? Add a space after the for
??
@@ -121,6 +126,7 @@ public void addTransactionWithParameters(String[] parameters , ArrayList<Integer | |||
boolean isCompleted = Boolean.parseBoolean(parameters[5]); | |||
Transaction transaction = new Transaction(transactionId , carLicensePlate, borrowerName, duration, | |||
startDate, isCompleted); | |||
|
|||
TransactionList.addTxWithoutPrintingInfo(transaction); | |||
}catch (NumberFormatException | DateTimeParseException | CarException | TransactionException e){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe leave a space here before catch
?
src/main/java/file/FileHandler.java
Outdated
@@ -99,6 +100,15 @@ private static void createFolder() { | |||
} | |||
} | |||
|
|||
public static boolean containEmptyParameter(String[] parameters){ | |||
for(int i = 0; i < parameters.length ; i++){ | |||
if(parameters[i].trim().isEmpty()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here?
while (scanner.hasNext()) { | ||
scanLineAndAddTransaction(scanner, errorLines, line); | ||
line ++; | ||
} | ||
|
||
if(!errorLines.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here?
@@ -89,6 +91,7 @@ public void loadTransactionDataIfExist(){ | |||
public void scanLineAndAddTransaction(Scanner scanner, ArrayList<Integer> errorLines, int line) { | |||
String input = scanner.nextLine(); | |||
String[] parameters = input.split(" \\| "); | |||
|
|||
if(parameters.length != Transaction.NUMBER_OF_PARAMETERS){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here as well?
@@ -109,9 +112,11 @@ public void addTransactionWithParameters(String[] parameters , ArrayList<Integer | |||
try { | |||
|
|||
String transactionId = parameters[0]; | |||
if(!Transaction.isValidTxId(transactionId)){ | |||
|
|||
if(!Transaction.isValidTxId(transactionId) || FileHandler.containEmptyParameter(parameters)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe here too??
improve error handling