Class: PuppetLint::LineLengthCheck
- Inherits:
-
Object
- Object
- PuppetLint::LineLengthCheck
- Defined in:
- lib/puppet-lint/plugins/check_whitespace/line_length.rb
Overview
A utility class for checking the length of a given string.
Class Method Summary collapse
-
.check(line_number, content, character_count) ⇒ Array
Check the current line to determine if it is more than character_count and record a warning if an instance is found.
Class Method Details
.check(line_number, content, character_count) ⇒ Array
Check the current line to determine if it is more than character_count and record a warning if an instance is found. The only exceptions to this rule are lines containing URLs and template() calls which would hurt readability if split.
Can be passed directly to notify..
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/puppet-lint/plugins/check_whitespace/line_length.rb', line 14 def self.check(line_number, content, character_count) return if content.include? '://' return if content.include? 'template(' return unless content.scan(%r{.}mu).size > character_count [ :warning, { message: "line has more than #{character_count} characters", line: line_number, column: character_count, description: "Test the raw manifest string for lines containing more than #{character_count} characters and record a warning for each instance found. " \ 'The only exceptions to this rule are lines containing URLs and template() calls which would hurt readability if split.', help_uri: 'https://puppet.com/docs/puppet/latest/style_guide.html#spacing-indentation-and-whitespace' }, ] end |