codeqa 0.4.0.pre2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b47b37862da4f231fa163a9161ea66758c543de5
4
- data.tar.gz: a36f9e4ac2f21942121b32be320dccfbf0198b17
3
+ metadata.gz: cb14655f903fb0f5d90f7951a2d19c4cf2711b2b
4
+ data.tar.gz: e4ca534c7c1d8889642c9cd8f5f51f248a37884b
5
5
  SHA512:
6
- metadata.gz: 23e80489e8084d42a8d3a7c760bd70af2a34f7023fa9612c507d0800e8cd334e06164b9e366a277c263a2b639a674db69ee191b314cf159b4e3f1dbf5d2c9419
7
- data.tar.gz: f1c7db9caef0fed024e0f6a64d6de6dc931adfbed55c37718eeab541a3861cbc0f834329034b734bf7e07329e78cee9c311fa62094cb2c1df21901d4d4a058c7
6
+ metadata.gz: 64b5071a1fc28a0a15eb6485c00c6278581dfe819eac401db80c3b02c0329de70e434c65ce22bd9f0483fea93a5478b9cebf009f9c9dc4408101de4554392214
7
+ data.tar.gz: 6f7852a8eadd489496b95e06f0b1040e2d251dc7d3745c3e40dc0fdba314ccde9d8eb17c4b30ca9af2e668b98fd34d10a54b06512983be278583467bca98141c
@@ -21,7 +21,7 @@ module Codeqa
21
21
  end
22
22
 
23
23
  REMOVED_NOKOGIRI_ERRORS = Regexp.union(
24
- /Opening and ending tag mismatch: (special line 1|\w+ line 1 and special)/,
24
+ /Opening and ending tag mismatch: (special line 1|\w+ line \d* and special)/,
25
25
  /Premature end of data in tag special/,
26
26
  /Extra content at the end of the document/,
27
27
  /xmlParseEntityRef: no name/,
@@ -39,10 +39,12 @@ module Codeqa
39
39
  end
40
40
 
41
41
  def stripped_html
42
- ErbSanitizer.
43
- new(sourcefile.content).
44
- result.
45
- gsub(%r{<script[ >](.*)</script>}m){ "<!-- script#{"\n" * $1.scan("\n").count} /script -->" }
42
+ @stripped_html ||= ErbSanitizer.
43
+ new(sourcefile.content).
44
+ result.
45
+ gsub(%r{<script[ >](.*?)</script>}m) do
46
+ "<!-- script#{"\n" * $1.scan("\n").count} /script -->"
47
+ end
46
48
  end
47
49
 
48
50
  def self.nokogiri?
@@ -36,8 +36,8 @@ module Codeqa
36
36
  def error_details
37
37
  msg = ''
38
38
  @runner.failures.each do |checker|
39
- msg << error("------- #{checker.name} -------") << "\n"
40
- msg << error("#{checker.hint}") << "\n"
39
+ # msg << error("------- #{checker.name} -------") << "\n"
40
+ # msg << error("#{checker.hint}") << "\n"
41
41
  checker.errors.details.each do |type, content|
42
42
  case type
43
43
  when :source
@@ -1,3 +1,3 @@
1
1
  module Codeqa
2
- VERSION = '0.4.0.pre2'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -86,6 +86,32 @@ EOR
86
86
 
87
87
  /script -->
88
88
  </div>
89
+ EOR
90
+ end
91
+ it 'should replace script tags when there are multiple script tags in the text' do
92
+ text = <<-EOR
93
+ <div>
94
+ <script>
95
+ var some = 'javascript';
96
+ </script>
97
+ content
98
+ <script>
99
+ console.log(some);
100
+ </script>
101
+ </div>
102
+ EOR
103
+ source = source_with(text)
104
+ checker = described_class.new(source)
105
+ expect(checker.stripped_html).to eq(<<-EOR)
106
+ <div>
107
+ <!-- script
108
+
109
+ /script -->
110
+ content
111
+ <!-- script
112
+
113
+ /script -->
114
+ </div>
89
115
  EOR
90
116
  end
91
117
  end
@@ -15,8 +15,6 @@ describe Codeqa::RunnerDecorator do
15
15
  it 'should format error as line if number given' do
16
16
  errors.add(77, 'test message')
17
17
  expect(decorator.details_to_s).to eq(<<-EOF)
18
- \e[31m------- test -------\e[0m
19
- \e[31mtesttest\e[0m
20
18
  Line: \e[33m77\e[0m|test message
21
19
  EOF
22
20
  end
@@ -24,8 +22,6 @@ EOF
24
22
  it 'should format error as position if array given' do
25
23
  errors.add([22, 77], 'test message')
26
24
  expect(decorator.details_to_s).to eq(<<-EOF)
27
- \e[31m------- test -------\e[0m
28
- \e[31mtesttest\e[0m
29
25
  Pos: \e[33m22,77\e[0m|test message
30
26
  EOF
31
27
  end
@@ -33,8 +29,6 @@ EOF
33
29
  it 'should simply print error content if no context is given' do
34
30
  errors.add(nil, 'test message')
35
31
  expect(decorator.details_to_s).to eq(<<-EOF)
36
- \e[31m------- test -------\e[0m
37
- \e[31mtesttest\e[0m
38
32
  test message
39
33
  EOF
40
34
  end
@@ -42,8 +36,6 @@ EOF
42
36
  it 'should format error as source if :source token given' do
43
37
  errors.add(:source, 'test message')
44
38
  expect(decorator.details_to_s).to eq(<<-EOF)
45
- \e[31m------- test -------\e[0m
46
- \e[31mtesttest\e[0m
47
39
  \e[33m 1\e[0m|test message
48
40
  EOF
49
41
  end
@@ -51,8 +43,6 @@ EOF
51
43
  it 'should correctly format multiline source' do
52
44
  errors.add(:source, "test message\nline two\nthird\n\nfifth")
53
45
  expect(decorator.details_to_s).to eq(<<-EOF)
54
- \e[31m------- test -------\e[0m
55
- \e[31mtesttest\e[0m
56
46
  \e[33m 1\e[0m|test message
57
47
  \e[33m 2\e[0m|line two
58
48
  \e[33m 3\e[0m|third
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeqa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.pre2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Schrammel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-27 00:00:00.000000000 Z
12
+ date: 2014-08-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -191,9 +191,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
191
191
  version: '2.0'
192
192
  required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  requirements:
194
- - - ">"
194
+ - - ">="
195
195
  - !ruby/object:Gem::Version
196
- version: 1.3.1
196
+ version: '0'
197
197
  requirements: []
198
198
  rubyforge_project:
199
199
  rubygems_version: 2.2.2