-
Notifications
You must be signed in to change notification settings - Fork 680
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
JSON formatter redesign #671
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e55fa38
to
1f22ab5
Compare
1f22ab5
to
7c3145e
Compare
This is working great. As discussed with @arlimus I renamed |
e467557
to
16dfa65
Compare
Full rewrite of all formatters. Create a minimal JSON, a full JSON, and a fallback RSpec formatter. The latter is only needed for corner cases and should not really be used. The former 2 are for (1) running `inspec json` followed by `inspec exec` (`--format json`) and (2) running just `inspec exec --format fulljson`.
this happens when the profile is run (exec) and also interpreted (via profile.params). It will load 2 profile context calls (both via Runner) which in turn gets 2 rounds of interpreter+runner executions. This is an issue with auto-generated IDs, due to their random component, which changes in this case
16dfa65
to
8258d11
Compare
Thanks 💯 @arlimus for this improvement! |
The formatter names are as following:
You can call those via:
|
This was referenced May 6, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current JSON output formatter follows rspec conventions:
We added
id
andimpact
, but the latter can be inferred from the profile's JSON representation retrieved viainspec json
. This output is also focused on examples, i.e. tests within control blocks, which didn't help with controls in inspec.Because there is a difference between integration-test driven by
describe
-blocks and more security-orientedcontrol
-blocks, we had added thefulljson
formatter:It is still very rspec-centric and doesnt connect examples/checks to their controls. Bringing these two concepts together and ligning it with the JSON representation of profiles has been a burden.
Goal
The goal of this MR is to consolidate JSON formatters:
rspecjson
json
the default and minimal formatter for JSON; It identifies checks and controlsjson
formatter is designed to be used standalone or with a profile's JSON representation viainspec json
fulljson
formatter is now fully aligned to the profile's JSON representation; it offers all information availablejson
is geared towards integration tests,fulljson
towards security testingjson
formatter:fulljson
formatter:Skip/Pending
Skipped resources used to be marked as
pending
in previous formatters:They are now marked as
skipped
instead with the skip message injson
andfulljson
formatters:ID redesign
InSpec had a mode where you could supply tests with a grouping ID:
This functionality was removed, as it didn't serve a use-case anymore. All
--id
options were removed. Instead, in preparation for better exposure on inheritance, we now provide the profile's namespace as the grouping mechanism: