8000 Merge branch 'master' into fix-javascript-regexp · BearerPipelineTest/coderay@54268a9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 54268a9

Browse files
committed
Merge branch 'master' into fix-javascript-regexp
2 parents e3228fa + b5b3430 commit 54268a9

File tree

10 files changed

+43
-17
lines changed

10 files changed

+43
-17
lines changed

.codeclimate.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: "2"
2+
checks:
3+
argument-count:
4+
enabled: false
5+
complex-logic:
6+
enabled: false
7+
file-lines:
8+
enabled: false
9+
identical-code:
10+
enabled: false
11+
method-complexity:
12+
enabled: false
13+
method-count:
14+
enabled: false
15+
method-lines:
16+
enabled: false
17+
nested-control-flow:
18+
enabled: false
19+
return-statements:
20+
enabled: false
21+
similar-code:
22+
enabled: false
23+
plugins:
24+
rubocop:
25+
enabled: true
26+
channel: rubocop-0-76

lib/coderay/scanners/c.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class C < Scanner
3737
add(PREDEFINED_CONSTANTS, :predefined_constant) # :nodoc:
3838

3939
ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc:
40-
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
40+
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
4141

4242
protected
4343

lib/coderay/scanners/cpp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class CPlusPlus < Scanner
4949
add(PREDEFINED_CONSTANTS, :predefined_constant) # :nodoc:
5050

5151
ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc:
52-
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
52+
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
5353

5454
protected
5555

lib/coderay/scanners/diff.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def scan_tokens encoder, options
109109
for deleted_line, inserted_line in deleted_lines.zip(inserted_lines)
110110
pre, deleted_part, inserted_part, post = diff deleted_line, inserted_line
111111
content_scanner_entry_state = content_scanner.state
112-
deleted_lines_tokenized << content_scanner.tokenize([pre, deleted_part, post], :tokens => Tokens.new)
112+
deleted_lines_tokenized << content_scanner.tokenize([pre, deleted_part, post], :tokens => Tokens.new)
113113
content_scanner.state = content_scanner_entry_state || :initial
114114
inserted_lines_tokenized << content_scanner.tokenize([pre, inserted_part, post], :tokens => Tokens.new)
115115
end
@@ -212,7 +212,7 @@ def diff a, b
212212
# does not precede the leftmost one from the left.
213213
j = -1
214214
j -= 1 while j >= j_min && a[j] == b[j]
215-
return a[0...i], a[i..j], b[i..j], (j < -1) ? a[j+1..-1] : ''
215+
return a[0...i], a[i..j], b[i..j], (j < -1) ? a[j + 1..-1] : ''
216216
end
217217

218218
end

lib/coderay/scanners/groovy.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class Groovy < Java
2222
add(GROOVY_MAGIC_VARIABLES, :local_variable) # :nodoc:
2323

2424
ESCAPE = / [bfnrtv$\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc:
25-
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x # :nodoc: no 4-byte unicode chars? U[a-fA-F0-9]{8}
26-
REGEXP_ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} | \d | [bBdDsSwW\/] /x # :nodoc:
25+
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x # :nodoc: no 4-byte unicode chars? U[a-fA-F0-9]{8}
26+
REGEXP_ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} | \d | [bBdDsSwW\/] /x # :nodoc:
2727

2828
# TODO: interpretation inside ', ", /
2929
STRING_CONTENT_PATTERN = {

lib/coderay/scanners/java.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Java < Scanner
3838
add(DIRECTIVES, :directive) # :nodoc:
3939

4040
ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc:
41-
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
41+
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
4242
STRING_CONTENT_PATTERN = {
4343
"'" => /[^\\']+/,
4444
'"' => /[^\\"]+/,

lib/coderay/scanners/python.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Python < Scanner
6363

6464
NAME = / [[:alpha:]_] \w* /x # :nodoc:
6565
ESCAPE = / [abfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc:
66-
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} | N\{[-\w ]+\} /x # :nodoc:
66+
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} | N\{[-\w ]+\} /x # :nodoc:
6767

6868
OPERATOR = /
6969
\.\.\. | # ellipsis

lib/coderay/scanners/ruby/patterns.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module Ruby::Patterns # :nodoc: all
6060

6161
QUOTE_TO_TYPE = {
6262
'`' => :shell,
63-
'/'=> :regexp,
63+
'/' => :regexp,
6464
}
6565
QUOTE_TO_TYPE.default = :string
6666

rake_tasks/code_statistics.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def print_code_test_stats
156156
code = calculate_code
157157
tests = calculate_tests
158158

159-
puts " Code LOC = #{code} Test LOC = #{tests} Code:Test Ratio = [1 : #{sprintf("%.2f", tests.to_f/code)}]"
159+
puts " Code LOC = #{code} Test LOC = #{tests} Code:Test Ratio = [1 : #{sprintf("%.2f", tests.to_f / code)}]"
160160
puts ""
161161
end
162162

test/unit/json_encoder.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ def test_json_output
1010
$:.delete File.dirname(__FILE__)
1111
json = CodeRay.scan('puts "Hello world!"', :ruby).json
1212
assert_equal [
13-
{"type"=>"text", "text"=>"puts", "kind"=>"ident"},
14-
{"type"=>"text", "text"=>" ", "kind"=>"space"},
15-
{"type"=>"block", "action"=>"open", "kind"=>"string"},
16-
{"type"=>"text", "text"=>"\"", "kind"=>"delimiter"},
17-
{"type"=>"text", "text"=>"Hello world!", "kind"=>"content"},
18-
{"type"=>"text", "text"=>"\"", "kind"=>"delimiter"},
19-
{"type"=>"block", 824F "action"=>"close", "kind"=>"string"},
13+
{ "type" => "text", "text" => "puts", "kind" => "ident" },
14+
{ "type" => "text", "text" => " ", "kind" => "space" },
15+
{ "type" => "block", "action" => "open", "kind" => "string" },
16+
{ "type" => "text", "text" => "\"", "kind" => "delimiter" },
17+
{ "type" => "text", "text" => "Hello world!", "kind" => "content" },
18+
{ "type" => "text", "text" => "\"", "kind" => "delimiter" },
19+
{ "type" => "block", "action" => "close", "kind" => "string" },
2020
], JSON.load(json)
2121
ensure
2222
for path in old_load_paths - $:

0 commit comments

Comments
 (0)
0