-
Notifications
You must be signed in to change notification settings - Fork 68
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
Add cli option to group reporter output. Closes #38 #92
Add cli option to group reporter output. Closes #38 #92
Conversation
Add -groupby command to group output by file type, pass/fail, and directory
Add: Validation for the groupby command and return error if value passed is not a valid command Add: Allow for multiple values for the groupby command
Reformatted the groupBy functions and groupBy validation
Added more test files for testing purposes
Updated the groupings to be done in reverse order. Updated the readme with information on the groupby command
Fixed the groupby directory function to group by the last directory in the path
Updated CLI tests
Fixed the cleanString funciton comment
closes #38 |
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.
@jcsmurph Thank you for the PR! I ran the Github action and it looks like there are a couple go fmt
issues
I'll re-review once comments are incorporated |
Co-authored-by: Jamie Davidson <51518462+jd4235@users.noreply.github.com>
Fixed formatting
Update pass/fail to pass-fail for validation checks
Fixed formatting indentation
Changed pass/fail to pass-fail for GroupBy routing
Changed pass/fail to pass-fail for documentation
Fixed formatting for groupBy string cleansing
Should be good to go now. It was a quick change to the standard out testing file. |
Looks like the new JUnit reporter needs to implement the groupBy print functions (either working or returning nil) or I could remove the groupBy print functions from the interface. @kehoecj What do you think? |
@jcsmurph Good question - I think Junit should be excluded from the groupby functionality. I don't see a lot of benefit to adding it since JUnit is really for processing. JUnit also has a pretty strict structure so I'm not even sure how feasible grouping it would be @jd4235 WDTY? |
I agree that JUnit should be excluded from the grouping. |
Sounds good. The options I am seeing are:
I should probably add a validation check for the flags if a user passes JUnit for the reporter, they cannot add a groupBy. That way the user gets the error immediately rather than after the validator has ran. |
Option 1 seems the cleanest to me. I agree with the validation check if a user passes groupby and junit |
Refactored the print groupBy functions to be removed from the Reporter Interface
Changes have been made and testing looks good on my end. I am noticing now with the support for case mixed filetypes, they get sorted differently depending on the case. E.g. Csv is sorted differently than csv, CsV, etc. Did you want me to take a look into changing that as part of this PR? Edit: I realized it was an easy change. They are all being sorted into the same group now 😅 |
Updated grouping for filetypes to group mixed cases
Updated the group_output.go to align to gofmt standards
I really need to figure out what is wrong with my local config and gofmt... Sorry, you can try the workflow again. It should validate this time. |
@jcsmurph I did a final functional test today running through several scenarios. There is currently an issue with
This was definitely working before so it may be something that was introduced with one of the latest sets of changes. All my other functional tests passed so this should be the last issue before I'm ready to merge |
@kehoecj If I understand correctly, it is grouping the test\fixtures\ and test\fixtures\exclude-file-types\ directories together? |
It's grouping everything under |
Got it. Seems to be Windows specific as I am not having the issue with my Linux setup but am with Windows. I will take a look. |
Updated the directory groupby to check if the filepath is in Windows
@kehoecj I made an update and it is working on my Windows machine now. Let me know if you see any other issues. |
LGTM! Thanks for the quick turnaround |
@jcsmurph One more issue - the change to fix windows dropped the coverage below the threshold. |
Added a test for the GroupBy directory flag for Windows and other directory paths
@kehoecj I added 2 tests for the directory GroupBy function to cover Windows file paths and others. That should hopefully get the test coverage back in the threshold. |
That did it - thanks! |
Merged - thank you for the great work on this PR @jcsmurph ! |
Awesome! I will keep an eye out for other issues I may want to tackle. |
* Add GroupBy command Add -groupby command to group output by file type, pass/fail, and directory * Add multiple groupby commands and validation Add: Validation for the groupby command and return error if value passed is not a valid command Add: Allow for multiple values for the groupby command * Add Tests Add: Added tests for cli_test.go and validator_test.go * Reformat groupBy Reformatted the groupBy functions and groupBy validation * Add Test Files Added more test files for testing purposes * Update grouping order and update readme Updated the groupings to be done in reverse order. Updated the readme with information on the groupby command * Fix groupby directory Fixed the groupby directory function to group by the last directory in the path * Update Tests Updated CLI tests * Fix Comment Fixed the cleanString funciton comment * Update README.md Co-authored-by: Jamie Davidson <51518462+jd4235@users.noreply.github.com> * Update cli_test.go Fixed formatting * Update validator.go Update pass/fail to pass-fail for validation checks * Update validator_test.go Fixed formatting indentation * Update group_output.go Changed pass/fail to pass-fail for GroupBy routing * Update README.md Changed pass/fail to pass-fail for documentation * Update validator.go Fixed formatting for groupBy string cleansing * Update group_output.go Updated indentation * Update validator.go Update flag to pass-fail * Update cli_test.go Update pass/fail to pass-fail * Update group_output.go Update GroupByPassFail comment to be consistent with pass-fail * Formatting fix Update to formatting * Add Group output Organized output for when groupby flag is set * Implement Group Output standard out Implementation of standard out using single and double groupbys * Implement Single Groupby JSON Implement the JSON output for a single groupby call * Refactor GroupBy Refactored groupBy when 2 values are passed * Refactor GroupByTwo Refactored groupby when 2 values are passed * Update to Stdout Update to standard out print * Implement JSON single group Implement output for JSON when single group is passed * Implement JSON double group and tests Implemented the JSON output for when two groupbys are passed. Also added test cases in the CLI path * Update go fmt Updated running go fmt * Implement triple group output Implement output for when 3 groupbys are passed * Add Output Tests Added output tests for groupby outputs * Clean comments Cleaned up comments * Changed Summary Format Changed the summary per group to be aligned with the inner most group rather than the tests * Update README.md Co-authored-by: Clayton Kehoe <118750525+kehoecj@users.noreply.github.com> * Update cmd/validator/validator.go Update file type to filetype to avoid input confusion Co-authored-by: Clayton Kehoe <118750525+kehoecj@users.noreply.github.com> * Add Header Comments Added header comments to the stdout and json reporters * Fix Naming Conflict Fixed a naming conflict in the json reporter groupby when 3 groups are passed * Add Util function for Json Reporter Added a utility function to the JSON reporter to reduce duplicated code. * Rename Utility Function Renamed the utility function and added a header comment * Rename Utility Function Calls Renamed the utility function calls to the correct name * Update JSON Print Updated the JSON print to use the utility function * Update STD Reporter Test Updated the standard reporter tests to align with groupby function changes * Refactor Reporter Refactored the print groupBy functions to be removed from the Reporter Interface * Update GroupBy Filetype Updated grouping for filetypes to group mixed cases * GoFmt update Updated the group_output.go to align to gofmt standards * Update directory groupby Updated the directory groupby to check if the filepath is in Windows * Add GroupBy Directory test Added a test for the GroupBy directory flag for Windows and other directory paths --------- Co-authored-by: Jamie Davidson <51518462+jd4235@users.noreply.github.com> Co-authored-by: Clayton Kehoe <118750525+kehoecj@users.noreply.github.com>
* Add GroupBy command Add -groupby command to group output by file type, pass/fail, and directory * Add multiple groupby commands and validation Add: Validation for the groupby command and return error if value passed is not a valid command Add: Allow for multiple values for the groupby command * Add Tests Add: Added tests for cli_test.go and validator_test.go * Reformat groupBy Reformatted the groupBy functions and groupBy validation * Add Test Files Added more test files for testing purposes * Update grouping order and update readme Updated the groupings to be done in reverse order. Updated the readme with information on the groupby command * Fix groupby directory Fixed the groupby directory function to group by the last directory in the path * Update Tests Updated CLI tests * Fix Comment Fixed the cleanString funciton comment * Update README.md Co-authored-by: Jamie Davidson <51518462+jd4235@users.noreply.github.com> * Update cli_test.go Fixed formatting * Update validator.go Update pass/fail to pass-fail for validation checks * Update validator_test.go Fixed formatting indentation * Update group_output.go Changed pass/fail to pass-fail for GroupBy routing * Update README.md Changed pass/fail to pass-fail for documentation * Update validator.go Fixed formatting for groupBy string cleansing * Update group_output.go Updated indentation * Update validator.go Update flag to pass-fail * Update cli_test.go Update pass/fail to pass-fail * Update group_output.go Update GroupByPassFail comment to be consistent with pass-fail * Formatting fix Update to formatting * Add Group output Organized output for when groupby flag is set * Implement Group Output standard out Implementation of standard out using single and double groupbys * Implement Single Groupby JSON Implement the JSON output for a single groupby call * Refactor GroupBy Refactored groupBy when 2 values are passed * Refactor GroupByTwo Refactored groupby when 2 values are passed * Update to Stdout Update to standard out print * Implement JSON single group Implement output for JSON when single group is passed * Implement JSON double group and tests Implemented the JSON output for when two groupbys are passed. Also added test cases in the CLI path * Update go fmt Updated running go fmt * Implement triple group output Implement output for when 3 groupbys are passed * Add Output Tests Added output tests for groupby outputs * Clean comments Cleaned up comments * Changed Summary Format Changed the summary per group to be aligned with the inner most group rather than the tests * Update README.md Co-authored-by: Clayton Kehoe <118750525+kehoecj@users.noreply.github.com> * Update cmd/validator/validator.go Update file type to filetype to avoid input confusion Co-authored-by: Clayton Kehoe <118750525+kehoecj@users.noreply.github.com> * Add Header Comments Added header comments to the stdout and json reporters * Fix Naming Conflict Fixed a naming conflict in the json reporter groupby when 3 groups are passed * Add Util function for Json Reporter Added a utility function to the JSON reporter to reduce duplicated code. * Rename Utility Function Renamed the utility function and added a header comment * Rename Utility Function Calls Renamed the utility function calls to the correct name * Update JSON Print Updated the JSON print to use the utility function * Update STD Reporter Test Updated the standard reporter tests to align with groupby function changes * Refactor Reporter Refactored the print groupBy functions to be removed from the Reporter Interface * Update GroupBy Filetype Updated grouping for filetypes to group mixed cases * GoFmt update Updated the group_output.go to align to gofmt standards * Update directory groupby Updated the directory groupby to check if the filepath is in Windows * Add GroupBy Directory test Added a test for the GroupBy directory flag for Windows and other directory paths --------- Co-authored-by: Jamie Davidson <51518462+jd4235@users.noreply.github.com> Co-authored-by: Clayton Kehoe <118750525+kehoecj@users.noreply.github.com>
Added the option to group the report output by directory, filetype, or pass/fail using
-groupby
. The option can use one or more commands to organize the report output.