Skip to content

Commit

Permalink
Ignore indentation in multiline xml comments
Browse files Browse the repository at this point in the history
  • Loading branch information
greeneca committed Jan 6, 2020
1 parent acebc72 commit 1c1f48b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
16 changes: 12 additions & 4 deletions CHANGELOG
@@ -1,10 +1,18 @@
= 4.20.2 =
= 4.21.3 =

-Fix bundler load paths for later versions of ruby
- Ignore indentation in multi-line xml comments

= 4.20.1 =
= 4.21.2 =

-Add indent-ignore and indent-reset comment processing to analyzer
- Fix bundler load paths for later versions of ruby

= 4.21.1 =

- Add indent-ignore and indent-reset comment processing to analyzer

= 4.21.0 =

- Add post stage/unstage hooks

= 4.20.0 =

Expand Down
6 changes: 3 additions & 3 deletions lib/roku_builder/plugins/indentation_inspector.rb
Expand Up @@ -13,11 +13,11 @@ def initialize(rules:, path:)
@ind = 0
end

def check_line(line:, number:)
#byebug if number == 43 and @path.ends_with?("keyEvents.brs")
def check_line(line:, number:, comment:)
#byebug if number == 10 and @path.ends_with?(".brs")
set_indentation(line: line)
regexp = /^#{@character}{#{@ind}}[^#{@character}]/
unless line =~ regexp or line == "\n" or line =~ /\'indent-ignore/
unless line =~ regexp or line == "\n" or line =~ /\'indent-ignore/ or comment
add_warning(line: number)
end
@prev_line = line
Expand Down
2 changes: 1 addition & 1 deletion lib/roku_builder/plugins/line_inspector.rb
Expand Up @@ -14,7 +14,6 @@ def run(file_path)
in_xml_comment = false
indent_inspector = IndentationInspector.new(rules: @indent_config, path: file_path) if @indent_config
file.readlines.each_with_index do |line, line_number|
indent_inspector.check_line(line: line, number: line_number) if indent_inspector
full_line = line.dup
line = line.partition("'").first if file_path.end_with?(".brs")
if file_path.end_with?(".xml")
Expand All @@ -28,6 +27,7 @@ def run(file_path)
line.gsub!(/<!--.*-->/, "")
in_xml_comment = true if line.gsub!(/<!--.*/, "")
end
indent_inspector.check_line(line: full_line, number: line_number, comment: in_xml_comment) if indent_inspector
@inspector_config.each do |line_inspector|
line_to_check = line
line_to_check = full_line if line_inspector[:include_comments]
Expand Down
2 changes: 1 addition & 1 deletion lib/roku_builder/version.rb
Expand Up @@ -2,5 +2,5 @@

module RokuBuilder
# Version of the RokuBuilder Gem
VERSION = "4.21.2"
VERSION = "4.21.3"
end

0 comments on commit 1c1f48b

Please sign in to comment.