-
Notifications
You must be signed in to change notification settings - Fork 73
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
Include support for multiple reporter output types, solves #109 #181
Include support for multiple reporter output types, solves #109 #181
Conversation
hey @ccoVeille is it good to merge? |
Yes, that's why I approved 😁 |
@xanish Combining multiple reporters with |
@kehoecj i can implement it like chef inspec. Do you also want me to get rid of the file flag and then include file in the reporter flag separated by ":". Will have to use flag.Var to get multiple --reporter as an array then process it. Flags would be as follows |
Yes, that sounds great. So to summarize:
|
Done, lemme know if it is as expected 😄 |
Very nice! One last thing, I'm not sure the report should display to stdout if an output file is specified. What do you think? |
Hey @kehoecj so i was working on making standard reporter output to file as well since that would make things "standard" across all reporters. But I had one doubt currently all reporters when passed an output file print to stdout as well as output to file do we want to make sure it only does either of it? Like if output is specified then only write to file otherwise write to stdout. |
Yes, let's go ahead and standardize it:
@xanish What do you think? |
Ok so i made the changes and also merged main from upstream. I have a doubt regarding how the reporter flag will work with ENV, while testing i noticed that passing something like
uses both the env value and cli value EDIT: Ignore figured out the issue, flag.Parse() should happen before the env check and set logic |
Did you try |
Im kindof getting conflicting error with my local machine saying
and github action saying that it does not need space 😅
|
@ccoVeille Any ideas/suggestions? |
Here is what is expected I think cc @kehoecj |
…for validateReporterConf() and validateGroupByConf()
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.
The output for the standard reporter no longer colorizes the output or formats it properly:
✓ /tests/fixtures/exclude-file-types/excluded.json ✓ /tests/fixtures/exclude-file-types/not-excluded.toml ✓ /tests/fixtures/good.csv ✓ /tests/fixtures/good.editorconfig ✓ /tests/fixtures/good.env ✓ /tests/fixtures/good.hcl ✓ /tests/fixtures/good.hocon ✓ /tests/fixtures/good.ini ✓ /tests/fixtures/good.json ✓ /tests/fixtures/good.plist ✓ /tests/fixtures/good.properties ✓ /tests/fixtures/good.toml ✓ /tests/fixtures/good.yaml ✓ /tests/fixtures/mixedcase-extension/good.CSv ✓ /tests/fixtures/mixedcase-extension/good.HCl ✓ /tests/fixtures/mixedcase-extension/good.INi ✓ /tests/fixtures/mixedcase-extension/good.JSon ✓ /tests/fixtures/mixedcase-extension/good.PList ✓ /tests/fixtures/mixedcase-extension/good.PRoperties ✓ /tests/fixtures/mixedcase-extension/good.TOml ✓ /tests/fixtures/mixedcase-extension/good.YAml × /tests/fixtures/subdir/bad.json
error: Error at line 3 column 14: invalid character ':' after array element
× /tests/fixtures/subdir/bad.toml
error: Error at line 6 column 6: toml: expected character =
× /tests/fixtures/subdir/bad.yml
error: yaml: line 3: did not find expected '-' indicator
✓ /tests/fixtures/subdir/good.json × /tests/fixtures/subdir2/bad.csv
error: parse error on line 1, column 20: bare " in non-quoted-field
× /tests/fixtures/subdir2/bad.editorconfig
error: cannot load ini file: unclosed section: [*.md
× /tests/fixtures/subdir2/bad.env
error: Error at line 2: invalid escape sequence: "a"
× /tests/fixtures/subdir2/bad.hcl
error: error at line 1 column 1: :1,1-2: Invalid argument name; Argument names must not be quoted.
× /tests/fixtures/subdir2/bad.hocon
error: two adjacent commas at: 3:16, adjacent commas in arrays and objects are invalid!
× /tests/fixtures/subdir2/bad.ini
error: key-value delimiter not found: name value
× /tests/fixtures/subdir2/bad.json
error: Error at line 1 column 3: invalid character '}' looking for beginning of value
× /tests/fixtures/subdir2/bad.plist
error: plist: error parsing XML property list: missing value in dictionary
× /tests/fixtures/subdir2/bad.properties
error: circular reference in:
key=${key}
✓ /tests/fixtures/subdir2/good.ini ✓ /tests/fixtures/subdir2/good.json ✓ /tests/fixtures/uppercase-extension/good.CSV ✓ /tests/fixtures/uppercase-extension/good.HCL ✓ /tests/fixtures/uppercase-extension/good.INI ✓ /tests/fixtures/uppercase-extension/good.JSON ✓ /tests/fixtures/uppercase-extension/good.PLIST ✓ /tests/fixtures/uppercase-extension/good.PROPERTIES ✓ /tests/fixtures/uppercase-extension/good.TOML ✓ /tests/fixtures/uppercase-extension/good.YAML ✓ /tests/fixtures/with-depth/additional-depth/sample.json ✓ /tests/fixtures/with-depth/sample.json ✓ /tests/output/example/good.json ✓ /tests/output/example/result.json ✓ /tests/output/example/result.xml ✓ /tests/report.json ✓ /tests/report.xml ✓ /tests/scan.json ✓ /tests/scan.xml%
weird it works for me locally, did you merge main? i guess something must've broken. |
@kehoecj can you check now Also lemme know how do you want me to resolve the indentation thing |
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.
Final checks passed this morning. Thank you for the PR @xanish !
Hey,
I was learning Go and thought I'd try contributing to this repo. This merge solves the issue #109.
I have kept the input param as comma separated string since that was used on existing params like exclude-file-types.
I wasn't sure if we would need validation to prevent running in case reporters were passed as JSON and Standard but no output file was specified. Maybe we should add a validation to force output to be present so that it can write JSON to the file and still output to Stdout.
Do let me know in case I've missed something or any change is needed.