From b5b3430d4635682b767c44469e28a70fe234187e Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 15:22:21 +0100 Subject: fix spaces around operators (RuboCop) --- lib/coderay/scanners/c.rb | 2 +- lib/coderay/scanners/cpp.rb | 2 +- lib/coderay/scanners/diff.rb | 4 ++-- lib/coderay/scanners/groovy.rb | 4 ++-- lib/coderay/scanners/java.rb | 2 +- lib/coderay/scanners/java_script.rb | 4 ++-- lib/coderay/scanners/python.rb | 2 +- lib/coderay/scanners/ruby/patterns.rb | 2 +- rake_tasks/code_statistics.rb | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/coderay/scanners/c.rb b/lib/coderay/scanners/c.rb index 84b6e8e..fb2f30d 100644 --- a/lib/coderay/scanners/c.rb +++ b/lib/coderay/scanners/c.rb @@ -37,7 +37,7 @@ module Scanners add(PREDEFINED_CONSTANTS, :predefined_constant) # :nodoc: ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: - UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: protected diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb index 40aeb42..cd4d094 100644 --- a/lib/coderay/scanners/cpp.rb +++ b/lib/coderay/scanners/cpp.rb @@ -49,7 +49,7 @@ module Scanners add(PREDEFINED_CONSTANTS, :predefined_constant) # :nodoc: ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: - UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: protected diff --git a/lib/coderay/scanners/diff.rb b/lib/coderay/scanners/diff.rb index 74a6c27..a2a6fcc 100644 --- a/lib/coderay/scanners/diff.rb +++ b/lib/coderay/scanners/diff.rb @@ -109,7 +109,7 @@ module Scanners for deleted_line, inserted_line in deleted_lines.zip(inserted_lines) pre, deleted_part, inserted_part, post = diff deleted_line, inserted_line content_scanner_entry_state = content_scanner.state - deleted_lines_tokenized << content_scanner.tokenize([pre, deleted_part, post], :tokens => Tokens.new) + deleted_lines_tokenized << content_scanner.tokenize([pre, deleted_part, post], :tokens => Tokens.new) content_scanner.state = content_scanner_entry_state || :initial inserted_lines_tokenized << content_scanner.tokenize([pre, inserted_part, post], :tokens => Tokens.new) end @@ -212,7 +212,7 @@ module Scanners # does not precede the leftmost one from the left. j = -1 j -= 1 while j >= j_min && a[j] == b[j] - return a[0...i], a[i..j], b[i..j], (j < -1) ? a[j+1..-1] : '' + return a[0...i], a[i..j], b[i..j], (j < -1) ? a[j + 1..-1] : '' end end diff --git a/lib/coderay/scanners/groovy.rb b/lib/coderay/scanners/groovy.rb index c64454f..c52ce8d 100644 --- a/lib/coderay/scanners/groovy.rb +++ b/lib/coderay/scanners/groovy.rb @@ -22,8 +22,8 @@ module Scanners add(GROOVY_MAGIC_VARIABLES, :local_variable) # :nodoc: ESCAPE = / [bfnrtv$\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: - UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x # :nodoc: no 4-byte unicode chars? U[a-fA-F0-9]{8} - REGEXP_ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} | \d | [bBdDsSwW\/] /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x # :nodoc: no 4-byte unicode chars? U[a-fA-F0-9]{8} + REGEXP_ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} | \d | [bBdDsSwW\/] /x # :nodoc: # TODO: interpretation inside ', ", / STRING_CONTENT_PATTERN = { diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb index a490ec6..7dd1919 100644 --- a/lib/coderay/scanners/java.rb +++ b/lib/coderay/scanners/java.rb @@ -38,7 +38,7 @@ module Scanners add(DIRECTIVES, :directive) # :nodoc: ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: - UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: STRING_CONTENT_PATTERN = { "'" => /[^\\']+/, '"' => /[^\\"]+/, diff --git a/lib/coderay/scanners/java_script.rb b/lib/coderay/scanners/java_script.rb index 5e27813..8c13d4f 100644 --- a/lib/coderay/scanners/java_script.rb +++ b/lib/coderay/scanners/java_script.rb @@ -40,8 +40,8 @@ module Scanners add(KEYWORDS, :keyword) # :nodoc: ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: - UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: - REGEXP_ESCAPE = / [bBdDsSwW] /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: + REGEXP_ESCAPE = / [bBdDsSwW] /x # :nodoc: STRING_CONTENT_PATTERN = { "'" => /[^\\']+/, '"' => /[^\\"]+/, diff --git a/lib/coderay/scanners/python.rb b/lib/coderay/scanners/python.rb index 09c8b6e..5da553a 100644 --- a/lib/coderay/scanners/python.rb +++ b/lib/coderay/scanners/python.rb @@ -63,7 +63,7 @@ module Scanners NAME = / [[:alpha:]_] \w* /x # :nodoc: ESCAPE = / [abfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: - UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} | N\{[-\w ]+\} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} | N\{[-\w ]+\} /x # :nodoc: OPERATOR = / \.\.\. | # ellipsis diff --git a/lib/coderay/scanners/ruby/patterns.rb b/lib/coderay/scanners/ruby/patterns.rb index e5a156d..cd942d0 100644 --- a/lib/coderay/scanners/ruby/patterns.rb +++ b/lib/coderay/scanners/ruby/patterns.rb @@ -60,7 +60,7 @@ module Scanners QUOTE_TO_TYPE = { '`' => :shell, - '/'=> :regexp, + '/' => :regexp, } QUOTE_TO_TYPE.default = :string diff --git a/rake_tasks/code_statistics.rb b/rake_tasks/code_statistics.rb index 0a2016b..32eb3f0 100644 --- a/rake_tasks/code_statistics.rb +++ b/rake_tasks/code_statistics.rb @@ -156,7 +156,7 @@ private code = calculate_code tests = calculate_tests - puts " Code LOC = #{code} Test LOC = #{tests} Code:Test Ratio = [1 : #{sprintf("%.2f", tests.to_f/code)}]" + puts " Code LOC = #{code} Test LOC = #{tests} Code:Test Ratio = [1 : #{sprintf("%.2f", tests.to_f / code)}]" puts "" end -- cgit v1.2.1