Method: ParamComments#process
- Defined in:
- lib/puppet-lint-param_comment-check/param_comments.rb
#process(comments) ⇒ Object
Walk through every comment and transition the workflow fsm accordingly
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/puppet-lint-param_comment-check/param_comments.rb', line 78 def process(comments) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/AbcSize reset @current_comment = PuppetLint::Lexer::Token.new(:COMMENT, '', 1, 1) comments.each do |comment| @current_comment = comment # noinspection RubyCaseWithoutElseBlockInspection case comment.value when /@param/ # A parameter comment header @workflow.got_header(comment) when /@option/ # A hash option @workflow.got_option_header(comment) if @params_have_started when /^\s*$/ # An empty or whitespace-only comment, thus interpreted as a separator @workflow.got_separator(comment) if @params_have_started when / {2}[^ ]+/ # A description. Either for the parameter or a hash option @workflow.got_description(comment) if @params_have_started && !@in_option @workflow.got_option_description(comment) if @params_have_started && @in_option end end @params.append(@current_param) unless @current_param.nil? end |