Skip to content
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

Should we have a new validate() function? #48

Closed
torbengb opened this issue Oct 23, 2017 · 12 comments
Closed

Should we have a new validate() function? #48

torbengb opened this issue Oct 23, 2017 · 12 comments

Comments

@torbengb
Copy link
Member

torbengb commented Oct 23, 2017

As originally suggested here perhaps main() should call a new validate() function where a variety of validation checks could live?

  1. "Configuration file not found [...]"
  2. "Specified directory not found, attempting to find Downloads folder."
@torbengb
Copy link
Member Author

Note: Item 1 above already exists as closed ticket #20. If we decide to build that new function, the #20 code could be moved there.

@nocalla
Copy link
Member

nocalla commented Oct 25, 2017

I don't think this is a good idea, on further consideration. It goes against the try-except flow we're using. The CLI output at the moment is superfluous, I agree, but I don't think this is the right approach as it will end up duplicating code. I think a better approach would be to tell the user what folder is being used once the file list is found. I'll play with this a bit and get back to you.

@nocalla
Copy link
Member

nocalla commented Oct 25, 2017

Please review the code over in #58 and see what you think of the output.

@torbengb
Copy link
Member Author

goes against the try-except flow we're using

You're right. I like the idea of being consistent. I just tested #58 as you asked, using an invalid path, and it acted odd to me: first it complained about the directory not found, and then it processed a file, then it complained again, and processed the other file. I understand, technically, that it just does a fallback to the default which is where 2 files happen to be, but that doesn't rhyme with the error messages then. Thoughts?

@nocalla
Copy link
Member

nocalla commented Oct 25, 2017 via email

@torbengb
Copy link
Member Author

Do you feel this looks like what you expected:

Your specified download directory was not found: /home/torben/Downloadsx
Parsing file: elbi_umsaetze_20171024191306.csv
Using format: AT Raiffeisen Bank
Writing file: fixed_elbi_umsaetze_20171024191306.csv
Done!
Your specified download directory was not found: /home/torben/Downloadsx
Parsing file: finstatus_20171024191324.csv
Using format: AT Raiffeisen VISA
Writing file: fixed_finstatus_20171024191324.csv
Done!
2 files processed.

@nocalla
Copy link
Member

nocalla commented Oct 25, 2017

Yeah, that's what I would've expected. Maybe it would be better to specify the format first, but that makes sense to me.

@torbengb
Copy link
Member Author

I'm sorry but that output doesn't make sense to me as a user...

  • "First it says it can't find the download, and then it still processes something? How?" Maybe it should then also state what directory it defaults to. That would clear up some confusion.
  • "It has already told me once that it couldn't find my directory; small wonder that it still can't find it half a second later, eh?" I understand that it happens because of where it is in the code, but it doesn't look too smart.

I hope I didn't offend, it isn't meant to!

@nocalla
Copy link
Member

nocalla commented Oct 25, 2017 via email

@torbengb
Copy link
Member Author

necessary to state it for each section in case of custom directories being set in the individual formats.

That's a valid point!

@nocalla
Copy link
Member

nocalla commented Oct 25, 2017

Changed things around a bit. Example output below.

python bank2ynab.py
Format: AT Raiffeisen Bank
Can't find: c:\users\example-username\Downloads
Trying: D:\Users\nocalla\Downloads
Parsing file: elbi_umsaetze_ (2).csv
Writing file: fixed_elbi_umsaetze_ (2).csv
Removing file: elbi_umsaetze_ (2).csv
Done!
Format: IE Bank of Ireland
Can't find: c:\users\example-username\Downloads
Trying: D:\Users\nocalla\Downloads
Parsing file: test_BOI_TransactionExport.csv
Writing file: fixed_test_BOI_TransactionExport.csv
Removing file: test_BOI_TransactionExport.csv
Done!
2 files processed.

@nocalla
Copy link
Member

nocalla commented Oct 26, 2017

This should be resolved appropriately in master now.

@nocalla nocalla closed this as completed Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants