roku_builder 4.25.6 → 4.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/roku_builder/plugins/line_inspector.rb +27 -6
- data/lib/roku_builder/version.rb +1 -1
- data/test/roku_builder/plugins/test_analyzer.rb +19 -0
- data/test/roku_builder/test_files/analyzer_test/dont_use_hello_world.json +11 -0
- data/test/roku_builder/test_files/analyzer_test/linter_positive_match.json +13 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cef81268ceb5755dd1f33511fb33d40231b82f148b1cab085674a640a84422f
|
4
|
+
data.tar.gz: b76b0aec49eb4a465793cbe2db2e504aaef61c6ca5e0202e4365521c5f665ab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d85a36f9aa407e5b7cb5927f98ffca2d0c3ec67ca3282b3371c75abe41ea0378fef06fe06917d85c00e248f64aa6af4265850a15bf4bd9bd47ba22c208b8ef3
|
7
|
+
data.tar.gz: 24573d389ea6c02a025512e6ec0092adbe3934d0b0322a9ca8a0aef47b2cc6f311ee8b3b945c9b63201a7eaed2532a925f0243971d069341aa16ddc6cd69352c
|
@@ -47,17 +47,38 @@ module RokuBuilder
|
|
47
47
|
match = nil
|
48
48
|
start = 0
|
49
49
|
loop do
|
50
|
+
stop = to_check.length-1
|
51
|
+
pass_match = nil
|
52
|
+
if line_inspector[:pass_if_match]
|
53
|
+
if line_inspector[:case_sensitive]
|
54
|
+
pass_match = /#{line_inspector[:pass_test_regexp]}/.match(to_check[start..stop])
|
55
|
+
else
|
56
|
+
pass_match = /#{line_inspector[:pass_test_regexp]}/i.match(to_check[start..stop])
|
57
|
+
end
|
58
|
+
break unless pass_match
|
59
|
+
stop = to_check.index("\n", start)
|
60
|
+
stop ||= to_check.length-1
|
61
|
+
end
|
50
62
|
if line_inspector[:case_sensitive]
|
51
|
-
match = /#{line_inspector[:regex]}/.match(to_check
|
63
|
+
match = /#{line_inspector[:regex]}/.match(to_check[start..stop])
|
52
64
|
else
|
53
|
-
match = /#{line_inspector[:regex]}/i.match(to_check
|
65
|
+
match = /#{line_inspector[:regex]}/i.match(to_check[start..stop])
|
54
66
|
end
|
55
|
-
if match
|
56
|
-
|
57
|
-
|
67
|
+
if (not line_inspector[:pass_if_match] and match) or (line_inspector[:pass_if_match] and not match)
|
68
|
+
error_match = match
|
69
|
+
if match
|
70
|
+
start = match.end(0)
|
71
|
+
line_number = to_check[0..match.begin(0)].split("\n", -1).count - 1
|
72
|
+
else
|
73
|
+
error_match = pass_match
|
74
|
+
line_number = to_check[0..start].split("\n", -1).count - 1
|
75
|
+
start = stop
|
76
|
+
end
|
58
77
|
unless lines_to_ignore.include?(line_number)
|
59
|
-
add_warning(inspector: line_inspector, file: file_path, line: line_number, match:
|
78
|
+
add_warning(inspector: line_inspector, file: file_path, line: line_number, match: error_match)
|
60
79
|
end
|
80
|
+
elsif line_inspector[:pass_if_match]
|
81
|
+
start = stop +1
|
61
82
|
else
|
62
83
|
break
|
63
84
|
end
|
data/lib/roku_builder/version.rb
CHANGED
@@ -26,6 +26,8 @@ module RokuBuilder
|
|
26
26
|
def teardown
|
27
27
|
manifest = File.join(@root_dir, "manifest")
|
28
28
|
FileUtils.rm(manifest) if File.exist?(manifest)
|
29
|
+
linter_config = File.join(@root_dir, ".roku_builder_linter.json")
|
30
|
+
FileUtils.rm(linter_config) if File.exist?(linter_config)
|
29
31
|
@request_stubs.each {|req| remove_request_stub(req)}
|
30
32
|
end
|
31
33
|
def test_analyzer_parse_commands
|
@@ -100,10 +102,27 @@ module RokuBuilder
|
|
100
102
|
warnings = test_file(text: "For each button in buttons\n ? button\nEND FOR")
|
101
103
|
assert_equal 0, warnings.count
|
102
104
|
end
|
105
|
+
def test_linter_checks
|
106
|
+
set_linter_config("dont_use_hello_world.json")
|
107
|
+
warnings = test_file(text: "hello world")
|
108
|
+
assert_equal 1, warnings.count
|
109
|
+
end
|
110
|
+
def test_linter_positive_match
|
111
|
+
set_linter_config("linter_positive_match.json")
|
112
|
+
warnings = test_file(text: "hello world\nhello moon")
|
113
|
+
assert_equal 1, warnings.count
|
114
|
+
assert_equal 1, warnings.first[:line]
|
115
|
+
end
|
103
116
|
|
104
117
|
|
105
118
|
private
|
106
119
|
|
120
|
+
def set_linter_config(config_file = nil)
|
121
|
+
if config_file
|
122
|
+
FileUtils.cp(File.join(@root_dir, config_file), File.join(@root_dir, ".roku_builder_linter.json"))
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
107
126
|
def test_manifest(manifest_file = nil)
|
108
127
|
if manifest_file
|
109
128
|
use_manifest(manifest_file)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roku_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- greeneca
|
@@ -543,6 +543,7 @@ files:
|
|
543
543
|
- test/roku_builder/test_config_validator.rb
|
544
544
|
- test/roku_builder/test_device_manager.rb
|
545
545
|
- test/roku_builder/test_files/analyzer_test/analyzer_config.json
|
546
|
+
- test/roku_builder/test_files/analyzer_test/dont_use_hello_world.json
|
546
547
|
- test/roku_builder/test_files/analyzer_test/images/focus.png
|
547
548
|
- test/roku_builder/test_files/analyzer_test/images/focus_hd.png
|
548
549
|
- test/roku_builder/test_files/analyzer_test/images/focus_sd.png
|
@@ -550,6 +551,7 @@ files:
|
|
550
551
|
- test/roku_builder/test_files/analyzer_test/images/splash_hd.png
|
551
552
|
- test/roku_builder/test_files/analyzer_test/images/splash_sd.png
|
552
553
|
- test/roku_builder/test_files/analyzer_test/images/too_small.png
|
554
|
+
- test/roku_builder/test_files/analyzer_test/linter_positive_match.json
|
553
555
|
- test/roku_builder/test_files/analyzer_test/manifest_depricated_attribute
|
554
556
|
- test/roku_builder/test_files/analyzer_test/manifest_duplicate_attribute
|
555
557
|
- test/roku_builder/test_files/analyzer_test/manifest_empty_value
|
@@ -672,6 +674,7 @@ test_files:
|
|
672
674
|
- test/roku_builder/test_config_validator.rb
|
673
675
|
- test/roku_builder/test_device_manager.rb
|
674
676
|
- test/roku_builder/test_files/analyzer_test/analyzer_config.json
|
677
|
+
- test/roku_builder/test_files/analyzer_test/dont_use_hello_world.json
|
675
678
|
- test/roku_builder/test_files/analyzer_test/images/focus.png
|
676
679
|
- test/roku_builder/test_files/analyzer_test/images/focus_hd.png
|
677
680
|
- test/roku_builder/test_files/analyzer_test/images/focus_sd.png
|
@@ -679,6 +682,7 @@ test_files:
|
|
679
682
|
- test/roku_builder/test_files/analyzer_test/images/splash_hd.png
|
680
683
|
- test/roku_builder/test_files/analyzer_test/images/splash_sd.png
|
681
684
|
- test/roku_builder/test_files/analyzer_test/images/too_small.png
|
685
|
+
- test/roku_builder/test_files/analyzer_test/linter_positive_match.json
|
682
686
|
- test/roku_builder/test_files/analyzer_test/manifest_depricated_attribute
|
683
687
|
- test/roku_builder/test_files/analyzer_test/manifest_duplicate_attribute
|
684
688
|
- test/roku_builder/test_files/analyzer_test/manifest_empty_value
|