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.
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.
@jerryaldrichiii, can you explain why this location was chosen for the
require
? It would seem more typical to require in the top oflib/inspec/dsl.rb
, or inlib/inspec/profile_context.rb
(which is where the error appeared).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.
Great call out. I could use some words on describing the behavior succinctly. I believe the issue is because we are doing an
instance_eval
. The only places I could get it to work were to place the require here: https://github.com/inspec/inspec/blob/master/lib/inspec/profile_context.rb#L152 or the place you see it. I did the latter since it is closer toinspec/lib/inspec/dsl.rb
Line 36 in 8520859
Placing at the top of the files like you would expect leads me down a rabbit hole that I couldn't get to the bottom of (issues like not being able to find
Inspec::BaseCLI
).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.
If you'd like to pair or group work on this, I'd be happy to do so; I'm familiar with the missing require for BaseCLI from the plugin/v2/plugin_types/cli type. Simple fix there.
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.
Oh? Great! I'll bring it up in standup and we can get some time scheduled if the usual parking lot time doesn't cover it.