-
Notifications
You must be signed in to change notification settings - Fork 166
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
feat: continue-on-error flag for handling errors while processing multiple files #565
Conversation
Hi, I was wondering if this was ready to merge - I was looking into creating some batch tests for this functionality. Would it be better to add them to this PR or make a new PR? |
feel free to include them here, it would be good if they were executable using the regular tests or bats acceptance tests if necessary. Currently the PR needs to be rebased, as there are file conflicts. |
Hi, the batch tests have been added - with tons of help from @richscott (thanks!) We also made the decision to refactor/relocate some of the code from the main.go file into a util package. It was necessary to import certain functions and structs for the new batch tests which wasn't possible with the previous code organization. We hope this code relocation also helps in the future with extensibility. Excited to hear any thoughts on the changes 🙂 |
Thanks for adding tests for this! Can you rebase on the latest master? Otherwise I won't be able to merge the changes. Making main.go slim was something I had in mind as well as part of #499 so I don't mind the temporary utils package (utils is usually not the best pattern, because it just means that random stuff gets dropped into a single package), I'll work on the reorganization later once urfave/cli/v3 is out (splitting CLI parsing from the rest of the logic). |
- add continue-on-error flag as a command line option - if set, doesnt exit on error and continues processing other files that were passed in - add fatalErrorHandler to handle fatal errors - if continue-on-error flag is set, does not exit - add temporary tests for continue-on-error flag - add tests in batch-tests subdirectory
- Fix incorrect argument passing to log.Errorf and log.Fatalf functions - Remove debugging comments, temporary tests, and print statements - Address linter warnings related to error logging
Move a number of funcs/files in the top-level `main` package into a new `util` package, so test logic can directly invoke functions like RunMark(), etc. The main.go has been trimmed down to minimal sizing, with former supporting funcs moved into `util` package, so they can be run by unit tests. Signed-off-by: Rich Scott <[email protected]>
Signed-off-by: Rich Scott <[email protected]>
Signed-off-by: Rich Scott <[email protected]>
bf3903c
to
4778a8c
Compare
Hello, I was able to rebase the PR onto the master branch and it should be good to go. 🙂 |
I agree completely about the |
HI, @mrueg - can you (or anyone else with privileges on this repo) restart these CI checks on this PR? They had the error |
I've reached out to @kovetskiy a week ago, hope he find some time to respond. |
I would like the maintainer's thoughts on the overall idea / PR but also:
I have also added some tests in a temporary
batch-tests
directory so that the proposed functionality can be tested../mark --compile-only --continue-on-error -files "**/testdata/batch-tests/*.md"
Note: there is a pattern where we handle the error with
fatalErrorHandler
and thenreturn nil
after. I was not able to directlyreturn fatalErrorHandler(args...)
due to theprocessFile
function signature returning*confluence.PageInfo
. Any sidesteps / alternatives to this are also welcomed (we are able toreturn nil
since a pointer can be nil).Possible further enhancements: Outputting a errors.txt file for users containing the names (and maybe also error messages) of all the error'd files for easy retrial