-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This changes most heredocs to use the tilde syntax with variable interpolation off. It indents the contents of the heredoc along with the final symbol. To maintain these changes, it enables `Layout/HeredocIndentation` and `Layout/ClosingHeredocIndentation` in Rubocop. The tilde syntax smartly strips the indentation, and allows for different indention of the closing identifier: ```ruby "test\n" == <<~'END' test END ``` This syntax was introduced in Ruby 2.3.0, so this will not pose compatibility problems. ### Tests that should fail Note that two tests couldn’t be updated to a more common heredoc format to avoid failing. It appears there is a problem with the way YARD parses parameters with defaults with a heredoc ([YARD #779][]). There is a work-around for that issue in `PuppetStrings::Yard::Handlers::Ruby::Base`, but it can’t work in these cases because YARD doesn’t provide enough source to read the whole heredoc content. Given that these are tests of the Puppet 3 style functions, it’s probably not worth pursuing this issue. [YARD #779]: lsegal/yard#779
- Loading branch information
1 parent
371e37f
commit d59619d
Showing
26 changed files
with
1,498 additions
and
1,711 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
# An example 3.x function | ||
Puppet::Parser::Functions.newfunction(:func3x, doc: <<-DOC | ||
Documentation for an example 3.x function. | ||
@param param1 [String] The first parameter. | ||
@param param2 [Integer] The second parameter. | ||
@return [Undef] | ||
@example Calling the function. | ||
func3x('hi', 10) | ||
DOC | ||
) do |*args| | ||
#... | ||
Puppet::Parser::Functions.newfunction(:func3x, doc: <<~'DOC') do |*args| | ||
Documentation for an example 3.x function. | ||
@param param1 [String] The first parameter. | ||
@param param2 [Integer] The second parameter. | ||
@return [Undef] | ||
@example Calling the function. | ||
func3x('hi', 10) | ||
DOC | ||
# ... | ||
end |
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
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
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
Oops, something went wrong.