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

Add CLI option to group reporter output #38

Closed
kehoecj opened this issue Sep 30, 2023 · 7 comments
Closed

Add CLI option to group reporter output #38

kehoecj opened this issue Sep 30, 2023 · 7 comments
Assignees
Labels
CLI Update to the CLI enhancement New feature or request

Comments

@kehoecj
Copy link
Contributor

kehoecj commented Sep 30, 2023

Description

The current output is displayed by the reporter as individual files without any grouping. Some users may want to have a customized grouping of the files in the output - for example grouping by file type, directory, pass/failed, etc. The options should be able to be combined/nested such as grouping by filetype within a directory

@kehoecj kehoecj added enhancement New feature or request CLI Update to the CLI hacktoberfest Hacktoberfest 2023 labels Sep 30, 2023
@abhishek-nigam
Copy link

abhishek-nigam commented Oct 6, 2023

Hi @kehoecj! I would like to pick this up. I have been working with Golang for some time, and I feel that this would be a challenging and fun feature for me to implement. Can I take a stab at this? Also, this would be my first open source contribution and I feel excited about it.

@kehoecj
Copy link
Contributor Author

kehoecj commented Oct 6, 2023

Hi @kehoecj! I would like to pick this up. I have been working with Golang for some time, and I feel that this would be a challenging and fun feature for me to implement. Can I take a stab at this? Also, this would be my first open source contribution and I feel excited about it.

Excited to have you contribute! I assigned you this issue

@kehoecj
Copy link
Contributor Author

kehoecj commented Oct 31, 2023

@abhishek-nigam Are you still interested in working this issue?

@jcsmurph
Copy link
Contributor

Hey @kehoecj , mind if I take this on?

I have the implementation done for passing a single value using -groupby (filetype, pass/fail, directory) done. Going to work on expanding it to allow for passing multiple values.

@kehoecj
Copy link
Contributor Author

kehoecj commented Nov 19, 2023

@jcsmurph it's yours!

@jcsmurph
Copy link
Contributor

jcsmurph commented Nov 19, 2023

Thanks! Couple of follow up questions:

  1. What possible groupings did you have in mind other than filetype, directory, and pass/fail?
  2. Did you want to separate the groupings by a comma or other? I.e. -groupby filetype,directory or -groupby filetype|directory etc.
  3. Should -groupby using the same commands but in different order return the same output? I.e. -groupby pass/fail,filetype returns the same as -groupby filetype,pass/fail. Or would we expect different results depending on order of the commands?

@kehoecj
Copy link
Contributor Author

kehoecj commented Nov 20, 2023

Thanks! Couple of follow up questions:

  1. What possible groupings did you have in mind other than filetype, directory, and pass/fail?
  2. Did you want to separate the groupings by a comma or other? I.e. -groupby filetype,directory or -groupby filetype|directory etc.
  3. Should -groupby using the same commands but in different order return the same output? I.e. -groupby pass/fail,filetype returns the same as -groupby filetype,pass/fail. Or would we expect different results depending on order of the commands?
  1. Can't think of anything else
  2. Comma
  3. It makes sense to me to have order matter, for example -groupby pass/fail,filetype would make pass/fail the primary grouping and then filetype would be the subgrouping under pass/fail

jcsmurph added a commit to jcsmurph/config-file-validator that referenced this issue Dec 11, 2023
shiina4119 pushed a commit to shiina4119/config-file-validator that referenced this issue Aug 23, 2024
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Update to the CLI enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants