From f06e0e319e13e0e4f1f90a7bdf634bc1ca66b182 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Thu, 10 Mar 2016 14:06:48 +0100 Subject: [PATCH 001/103] Add C++11 keywords * lib/coderay/scanners/cpp.rb: --- lib/coderay/scanners/cpp.rb | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb index e61f56f4..b0ffc068 100644 --- a/lib/coderay/scanners/cpp.rb +++ b/lib/coderay/scanners/cpp.rb @@ -2,14 +2,14 @@ module CodeRay module Scanners # Scanner for C++. - # + # # Aliases: +cplusplus+, c++ class CPlusPlus < Scanner register_for :cpp file_extension 'cpp' title 'C++' - + #-- http://www.cppreference.com/wiki/keywords/start KEYWORDS = [ 'and', 'and_eq', 'asm', 'bitand', 'bitor', 'break', @@ -17,14 +17,15 @@ class CPlusPlus < Scanner 'continue', 'default', 'delete', 'do', 'dynamic_cast', 'else', 'enum', 'export', 'for', 'goto', 'if', 'namespace', 'new', 'not', 'not_eq', 'or', 'or_eq', 'reinterpret_cast', 'return', - 'sizeof', 'static_cast', 'struct', 'switch', 'template', - 'throw', 'try', 'typedef', 'typeid', 'typename', 'union', + 'sizeof', 'static_assert', 'static_cast', 'struct', 'switch', + 'template', 'throw', 'try', 'typedef', 'typeid', 'typename', 'union', 'while', 'xor', 'xor_eq', ] # :nodoc: - + PREDEFINED_TYPES = [ - 'bool', 'char', 'double', 'float', 'int', 'long', - 'short', 'signed', 'unsigned', 'wchar_t', 'string', + 'bool', 'char', 'char16_t', 'char32_t', 'double', 'float', + 'int', 'long', 'nullptr' 'short', 'signed', 'unsigned', + 'wchar_t', 'string', ] # :nodoc: PREDEFINED_CONSTANTS = [ 'false', 'true', @@ -34,11 +35,12 @@ class CPlusPlus < Scanner 'this', ] # :nodoc: DIRECTIVES = [ - 'auto', 'const', 'explicit', 'extern', 'friend', 'inline', 'mutable', 'operator', - 'private', 'protected', 'public', 'register', 'static', 'using', 'virtual', 'void', - 'volatile', + 'alignas', 'alignof', 'auto', 'const', 'constexpr', 'decltype', 'explicit', + 'extern', 'final', 'friend', 'inline', 'mutable', 'noexcept', 'operator', + 'override', 'private', 'protected', 'public', 'register', 'static', + 'thread_local', 'using', 'virtual', 'void', 'volatile', ] # :nodoc: - + IDENT_KIND = WordList.new(:ident). add(KEYWORDS, :keyword). add(PREDEFINED_TYPES, :predefined_type). @@ -48,9 +50,9 @@ class CPlusPlus < Scanner 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: - + protected - + def scan_tokens encoder, options state = :initial @@ -107,7 +109,7 @@ def scan_tokens encoder, options elsif match = scan(/\$/) encoder.text_token match, :ident - + elsif match = scan(/L?"/) encoder.begin_group :string if match[0] == ?L @@ -180,7 +182,7 @@ def scan_tokens encoder, options state = :initial end - + when :class_name_expected if match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x) encoder.text_token match, :class @@ -194,7 +196,7 @@ def scan_tokens encoder, options state = :initial end - + else raise_inspect 'Unknown state', encoder From 26127899acf888a1888195c8b50c4603167e2808 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 11 Mar 2016 08:04:21 +0100 Subject: [PATCH 002/103] Fixed typo * FOLDERS: --- FOLDERS | 96 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/FOLDERS b/FOLDERS index f29255ae..1709d08a 100644 --- a/FOLDERS +++ b/FOLDERS @@ -1,48 +1,48 @@ -= CodeRay - folder structure - -== bench - Benchmarking system - -All benchmarking stuff goes here. - -Test inputs are stored in files named example.. -Test outputs go to bench/test.. - -Run bench/bench.rb to get a usage description. - -Run rake bench to perform an example benchmark. - - -== bin - Scripts - -Executional files for CodeRay. - -coderay:: The CodeRay executable. - -== demo - Demos and functional tests - -Demonstrational scripts to show of CodeRay's features. - -Run them as functional tests with rake test:demos. - - -== etc - Lots of stuff - -Some addidtional files for CodeRay, mainly graphics and Vim scripts. - - -== lib - CodeRay library code - -This is the base directory for the CodeRay library. - - -== rake_helpers - Rake helper libraries - -Some files to enhance Rake, including the Autumnal Rdoc template and some scripts. - - -== test - Tests - -In the subfolder scanners/ are the scanners tests. -Each language has its own subfolder and sub-suite. - -Run with rake test. += CodeRay - folder structure + +== bench - Benchmarking system + +All benchmarking stuff goes here. + +Test inputs are stored in files named example.. +Test outputs go to bench/test.. + +Run bench/bench.rb to get a usage description. + +Run rake bench to perform an example benchmark. + + +== bin - Scripts + +Executional files for CodeRay. + +coderay:: The CodeRay executable. + +== demo - Demos and functional tests + +Demonstrational scripts to show of CodeRay's features. + +Run them as functional tests with rake test:demos. + + +== etc - Lots of stuff + +Some additional files for CodeRay, mainly graphics and Vim scripts. + + +== lib - CodeRay library code + +This is the base directory for the CodeRay library. + + +== rake_helpers - Rake helper libraries + +Some files to enhance Rake, including the Autumnal Rdoc template and some scripts. + + +== test - Tests + +In the subfolder scanners/ are the scanners tests. +Each language has its own subfolder and sub-suite. + +Run with rake test. From 92a8e56ccd8d3aee05db9c7a821b24382528c674 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Sun, 13 Mar 2016 11:47:46 +0100 Subject: [PATCH 003/103] Small changes to grouping of new C++11 keywords * lib/coderay/scanners/cpp.rb: --- lib/coderay/scanners/cpp.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb index b0ffc068..50a25b7a 100644 --- a/lib/coderay/scanners/cpp.rb +++ b/lib/coderay/scanners/cpp.rb @@ -15,7 +15,7 @@ class CPlusPlus < Scanner 'and', 'and_eq', 'asm', 'bitand', 'bitor', 'break', 'case', 'catch', 'class', 'compl', 'const_cast', 'continue', 'default', 'delete', 'do', 'dynamic_cast', 'else', - 'enum', 'export', 'for', 'goto', 'if', 'namespace', 'new', + 'enum', 'export', 'final', 'for', 'goto', 'if', 'namespace', 'new', 'not', 'not_eq', 'or', 'or_eq', 'reinterpret_cast', 'return', 'sizeof', 'static_assert', 'static_cast', 'struct', 'switch', 'template', 'throw', 'try', 'typedef', 'typeid', 'typename', 'union', @@ -24,19 +24,19 @@ class CPlusPlus < Scanner PREDEFINED_TYPES = [ 'bool', 'char', 'char16_t', 'char32_t', 'double', 'float', - 'int', 'long', 'nullptr' 'short', 'signed', 'unsigned', + 'int', 'long', 'short', 'signed', 'unsigned', 'wchar_t', 'string', ] # :nodoc: PREDEFINED_CONSTANTS = [ 'false', 'true', - 'EOF', 'NULL', + 'EOF', 'NULL', 'nullptr' ] # :nodoc: PREDEFINED_VARIABLES = [ 'this', ] # :nodoc: DIRECTIVES = [ 'alignas', 'alignof', 'auto', 'const', 'constexpr', 'decltype', 'explicit', - 'extern', 'final', 'friend', 'inline', 'mutable', 'noexcept', 'operator', + 'extern', 'friend', 'inline', 'mutable', 'noexcept', 'operator', 'override', 'private', 'protected', 'public', 'register', 'static', 'thread_local', 'using', 'virtual', 'void', 'volatile', ] # :nodoc: From cee12238d0ca5ea0d9d1ae9ef0e4dbf80fdfc0dc Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Apr 2016 09:26:02 +0200 Subject: [PATCH 004/103] fix tests for Ruby 1.8 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6d3a176f..592b79fb 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gemspec # Include everything needed to run rake, tests, features, etc. group :development do gem "bundler" - gem "rake" + gem "rake", "~> 10.5" gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3" gem "term-ansicolor" gem 'tins', '~> 1.6.0' From e94cf8ea0e342f41837c4685a45c4d2af488fe6e Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Apr 2016 11:07:02 +0200 Subject: [PATCH 005/103] fix Windows line breaks in FOLDERS file --- FOLDERS | 96 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/FOLDERS b/FOLDERS index f29255ae..81784299 100644 --- a/FOLDERS +++ b/FOLDERS @@ -1,48 +1,48 @@ -= CodeRay - folder structure - -== bench - Benchmarking system - -All benchmarking stuff goes here. - -Test inputs are stored in files named example.. -Test outputs go to bench/test.. - -Run bench/bench.rb to get a usage description. - -Run rake bench to perform an example benchmark. - - -== bin - Scripts - -Executional files for CodeRay. - -coderay:: The CodeRay executable. - -== demo - Demos and functional tests - -Demonstrational scripts to show of CodeRay's features. - -Run them as functional tests with rake test:demos. - - -== etc - Lots of stuff - -Some addidtional files for CodeRay, mainly graphics and Vim scripts. - - -== lib - CodeRay library code - -This is the base directory for the CodeRay library. - - -== rake_helpers - Rake helper libraries - -Some files to enhance Rake, including the Autumnal Rdoc template and some scripts. - - -== test - Tests - -In the subfolder scanners/ are the scanners tests. -Each language has its own subfolder and sub-suite. - -Run with rake test. += CodeRay - folder structure + +== bench - Benchmarking system + +All benchmarking stuff goes here. + +Test inputs are stored in files named example.. +Test outputs go to bench/test.. + +Run bench/bench.rb to get a usage description. + +Run rake bench to perform an example benchmark. + + +== bin - Scripts + +Executional files for CodeRay. + +coderay:: The CodeRay executable. + +== demo - Demos and functional tests + +Demonstrational scripts to show of CodeRay's features. + +Run them as functional tests with rake test:demos. + + +== etc - Lots of stuff + +Some addidtional files for CodeRay, mainly graphics and Vim scripts. + + +== lib - CodeRay library code + +This is the base directory for the CodeRay library. + + +== rake_helpers - Rake helper libraries + +Some files to enhance Rake, including the Autumnal Rdoc template and some scripts. + + +== test - Tests + +In the subfolder scanners/ are the scanners tests. +Each language has its own subfolder and sub-suite. + +Run with rake test. From 54c94b78f18939ef8517dd2818fbb699c0fa1391 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 27 May 2016 20:40:53 +0200 Subject: [PATCH 006/103] Add env setting to allow C extensions which are not allowed by default anymore by travis-ci, see https://docs.travis-ci.com/user/languages/ruby * .travis.yml: --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index f8156982..b638af12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ +env: + global: + - "JRUBY_OPTS=-Xcext.enabled=true" rvm: - 1.8.7 - ree From 2bce2ac91ad7994f9ead130387c8b24905853064 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 27 May 2016 21:06:00 +0200 Subject: [PATCH 007/103] Allow failures with jruby 18 and 19 mode, RedCloth has a known problem, see https://jgarber.lighthouseapp.com/projects/13054/tickets/230-use-rbconfig-instead-of-obsolete-and-deprecated-config * .travis.yml: --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b638af12..5aa9e5f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,6 @@ rvm: - 2.2 - 2.3.0 - ruby-head - - jruby-18mode - - jruby-19mode - jruby-head - rbx-18mode - rbx-19mode @@ -24,5 +22,7 @@ matrix: - rvm: jruby-head - rvm: rbx-18mode - rvm: rbx-19mode + - rvm: jruby-18mode + - rvm: jruby-19mode script: "rake test" # test:scanners" sudo: false From cd3bffb1086420c02774ba905a403f8efe313f46 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 27 May 2016 21:07:35 +0200 Subject: [PATCH 008/103] Shouldn't have removed the jruby lines * .travis.yml: --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5aa9e5f9..498158f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ rvm: - 2.3.0 - ruby-head - jruby-head + - jruby-18mode + - jruby-19mode - rbx-18mode - rbx-19mode branches: From de2e2acd91988e6b54f50f6c44ad85f28b68c615 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 29 May 2016 23:28:43 +0200 Subject: [PATCH 009/103] tweaking list of Rubies for CI --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f8156982..f3520043 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,16 +10,16 @@ rvm: - jruby-18mode - jruby-19mode - jruby-head - - rbx-18mode - - rbx-19mode + - rbx-2 branches: only: - master matrix: allow_failures: - rvm: ruby-head + - rvm: jruby-18mode + - rvm: jruby-19mode - rvm: jruby-head - - rvm: rbx-18mode - - rvm: rbx-19mode + - rvm: rbx-2 script: "rake test" # test:scanners" sudo: false From f664af2d8e9451cd03bf1d815139514bff8956d1 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 30 May 2016 08:41:30 +0200 Subject: [PATCH 010/103] Moved final from keywords to directive * lib/coderay/scanners/cpp.rb: --- lib/coderay/scanners/cpp.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb index 50a25b7a..40aeb426 100644 --- a/lib/coderay/scanners/cpp.rb +++ b/lib/coderay/scanners/cpp.rb @@ -15,7 +15,7 @@ class CPlusPlus < Scanner 'and', 'and_eq', 'asm', 'bitand', 'bitor', 'break', 'case', 'catch', 'class', 'compl', 'const_cast', 'continue', 'default', 'delete', 'do', 'dynamic_cast', 'else', - 'enum', 'export', 'final', 'for', 'goto', 'if', 'namespace', 'new', + 'enum', 'export', 'for', 'goto', 'if', 'namespace', 'new', 'not', 'not_eq', 'or', 'or_eq', 'reinterpret_cast', 'return', 'sizeof', 'static_assert', 'static_cast', 'struct', 'switch', 'template', 'throw', 'try', 'typedef', 'typeid', 'typename', 'union', @@ -36,7 +36,7 @@ class CPlusPlus < Scanner ] # :nodoc: DIRECTIVES = [ 'alignas', 'alignof', 'auto', 'const', 'constexpr', 'decltype', 'explicit', - 'extern', 'friend', 'inline', 'mutable', 'noexcept', 'operator', + 'extern', 'final', 'friend', 'inline', 'mutable', 'noexcept', 'operator', 'override', 'private', 'protected', 'public', 'register', 'static', 'thread_local', 'using', 'virtual', 'void', 'volatile', ] # :nodoc: From 1ad3f9651b0cdc75b7efd819b112ffa1efa16538 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 30 May 2016 08:42:20 +0200 Subject: [PATCH 011/103] Removed merge issue * .travis.yml: --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2c7b0f4e..ea1f1c10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ rvm: - jruby-19mode - jruby-head - rbx-2 ->>>>>>> de2e2acd91988e6b54f50f6c44ad85f28b68c615 branches: only: - master From 7e330abe861bcd2b23b5ea09456335a45555530b Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 30 May 2016 08:50:49 +0200 Subject: [PATCH 012/103] Removed double line * .travis.yml: --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ea1f1c10..e04b1645 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,6 @@ rvm: - jruby-head - jruby-18mode - jruby-19mode - - jruby-head - rbx-2 branches: only: From fdb27f78983cc4d4e52d887875b1a4cd256c2757 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Thu, 2 Jun 2016 18:58:26 +0200 Subject: [PATCH 013/103] revert some changes not related to #195 --- .travis.yml | 2 +- FOLDERS | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e04b1645..a8080ce4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,9 @@ rvm: - 2.2 - 2.3.0 - ruby-head - - jruby-head - jruby-18mode - jruby-19mode + - jruby-head - rbx-2 branches: only: diff --git a/FOLDERS b/FOLDERS index 9eae35ec..1709d08a 100644 --- a/FOLDERS +++ b/FOLDERS @@ -29,6 +29,7 @@ Run them as functional tests with rake test:demos. Some additional files for CodeRay, mainly graphics and Vim scripts. + == lib - CodeRay library code This is the base directory for the CodeRay library. From 4c7bedc3bf2392444f62e90b7b8dc91d1a2effbb Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Thu, 2 Jun 2016 19:01:56 +0200 Subject: [PATCH 014/103] add changelog --- Changes.textile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Changes.textile b/Changes.textile index 10f1d6eb..d77cff29 100644 --- a/Changes.textile +++ b/Changes.textile @@ -2,6 +2,10 @@ h1=. CodeRay Version History p=. _This files lists all changes in the CodeRay library since the 0.9.8 release._ +h2. Changes in 1.1.2 + +* C++ scanner: Added C++11 keywords. [#195, thanks to Johnny Willemsen] + h2. Changes in 1.1.1 * SQL scanner: Allow @$@ signs in SQL identifiers [#164, thanks to jasir and Ben Basson] From 935f003b2c15d6effb637abfc2ba40c20ad4ba98 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Wed, 28 Dec 2016 12:07:17 +0100 Subject: [PATCH 015/103] tweak benchmark numbers, improve accuracy --- bench/bench.rb | 10 +++++++--- rake_tasks/benchmark.rake | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bench/bench.rb b/bench/bench.rb index 92f9d07f..34ea9f9e 100644 --- a/bench/bench.rb +++ b/bench/bench.rb @@ -15,7 +15,7 @@ format = ARGV.fetch(1, 'html').downcase encoder = CodeRay.encoder(format) -size = ARGV.fetch(2, 1000).to_i * 1000 +size = ARGV.fetch(2, 2000).to_i * 1000 unless size.zero? data += data until data.size >= size data = data[0, size] @@ -23,14 +23,18 @@ size = data.size puts "encoding %d kB of #{lang} code to #{format}..." % [(size / 1000.0).round] -n = ARGV.fetch(3, 5).to_s[/\d+/].to_i +n = ARGV.fetch(3, 10).to_s[/\d+/].to_i require 'profile' if ARGV.include? '-p' +times = [] n.times do |i| time = Benchmark.realtime { encoder.encode(data, lang) } puts "run %d: %5.2f s, %4.0f kB/s" % [i + 1, time, size / time / 1000.0] + times << time end -STDIN.gets if ARGV.include? '-w' +times_sum = times.inject(0) { |time, sum| sum + time } +puts 'Average time: %5.2f s, %4.0f kB/s' % [times_sum / times.size, (size * n) / times_sum / 1000.0] +puts 'Best time: %5.2f s, %4.0f kB/s' % [times.min, size / times.min / 1000.0] __END__ Usage: diff --git a/rake_tasks/benchmark.rake b/rake_tasks/benchmark.rake index 2e38b577..8edeffb0 100644 --- a/rake_tasks/benchmark.rake +++ b/rake_tasks/benchmark.rake @@ -1,6 +1,6 @@ desc 'Do a benchmark' task :benchmark do - ruby 'bench/bench.rb ruby html 3000' + ruby 'bench/bench.rb ruby html' end task :bench => :benchmark From 443911f134b2485f2d0b101b78342e0c0e1548fe Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Tue, 10 Jan 2017 18:38:57 +0100 Subject: [PATCH 016/103] Add Ruby 2.4.0 test to Travis CI. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a8080ce4..4c005471 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ rvm: - 2.1 - 2.2 - 2.3.0 + - 2.4.0 - ruby-head - jruby-18mode - jruby-19mode From b22fc36299faf1348f2168773b10fb1eeacfcb26 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Tue, 10 Jan 2017 19:01:40 +0100 Subject: [PATCH 017/103] Change license file name correctly. --- MIT-LICENSE.txt => MIT-LICENSE | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename MIT-LICENSE.txt => MIT-LICENSE (100%) diff --git a/MIT-LICENSE.txt b/MIT-LICENSE similarity index 100% rename from MIT-LICENSE.txt rename to MIT-LICENSE From 8afe8aa1ea8b6c7bcf46144977bcb45a72c997f6 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Wed, 11 Jan 2017 14:45:19 +0100 Subject: [PATCH 018/103] Remove executable bit for the script files with shebang. --- lib/coderay/token_kinds.rb | 0 test/functional/basic.rb | 0 test/functional/examples.rb | 0 test/functional/suite.rb | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 lib/coderay/token_kinds.rb mode change 100755 => 100644 test/functional/basic.rb mode change 100755 => 100644 test/functional/examples.rb mode change 100755 => 100644 test/functional/suite.rb diff --git a/lib/coderay/token_kinds.rb b/lib/coderay/token_kinds.rb old mode 100755 new mode 100644 diff --git a/test/functional/basic.rb b/test/functional/basic.rb old mode 100755 new mode 100644 diff --git a/test/functional/examples.rb b/test/functional/examples.rb old mode 100755 new mode 100644 diff --git a/test/functional/suite.rb b/test/functional/suite.rb old mode 100755 new mode 100644 From f38438f31319cf87fc87db71768b5902671a99f5 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 15 Jan 2017 18:30:04 +1300 Subject: [PATCH 019/103] fixing tests --- .travis.yml | 4 ++-- Gemfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c005471..3a803e3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,8 @@ rvm: - 2.0 - 2.1 - 2.2 - - 2.3.0 - - 2.4.0 + - 2.3 + - 2.4 - ruby-head - jruby-18mode - jruby-19mode diff --git a/Gemfile b/Gemfile index 592b79fb..d849d689 100644 --- a/Gemfile +++ b/Gemfile @@ -9,10 +9,10 @@ group :development do gem "bundler" gem "rake", "~> 10.5" gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3" - gem "term-ansicolor" + gem "term-ansicolor", "~> 1.3.2" gem 'tins', '~> 1.6.0' gem "shoulda-context" gem "test-unit" - gem "json" if RUBY_VERSION < '1.9' + gem "json", "~> 1.8" if RUBY_VERSION < '1.9' gem "rdoc" end From 294183efae11e1a002cd455480e4dde8301f6b1e Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 15 Jan 2017 18:35:33 +1300 Subject: [PATCH 020/103] fixing tests... --- .travis.yml | 4 ++-- Gemfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3a803e3d..dc228fcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,8 @@ rvm: - 2.0 - 2.1 - 2.2 - - 2.3 - - 2.4 + - 2.3.3 + - 2.4.0 - ruby-head - jruby-18mode - jruby-19mode diff --git a/Gemfile b/Gemfile index d849d689..c4463a9f 100644 --- a/Gemfile +++ b/Gemfile @@ -14,5 +14,5 @@ group :development do gem "shoulda-context" gem "test-unit" gem "json", "~> 1.8" if RUBY_VERSION < '1.9' - gem "rdoc" + gem "rdoc", "~> 4.2.2" end From 6f9b2b8eb356327fa73e3e1d6c4ce18420f9db2a Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 15 Jan 2017 18:38:46 +1300 Subject: [PATCH 021/103] downgrade shoulda-context --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index c4463a9f..87105557 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ group :development do gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3" gem "term-ansicolor", "~> 1.3.2" gem 'tins', '~> 1.6.0' - gem "shoulda-context" + gem "shoulda-context", "= 1.2.1" gem "test-unit" gem "json", "~> 1.8" if RUBY_VERSION < '1.9' gem "rdoc", "~> 4.2.2" From 6734fffd1c7fd951ecae0bb7a2b228a0b24c833a Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 15 Jan 2017 18:42:07 +1300 Subject: [PATCH 022/103] only test with latest JRuby and Rubinius --- .travis.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index dc228fcb..75a57bb5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,19 +11,15 @@ rvm: - 2.3.3 - 2.4.0 - ruby-head - - jruby-18mode - - jruby-19mode - - jruby-head - - rbx-2 + - jruby + - rbx branches: only: - master matrix: allow_failures: - rvm: ruby-head - - rvm: jruby-18mode - - rvm: jruby-19mode - - rvm: jruby-head - - rvm: rbx-2 + - rvm: jruby + - rvm: rbx script: "rake test" # test:scanners" sudo: false From 6b3df316a81e94ca7336f75d82bb1da6c10de9f7 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 15 Jan 2017 18:46:11 +1300 Subject: [PATCH 023/103] does this version work with JRuby? --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 87105557..f631cbe3 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gemspec group :development do gem "bundler" gem "rake", "~> 10.5" - gem "RedCloth", RUBY_PLATFORM == 'java' ? ">= 4.2.7" : ">= 4.0.3" + gem "RedCloth", RUBY_PLATFORM == 'java' ? "= 4.2.9" : ">= 4.0.3" gem "term-ansicolor", "~> 1.3.2" gem 'tins', '~> 1.6.0' gem "shoulda-context", "= 1.2.1" From 06f6ec4702c47fb5b7d654c477461a532062d742 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Sun, 15 Jan 2017 14:24:49 +0100 Subject: [PATCH 024/103] Remote test files and Rakefile from gem distribution. This fixes #205. --- coderay.gemspec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coderay.gemspec b/coderay.gemspec index 328b94c1..50c195b5 100644 --- a/coderay.gemspec +++ b/coderay.gemspec @@ -24,8 +24,7 @@ Gem::Specification.new do |s| readme_file = 'README_INDEX.rdoc' - s.files = `git ls-files -- lib/* test/functional/* Rakefile #{readme_file} MIT-LICENSE`.split("\n") - s.test_files = `git ls-files -- test/functional/*`.split("\n") + s.files = `git ls-files -- lib/* #{readme_file} MIT-LICENSE`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } s.require_paths = ['lib'] From 457ffbf3ee02b1b6f57eacb33df44c80f4bf9d71 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 9 Apr 2017 18:40:31 +0200 Subject: [PATCH 025/103] allow "-" in Haml tags --- Changes.textile | 1 + lib/coderay/scanners/haml.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Changes.textile b/Changes.textile index d77cff29..6b448549 100644 --- a/Changes.textile +++ b/Changes.textile @@ -5,6 +5,7 @@ p=. _This files lists all changes in the CodeRay library since the 0.9.8 release h2. Changes in 1.1.2 * C++ scanner: Added C++11 keywords. [#195, thanks to Johnny Willemsen] +* Haml scanner: Allow @-@ in tags. h2. Changes in 1.1.1 diff --git a/lib/coderay/scanners/haml.rb b/lib/coderay/scanners/haml.rb index 5433790a..d516ba9e 100644 --- a/lib/coderay/scanners/haml.rb +++ b/lib/coderay/scanners/haml.rb @@ -75,7 +75,7 @@ def scan_tokens encoder, options tag = false - if match = scan(/%[\w:]+\/?/) + if match = scan(/%[-\w:]+\/?/) encoder.text_token match, :tag # if match = scan(/( +)(.+)/) # encoder.text_token self[1], :space From 761234f380b3e42c283e82d784826bae280f9075 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Wed, 28 Jun 2017 10:36:18 +1000 Subject: [PATCH 026/103] Get tests running with frozen string literals. --- lib/coderay/encoders/encoder.rb | 2 +- lib/coderay/encoders/html.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/coderay/encoders/encoder.rb b/lib/coderay/encoders/encoder.rb index fa5695d6..2baeedb6 100644 --- a/lib/coderay/encoders/encoder.rb +++ b/lib/coderay/encoders/encoder.rb @@ -146,7 +146,7 @@ def setup options end def get_output options - options[:out] || '' + options[:out] || ''.dup end # Append data.to_s to the output. Returns the argument. diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index 942b9c89..1b33e921 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -176,7 +176,7 @@ def setup options if options[:wrap] || options[:line_numbers] @real_out = @out - @out = '' + @out = ''.dup end @break_lines = (options[:break_lines] == true) @@ -314,7 +314,7 @@ def check_group_nesting name, kind end def break_lines text, style - reopen = '' + reopen = ''.dup @opened.each_with_index do |kind, index| reopen << (@span_for_kinds[index > 0 ? [kind, *@opened[0...index]] : kind] || '') end From eccb20a661eaed79cbd987a524579da92edcbf9c Mon Sep 17 00:00:00 2001 From: t-gergely Date: Tue, 4 Jul 2017 17:01:52 +0200 Subject: [PATCH 027/103] allow for non-ASCII identifiers --- lib/coderay/scanners/java.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb index 962154eb..b40d4a69 100644 --- a/lib/coderay/scanners/java.rb +++ b/lib/coderay/scanners/java.rb @@ -44,7 +44,7 @@ class Java < Scanner '"' => /[^\\"]+/, '/' => /[^\\\/]+/, } # :nodoc: - IDENT = /[a-zA-Z_][A-Za-z_0-9]*/ # :nodoc: + IDENT = /[\p{L}_][\p{L}_0-9]*/ # :nodoc: protected From e94b1a91ce85306622f03996792d3665a675d69d Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Fri, 7 Jul 2017 08:39:43 +0200 Subject: [PATCH 028/103] ensure that all string literals can be frozen (thanks, @pat) --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 75a57bb5..a486c233 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,8 @@ rvm: branches: only: - master +before_script: +- if (ruby -e "exit RUBY_VERSION.to_f >= 2.4"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT matrix: allow_failures: - rvm: ruby-head From ef5e2611d6a937fab885eb18a0c6ac5906e65ee8 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Fri, 7 Jul 2017 08:41:07 +0200 Subject: [PATCH 029/103] update Ruby minor versions --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a486c233..96233c6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,8 @@ rvm: - 2.0 - 2.1 - 2.2 - - 2.3.3 - - 2.4.0 + - 2.3 + - 2.4 - ruby-head - jruby - rbx From eb3f281428d59760271c757287066d39430449ae Mon Sep 17 00:00:00 2001 From: t-gergely Date: Fri, 7 Jul 2017 10:45:30 +0200 Subject: [PATCH 030/103] compatibility with Ruby < 2 As requested by korny. Thanks. --- lib/coderay/scanners/java.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb index b40d4a69..5fde4339 100644 --- a/lib/coderay/scanners/java.rb +++ b/lib/coderay/scanners/java.rb @@ -44,7 +44,7 @@ class Java < Scanner '"' => /[^\\"]+/, '/' => /[^\\\/]+/, } # :nodoc: - IDENT = /[\p{L}_][\p{L}_0-9]*/ # :nodoc: + IDENT = /[[[:alpha:]]_][[[:alnum:]]_]*/ # :nodoc: protected From 0bea645c30a10b0e0c2949d629ec0d1932861c90 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 10:05:27 +0200 Subject: [PATCH 031/103] don't test on rubinius anymore --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 96233c6a..2c90b189 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ rvm: - 2.4 - ruby-head - jruby - - rbx branches: only: - master From 931ee0a74ba13049e452fb6c6d594750768cb908 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 10:32:22 +0200 Subject: [PATCH 032/103] don't try to run RedCloth tests with frozen string literals (they fail) --- rake_tasks/test.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake index b15b9993..1a23a5bc 100644 --- a/rake_tasks/test.rake +++ b/rake_tasks/test.rake @@ -2,7 +2,7 @@ namespace :test do desc 'run functional tests' task :functional do ruby './test/functional/suite.rb' - ruby './test/functional/for_redcloth.rb' + ruby './test/functional/for_redcloth.rb' unless (''.chop! rescue true) end desc 'run unit tests' From c3473412188de4349a5cae4d4a4dc73ceac9e36f Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 10:32:34 +0200 Subject: [PATCH 033/103] update changelog --- Changes.textile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Changes.textile b/Changes.textile index 6b448549..f9846109 100644 --- a/Changes.textile +++ b/Changes.textile @@ -4,7 +4,8 @@ p=. _This files lists all changes in the CodeRay library since the 0.9.8 release h2. Changes in 1.1.2 -* C++ scanner: Added C++11 keywords. [#195, thanks to Johnny Willemsen] +* Ruby future: Add support for frozen string literals. [#211, thanks to Pat Allan] +* C++ scanner: Add C++11 keywords. [#195, thanks to Johnny Willemsen] * Haml scanner: Allow @-@ in tags. h2. Changes in 1.1.1 From 860c2e132d2eed2b10285276fb6d1ca509f56cdc Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 10:34:33 +0200 Subject: [PATCH 034/103] flag is available since Ruby 2.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2c90b189..b99c95e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ branches: only: - master before_script: -- if (ruby -e "exit RUBY_VERSION.to_f >= 2.4"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT +- if (ruby -e "exit RUBY_VERSION.to_f >= 2.3"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT matrix: allow_failures: - rvm: ruby-head From d4d27b2f9b090291f0e85b82f94b6e3bf266256d Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 10:47:15 +0200 Subject: [PATCH 035/103] update changelog --- Changes.textile | 1 + 1 file changed, 1 insertion(+) diff --git a/Changes.textile b/Changes.textile index f9846109..37de4ace 100644 --- a/Changes.textile +++ b/Changes.textile @@ -7,6 +7,7 @@ h2. Changes in 1.1.2 * Ruby future: Add support for frozen string literals. [#211, thanks to Pat Allan] * C++ scanner: Add C++11 keywords. [#195, thanks to Johnny Willemsen] * Haml scanner: Allow @-@ in tags. +* Java scanner: Allow Unicode characters in identifiers. [#212, thanks to t-gergely] h2. Changes in 1.1.1 From f16a659e503171024924d64feb1d478dd2527e39 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 10:47:23 +0200 Subject: [PATCH 036/103] update development gems --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index f631cbe3..89cd72b3 100644 --- a/Gemfile +++ b/Gemfile @@ -7,10 +7,10 @@ gemspec # Include everything needed to run rake, tests, features, etc. group :development do gem "bundler" - gem "rake", "~> 10.5" + gem "rake", ">= 10.5" gem "RedCloth", RUBY_PLATFORM == 'java' ? "= 4.2.9" : ">= 4.0.3" gem "term-ansicolor", "~> 1.3.2" - gem 'tins', '~> 1.6.0' + gem 'tins', '>= 1.6.0' gem "shoulda-context", "= 1.2.1" gem "test-unit" gem "json", "~> 1.8" if RUBY_VERSION < '1.9' From 436c1a48074d786a542bf59ea2ea2da69cb121b9 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 10:49:32 +0200 Subject: [PATCH 037/103] update more gems --- Gemfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 89cd72b3..f07e274f 100644 --- a/Gemfile +++ b/Gemfile @@ -9,10 +9,10 @@ group :development do gem "bundler" gem "rake", ">= 10.5" gem "RedCloth", RUBY_PLATFORM == 'java' ? "= 4.2.9" : ">= 4.0.3" - gem "term-ansicolor", "~> 1.3.2" + gem "term-ansicolor", ">= 1.3.2" gem 'tins', '>= 1.6.0' - gem "shoulda-context", "= 1.2.1" + gem "shoulda-context", ">= 1.2.1" gem "test-unit" - gem "json", "~> 1.8" if RUBY_VERSION < '1.9' - gem "rdoc", "~> 4.2.2" + gem "json", ">= 1.8" if RUBY_VERSION < '1.9' + gem "rdoc", ">= 4.2.2" end From 6f95c964d94a35b306e8086018917d16d7adc9ca Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 11:01:37 +0200 Subject: [PATCH 038/103] restore support for Ruby 1.8.7 --- Gemfile | 18 +++++++++--------- lib/coderay/scanners/java.rb | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index f07e274f..951e3d1b 100644 --- a/Gemfile +++ b/Gemfile @@ -6,13 +6,13 @@ gemspec # Add dependencies to develop your gem here. # Include everything needed to run rake, tests, features, etc. group :development do - gem "bundler" - gem "rake", ">= 10.5" - gem "RedCloth", RUBY_PLATFORM == 'java' ? "= 4.2.9" : ">= 4.0.3" - gem "term-ansicolor", ">= 1.3.2" - gem 'tins', '>= 1.6.0' - gem "shoulda-context", ">= 1.2.1" - gem "test-unit" - gem "json", ">= 1.8" if RUBY_VERSION < '1.9' - gem "rdoc", ">= 4.2.2" + gem 'bundler' + gem 'rake', RUBY_VERSION < '1.9' ? '~> 10.5' : '>= 10.5' + gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3' + gem 'term-ansicolor', '>= 1.3.2' + gem 'tins', RUBY_VERSION < '2.0' ? '~> 1.6.0' : '>= 1.6.0' + gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1' + gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0' + gem 'json', '>= 1.8' if RUBY_VERSION < '1.9' + gem 'rdoc', RUBY_VERSION < '1.9' ? '~> 4.2.2' : '>= 4.2.2' end diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb index 5fde4339..3ac7efe7 100644 --- a/lib/coderay/scanners/java.rb +++ b/lib/coderay/scanners/java.rb @@ -44,7 +44,7 @@ class Java < Scanner '"' => /[^\\"]+/, '/' => /[^\\\/]+/, } # :nodoc: - IDENT = /[[[:alpha:]]_][[[:alnum:]]_]*/ # :nodoc: + IDENT = RUBY_VERSION < '1.9' ? /[a-zA-Z_][A-Za-z_0-9]*/ : /[[[:alpha:]]_][[[:alnum:]]_]*/ # :nodoc: protected From 51ee233e72d5165f480ccad94487d995b3b2280f Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 11:07:04 +0200 Subject: [PATCH 039/103] don't change benchmark rules --- bench/bench.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/bench.rb b/bench/bench.rb index 34ea9f9e..a47721e3 100644 --- a/bench/bench.rb +++ b/bench/bench.rb @@ -15,7 +15,7 @@ format = ARGV.fetch(1, 'html').downcase encoder = CodeRay.encoder(format) -size = ARGV.fetch(2, 2000).to_i * 1000 +size = ARGV.fetch(2, 3000).to_i * 1000 unless size.zero? data += data until data.size >= size data = data[0, size] From 44a4f08fb3a5ee07a85557ff0d7f38fa54105d2b Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 11:12:52 +0200 Subject: [PATCH 040/103] fixing gems for Ruby 1.9 --- Gemfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 951e3d1b..530c0e80 100644 --- a/Gemfile +++ b/Gemfile @@ -7,12 +7,12 @@ gemspec # Include everything needed to run rake, tests, features, etc. group :development do gem 'bundler' - gem 'rake', RUBY_VERSION < '1.9' ? '~> 10.5' : '>= 10.5' - gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3' - gem 'term-ansicolor', '>= 1.3.2' - gem 'tins', RUBY_VERSION < '2.0' ? '~> 1.6.0' : '>= 1.6.0' - gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1' - gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0' + gem 'rake', RUBY_VERSION < '1.9' ? '~> 10.5' : '>= 10.5' + gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3' + gem 'term-ansicolor', RUBY_VERSION < '2.0' ? '~> 1.3.2' : '>= 1.3.2' + gem 'tins', RUBY_VERSION < '2.0' ? '~> 1.6.0' : '>= 1.6.0' + gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1' + gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0' gem 'json', '>= 1.8' if RUBY_VERSION < '1.9' - gem 'rdoc', RUBY_VERSION < '1.9' ? '~> 4.2.2' : '>= 4.2.2' + gem 'rdoc', RUBY_VERSION < '1.9' ? '~> 4.2.2' : '>= 4.2.2' end From 1632c66c81b9fde52df23bbbe0bbeea077a9c5dc Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 11:18:11 +0200 Subject: [PATCH 041/103] avoid regexp syntax warnings on Ruby 1.8 --- lib/coderay/scanners/java.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb index 3ac7efe7..982a796f 100644 --- a/lib/coderay/scanners/java.rb +++ b/lib/coderay/scanners/java.rb @@ -44,7 +44,7 @@ class Java < Scanner '"' => /[^\\"]+/, '/' => /[^\\\/]+/, } # :nodoc: - IDENT = RUBY_VERSION < '1.9' ? /[a-zA-Z_][A-Za-z_0-9]*/ : /[[[:alpha:]]_][[[:alnum:]]_]*/ # :nodoc: + IDENT = RUBY_VERSION < '1.9' ? /[a-zA-Z_][A-Za-z_0-9]*/ : Regexp.new('[[[:alpha:]]_][[[:alnum:]]_]*') # :nodoc: protected From e15cf96405177153e1418496a7a8e85beaa679fb Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 3 Sep 2017 11:18:21 +0200 Subject: [PATCH 042/103] bump version to 1.1.2 --- lib/coderay/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/version.rb b/lib/coderay/version.rb index 7ea3f70c..f5e7a39d 100644 --- a/lib/coderay/version.rb +++ b/lib/coderay/version.rb @@ -1,3 +1,3 @@ module CodeRay - VERSION = '1.1.1' + VERSION = '1.1.2' end From 161c17d2c537a32f38f0dcca75218af69f96102b Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Fri, 3 Nov 2017 00:39:44 +0100 Subject: [PATCH 043/103] port a few tweaks from dsl branch --- lib/coderay/scanners/java_script.rb | 1 - lib/coderay/scanners/lua.rb | 2 +- rake_tasks/test.rake | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/coderay/scanners/java_script.rb b/lib/coderay/scanners/java_script.rb index 9eb0a0a1..5e278137 100644 --- a/lib/coderay/scanners/java_script.rb +++ b/lib/coderay/scanners/java_script.rb @@ -100,7 +100,6 @@ def scan_tokens encoder, options # TODO: scan over nested tags xml_scanner.tokenize match, :tokens => encoder value_expected = false - next elsif match = scan(/ [-+*=<>?:;,!&^|(\[{~%]+ | \.(?!\d) /x) value_expected = true diff --git a/lib/coderay/scanners/lua.rb b/lib/coderay/scanners/lua.rb index fb1e45a7..81d7dae4 100644 --- a/lib/coderay/scanners/lua.rb +++ b/lib/coderay/scanners/lua.rb @@ -76,7 +76,7 @@ def scan_tokens(encoder, options) encoder.text_token(match, :comment) elsif match = scan(/\[=*\[/) # [[ long (possibly multiline) string ]] - num_equals = match.count("=") # Number must match for comment end + num_equals = match.count("=") # Number must match for string end encoder.begin_group(:string) encoder.text_token(match, :delimiter) state = :long_string diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake index 1a23a5bc..ce32a02a 100644 --- a/rake_tasks/test.rake +++ b/rake_tasks/test.rake @@ -37,7 +37,7 @@ Please rename or remove it and run again to use the GitHub repository: else puts 'Downloading scanner test suite...' sh 'git clone https://github.com/rubychan/coderay-scanner-tests.git test/scanners/' - end + end unless ENV['SKIP_UPDATE_SCANNER_SUITE'] end namespace :scanner do From d4117f6a90068f3afa1afcc48f7ad9f9d3d3a533 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Fri, 3 Nov 2017 00:41:37 +0100 Subject: [PATCH 044/103] backport .gitignore from dsl branch --- .gitignore | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index deed1a27..4d962c0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,12 @@ -.DS_Store -.*~ +.* +bench/example.* coverage -pkg -spec/reports doc Gemfile.lock -.rvmrc -.ruby-gemset -.ruby-version +old-stuff +pkg +spec/examples.txt +spec/reports test/executable/source.rb.html test/executable/source.rb.json test/scanners -old-stuff From ec891978d3756c186104d8d243283f8d3104b85a Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 5 Nov 2017 18:10:57 +0100 Subject: [PATCH 045/103] trying to fix tests for Ruby 2.4 --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b99c95e0..1e020903 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ rvm: - 2.1 - 2.2 - 2.3 - - 2.4 + - 2.4.2 - ruby-head - jruby branches: @@ -21,6 +21,5 @@ matrix: allow_failures: - rvm: ruby-head - rvm: jruby - - rvm: rbx script: "rake test" # test:scanners" sudo: false From e603d988d7723841bc416160c45acefd9f2464eb Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 16 Dec 2017 00:36:19 +0100 Subject: [PATCH 046/103] test with ruby 2.5, too --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1e020903..a299b72e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,8 @@ rvm: - 2.1 - 2.2 - 2.3 - - 2.4.2 + - 2.4 + - 2.5 - ruby-head - jruby branches: From d38502167541a1cd1b505a0e468e0098e3ae7538 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 16 Dec 2017 00:40:39 +0100 Subject: [PATCH 047/103] tweak list of rubies to test --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a299b72e..49829cd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ rvm: - 2.1 - 2.2 - 2.3 - - 2.4 + - 2.4.2 - 2.5 - ruby-head - jruby @@ -20,6 +20,7 @@ before_script: - if (ruby -e "exit RUBY_VERSION.to_f >= 2.3"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT matrix: allow_failures: + - rvm: 2.5 - rvm: ruby-head - rvm: jruby script: "rake test" # test:scanners" From 913c1665970ffa4e1da79470fa732aa924569ec0 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Mon, 27 Aug 2018 15:02:30 +0200 Subject: [PATCH 048/103] Remove the statement that is not always reached. --- lib/coderay/encoders/html/output.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/coderay/encoders/html/output.rb b/lib/coderay/encoders/html/output.rb index de6f6ea1..ee87fea5 100644 --- a/lib/coderay/encoders/html/output.rb +++ b/lib/coderay/encoders/html/output.rb @@ -76,8 +76,6 @@ def wrap! element, *args apply_title! title end self - when nil - return self else raise "Unknown value %p for :wrap" % element end From acf422a444813a84a952b39a569bc0f26c77c5a5 Mon Sep 17 00:00:00 2001 From: Davide Angelocola Date: Sun, 30 Sep 2018 10:13:54 +0200 Subject: [PATCH 049/103] support for special type 'var' --- lib/coderay/scanners/java.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb index 982a796f..a490ec60 100644 --- a/lib/coderay/scanners/java.rb +++ b/lib/coderay/scanners/java.rb @@ -20,7 +20,7 @@ class Java < Scanner MAGIC_VARIABLES = %w[ this super ] # :nodoc: TYPES = %w[ boolean byte char class double enum float int interface long - short void + short void var ] << '[]' # :nodoc: because int[] should be highlighted as a type DIRECTIVES = %w[ abstract extends final implements native private protected public From dc767fca8ae78cf5760d3bf1d7e7150fde6c5951 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Thu, 14 Feb 2019 15:17:56 +0100 Subject: [PATCH 050/103] Add Ruby 2.6 fixing issues * Remove existing Tokens#filter (Array#filter) for Ruby 2.6 compatibility. * Install proper version's rdoc considering installed Ruby version. --- .travis.yml | 2 +- Gemfile | 2 +- lib/coderay/tokens.rb | 3 +++ test/unit/filter.rb | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 49829cd4..c1fa23a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ rvm: - 2.3 - 2.4.2 - 2.5 + - 2.6 - ruby-head - jruby branches: @@ -20,7 +21,6 @@ before_script: - if (ruby -e "exit RUBY_VERSION.to_f >= 2.3"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT matrix: allow_failures: - - rvm: 2.5 - rvm: ruby-head - rvm: jruby script: "rake test" # test:scanners" diff --git a/Gemfile b/Gemfile index 530c0e80..c19ac08f 100644 --- a/Gemfile +++ b/Gemfile @@ -14,5 +14,5 @@ group :development do gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1' gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0' gem 'json', '>= 1.8' if RUBY_VERSION < '1.9' - gem 'rdoc', RUBY_VERSION < '1.9' ? '~> 4.2.2' : '>= 4.2.2' + gem 'rdoc', Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3') ? '~> 4.2.2' : Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2') ? '< 6' : '>= 6' end diff --git a/lib/coderay/tokens.rb b/lib/coderay/tokens.rb index e7bffce2..b5f78e71 100644 --- a/lib/coderay/tokens.rb +++ b/lib/coderay/tokens.rb @@ -39,6 +39,9 @@ module CodeRay # You can serialize it to a JSON string and store it in a database, pass it # around to encode it more than once, send it to other algorithms... class Tokens < Array + # Remove Array#filter that is a new alias for Array#select on Ruby 2.6, + # for method_missing called with filter method. + undef_method :filter if instance_methods.include?(:filter) # The Scanner instance that created the tokens. attr_accessor :scanner diff --git a/test/unit/filter.rb b/test/unit/filter.rb index 25dff77c..6e939f32 100644 --- a/test/unit/filter.rb +++ b/test/unit/filter.rb @@ -18,6 +18,7 @@ def test_filtering_text_tokens tokens.text_token i.to_s, :index end assert_equal tokens, CodeRay::Encoders::Filter.new.encode_tokens(tokens) + assert_equal CodeRay::Tokens, tokens.filter.class assert_equal tokens, tokens.filter end @@ -32,6 +33,7 @@ def test_filtering_block_tokens tokens.end_line :index end assert_equal tokens, CodeRay::Encoders::Filter.new.encode_tokens(tokens) + assert_equal CodeRay::Tokens, tokens.filter.class assert_equal tokens, tokens.filter end From 80a33fcfcf3a46afb1541c464742edf4bf1da4e8 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 23 Feb 2019 15:30:07 +0100 Subject: [PATCH 051/103] add numeric to SQL types --- lib/coderay/scanners/sql.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/scanners/sql.rb b/lib/coderay/scanners/sql.rb index 7d57f773..c8725a8f 100644 --- a/lib/coderay/scanners/sql.rb +++ b/lib/coderay/scanners/sql.rb @@ -29,7 +29,7 @@ class SQL < Scanner char varchar varchar2 enum binary text tinytext mediumtext longtext blob tinyblob mediumblob longblob timestamp date time datetime year double decimal float int - integer tinyint mediumint bigint smallint unsigned bit + integer tinyint mediumint bigint smallint unsigned bit numeric bool boolean hex bin oct ) From cd7f90f4f7360c231b24e06193ea3138de5a7b84 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 23 Feb 2019 15:30:35 +0100 Subject: [PATCH 052/103] remove defunct Gemnasium badge --- README.markdown | 1 - 1 file changed, 1 deletion(-) diff --git a/README.markdown b/README.markdown index c3f71061..1402fe10 100644 --- a/README.markdown +++ b/README.markdown @@ -2,7 +2,6 @@ [![Build Status](https://travis-ci.org/rubychan/coderay.svg?branch=master)](https://travis-ci.org/rubychan/coderay) [![Gem Version](https://badge.fury.io/rb/coderay.svg)](https://badge.fury.io/rb/coderay) -[![Dependency Status](https://gemnasium.com/rubychan/coderay.svg)](https://gemnasium.com/rubychan/coderay) ## About From 9907f88568691916e4a869bc44126de8040a274d Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 01:28:31 +0100 Subject: [PATCH 053/103] update changelog --- Changes.textile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Changes.textile b/Changes.textile index 37de4ace..99b79c8d 100644 --- a/Changes.textile +++ b/Changes.textile @@ -2,6 +2,12 @@ h1=. CodeRay Version History p=. _This files lists all changes in the CodeRay library since the 0.9.8 release._ +h2. Changes in 1.1.3 + +* Tokens: Ensure Ruby 2.6 compatibility. [#233, thanks to Jun Aruga] +* SQL scanner: Add @numeric@ data type. [#223, thanks to m16a1] +* Java scanner: Add @var@ as type. [#229, thanks to Davide Angelocola] + h2. Changes in 1.1.2 * Ruby future: Add support for frozen string literals. [#211, thanks to Pat Allan] From d8b4818ec4b1f06a25206e2f1e61354940af9b4a Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 01:36:05 +0100 Subject: [PATCH 054/103] apparently, 1.8.7 fails on Travis? --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c1fa23a4..81917894 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ rvm: - 2.1 - 2.2 - 2.3 - - 2.4.2 + - 2.4 - 2.5 - 2.6 - ruby-head @@ -21,6 +21,7 @@ before_script: - if (ruby -e "exit RUBY_VERSION.to_f >= 2.3"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT matrix: allow_failures: + - rvm: 1.8.7 - rvm: ruby-head - rvm: jruby script: "rake test" # test:scanners" From f79710241c5bd19324418efcf24ecbf6d853a23c Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 01:39:28 +0100 Subject: [PATCH 055/103] add CodeClimate config --- .codeclimate.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 00000000..f6a420d4 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,6 @@ +engines: + rubocop: + enabled: true + checks: + Rubocop/Layout/TrailingWhitespace: + enabled: false From 1b140ba2183f6eabe086547834d243f71fe03134 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 02:25:20 +0100 Subject: [PATCH 056/103] remove .codeclimate.yml --- .codeclimate.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index f6a420d4..00000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,6 +0,0 @@ -engines: - rubocop: - enabled: true - checks: - Rubocop/Layout/TrailingWhitespace: - enabled: false From 1e66d13121efecb948a1684889cbb399e4c1ff3e Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 03:27:06 +0100 Subject: [PATCH 057/103] fix heredoc indentation --- test/functional/basic.rb | 8 ++++---- test/functional/for_redcloth.rb | 8 ++++---- test/unit/comment_filter.rb | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/functional/basic.rb b/test/functional/basic.rb index 752d4ba0..059d56c3 100644 --- a/test/functional/basic.rb +++ b/test/functional/basic.rb @@ -97,7 +97,7 @@ def test_comment_filter code more code - EXPECTED + EXPECTED #!/usr/bin/env ruby =begin A multi-line comment. @@ -105,7 +105,7 @@ def test_comment_filter code # A single-line comment. more code # and another comment, in-line. - INPUT + INPUT end def test_lines_of_code @@ -117,7 +117,7 @@ def test_lines_of_code code # A single-line comment. more code # and another comment, in-line. - INPUT + INPUT rHTML = <<-RHTML @@ -138,7 +138,7 @@ def test_lines_of_code - RHTML + RHTML assert_equal 0, CodeRay.scan(rHTML, :html).lines_of_code assert_equal 0, CodeRay.scan(rHTML, :php).lines_of_code assert_equal 0, CodeRay.scan(rHTML, :yaml).lines_of_code diff --git a/test/functional/for_redcloth.rb b/test/functional/for_redcloth.rb index 9fd244ed..d2b53f80 100644 --- a/test/functional/for_redcloth.rb +++ b/test/functional/for_redcloth.rb @@ -22,7 +22,7 @@ def test_for_redcloth
puts "Hello, World!"
- BLOCKCODE + BLOCKCODE RedCloth.new('bc[ruby]. puts "Hello, World!"').to_html end @@ -32,7 +32,7 @@ def test_for_redcloth_no_lang RedCloth.new('@puts "Hello, World!"@').to_html assert_equal <<-BLOCKCODE.chomp,
puts \"Hello, World!\"
- BLOCKCODE + BLOCKCODE RedCloth.new('bc. puts "Hello, World!"').to_html end @@ -40,7 +40,7 @@ def test_for_redcloth_style require 'coderay/for_redcloth' assert_equal <<-BLOCKCODE.chomp,
puts \"Hello, World!\"
- BLOCKCODE + BLOCKCODE RedCloth.new('bc{color: red}. puts "Hello, World!"').to_html end @@ -52,7 +52,7 @@ def test_for_redcloth_escapes
&
- BLOCKCODE + BLOCKCODE RedCloth.new('bc[ruby]. &').to_html end diff --git a/test/unit/comment_filter.rb b/test/unit/comment_filter.rb index e255d07f..c8147e93 100644 --- a/test/unit/comment_filter.rb +++ b/test/unit/comment_filter.rb @@ -47,7 +47,7 @@ def mymethod(self): def myfunction(): -PYTHON_FILTERED + PYTHON_FILTERED end end \ No newline at end of file From cb79f78f2d2e9c46f2cecd96071bcffb7b8b2f4a Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 03:27:13 +0100 Subject: [PATCH 058/103] reorder gems --- Gemfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index c19ac08f..10dc31c2 100644 --- a/Gemfile +++ b/Gemfile @@ -7,12 +7,12 @@ gemspec # Include everything needed to run rake, tests, features, etc. group :development do gem 'bundler' + gem 'json', '>= 1.8' if RUBY_VERSION < '1.9' gem 'rake', RUBY_VERSION < '1.9' ? '~> 10.5' : '>= 10.5' + gem 'rdoc', Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3') ? '~> 4.2.2' : Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2') ? '< 6' : '>= 6' gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3' - gem 'term-ansicolor', RUBY_VERSION < '2.0' ? '~> 1.3.2' : '>= 1.3.2' - gem 'tins', RUBY_VERSION < '2.0' ? '~> 1.6.0' : '>= 1.6.0' gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1' + gem 'term-ansicolor', RUBY_VERSION < '2.0' ? '~> 1.3.2' : '>= 1.3.2' gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0' - gem 'json', '>= 1.8' if RUBY_VERSION < '1.9' - gem 'rdoc', Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3') ? '~> 4.2.2' : Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2') ? '< 6' : '>= 6' + gem 'tins', RUBY_VERSION < '2.0' ? '~> 1.6.0' : '>= 1.6.0' end From 8e70c5de684d247f04589215f3709da514cb2e4d Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 03:27:31 +0100 Subject: [PATCH 059/103] start using RuboCop --- .rubocop.yml | 34 ++ .rubocop_todo.yml | 1224 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1258 insertions(+) create mode 100644 .rubocop.yml create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..cfc5479a --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,34 @@ +inherit_from: .rubocop_todo.yml + +require: + - rubocop-performance + +AllCops: + TargetRubyVersion: 2.3 + Exclude: + - 'test/scanners/**/*' + - 'bench/example.ruby' + - 'old-stuff/**/*' + - 'test/lib/**/*' + +Gemspec/RequiredRubyVersion: + Enabled: false + +Gemspec/DuplicatedAssignment: + Enabled: false + +Layout/AccessModifierIndentation: + Enabled: false + +Layout/AlignArguments: + Enabled: false + +Layout/AlignArray: + Enabled: false + +Layout/AlignHash: + Enabled: false + +Layout/SpaceInsideBlockBraces: + EnforcedStyle: space + EnforcedStyleForEmptyBraces: space diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..57b00e4d --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,1224 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2019-11-24 03:18:41 +0100 using RuboCop version 0.76.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 26 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth. +# SupportedStyles: case, end +Layout/CaseIndentation: + Exclude: + - 'lib/coderay/scanners/css.rb' + - 'lib/coderay/scanners/sass.rb' + - 'lib/coderay/scanners/yaml.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Layout/CommentIndentation: + Exclude: + - 'bin/coderay' + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/scanners/lua.rb' + +# Offense count: 82 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: leading, trailing +Layout/DotPosition: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowBorderComment, AllowMarginComment. +Layout/EmptyComment: + Exclude: + - 'ideosyncratic-ruby.rb' + +# Offense count: 30 +# Cop supports --auto-correct. +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'lib/coderay/encoders/debug_lint.rb' + - 'lib/coderay/encoders/encoder.rb' + - 'lib/coderay/encoders/html/css.rb' + - 'lib/coderay/encoders/html/numbering.rb' + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/encoders/lint.rb' + - 'lib/coderay/encoders/xml.rb' + - 'lib/coderay/helpers/file_type.rb' + - 'lib/coderay/helpers/plugin_host.rb' + - 'lib/coderay/scanners/diff.rb' + - 'lib/coderay/scanners/scanner.rb' + - 'lib/coderay/scanners/yaml.rb' + - 'lib/coderay/tokens.rb' + - 'rake_tasks/generator.rake' + - 'rake_tasks/test.rake' + +# Offense count: 6 +# Cop supports --auto-correct. +Layout/EmptyLineAfterMagicComment: + Exclude: + - 'lib/coderay.rb' + - 'lib/coderay/scanners/clojure.rb' + - 'lib/coderay/scanners/php.rb' + - 'lib/coderay/scanners/ruby/patterns.rb' + - 'lib/coderay/scanners/ruby/string_state.rb' + - 'test/functional/basic.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines. +Layout/EmptyLineBetweenDefs: + Exclude: + - 'lib/coderay/for_redcloth.rb' + - 'lib/coderay/tokens.rb' + +# Offense count: 9 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: around, only_before +Layout/EmptyLinesAroundAccessModifier: + Exclude: + - 'lib/coderay/encoders/filter.rb' + - 'lib/coderay/encoders/json.rb' + - 'lib/coderay/encoders/text.rb' + - 'lib/coderay/encoders/token_kind_filter.rb' + - 'lib/coderay/encoders/xml.rb' + - 'lib/coderay/encoders/yaml.rb' + +# Offense count: 18 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Exclude: + - 'lib/coderay/duo.rb' + - 'lib/coderay/encoders/html/css.rb' + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/scanners/c.rb' + - 'lib/coderay/scanners/cpp.rb' + - 'lib/coderay/scanners/delphi.rb' + - 'lib/coderay/scanners/java.rb' + - 'lib/coderay/scanners/xml.rb' + - 'rake_tasks/code_statistics.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Layout/EmptyLinesAroundMethodBody: + Exclude: + - 'lib/coderay/scanners/c.rb' + - 'lib/coderay/scanners/cpp.rb' + - 'lib/coderay/scanners/java.rb' + +# Offense count: 16 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines +Layout/EmptyLinesAroundModuleBody: + Exclude: + - 'lib/coderay/encoders/html/css.rb' + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/scanners/c.rb' + - 'lib/coderay/scanners/cpp.rb' + - 'lib/coderay/scanners/css.rb' + - 'lib/coderay/scanners/delphi.rb' + - 'lib/coderay/scanners/java.rb' + - 'lib/coderay/scanners/lua.rb' + - 'lib/coderay/scanners/xml.rb' + - 'lib/coderay/styles.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity. +# SupportedStylesAlignWith: keyword, variable, start_of_line +Layout/EndAlignment: + Exclude: + - 'lib/coderay/scanners/css.rb' + - 'lib/coderay/scanners/sass.rb' + - 'lib/coderay/scanners/yaml.rb' + +# Offense count: 2 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: native, lf, crlf +Layout/EndOfLine: + Exclude: + - 'rake_tasks/documentation.rake' + - 'rake_tasks/statistic.rake' + +# Offense count: 140 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Enabled: false + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_brackets +Layout/IndentFirstArrayElement: + EnforcedStyle: consistent + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_braces +Layout/IndentFirstHashElement: + EnforcedStyle: consistent + +# Offense count: 48 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: squiggly, active_support, powerpack, unindent +Layout/IndentHeredoc: + Enabled: false + +# Offense count: 53 +# Cop supports --auto-correct. +# Configuration parameters: Width, IgnoredPatterns. +Layout/IndentationWidth: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowDoxygenCommentStyle. +Layout/LeadingCommentSpace: + Exclude: + - 'lib/coderay/scanners/html.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symmetrical, new_line, same_line +Layout/MultilineArrayBraceLayout: + Exclude: + - 'lib/coderay/scanners/lua.rb' + +# Offense count: 78 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented, indented_relative_to_receiver +Layout/MultilineMethodCallIndentation: + Enabled: false + +# Offense count: 9 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/MultilineOperationIndentation: + Exclude: + - 'lib/coderay/encoders/html/numbering.rb' + - 'lib/coderay/encoders/token_kind_filter.rb' + - 'lib/coderay/for_redcloth.rb' + - 'lib/coderay/scanners/groovy.rb' + - 'lib/coderay/scanners/php.rb' + - 'lib/coderay/scanners/ruby.rb' + - 'test/functional/basic.rb' + +# Offense count: 17 +# Cop supports --auto-correct. +Layout/SpaceAfterComma: + Exclude: + - 'ideosyncratic-ruby.rb' + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/helpers/plugin_host.rb' + - 'lib/coderay/scanners/css.rb' + - 'lib/coderay/scanners/diff.rb' + - 'lib/coderay/scanners/ruby.rb' + - 'lib/coderay/scanners/ruby/string_state.rb' + - 'lib/coderay/scanners/sass.rb' + - 'lib/coderay/scanners/yaml.rb' + - 'lib/coderay/token_kinds.rb' + +# Offense count: 37 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment. +Layout/SpaceAroundOperators: + Exclude: + - 'ideosyncratic-ruby.rb' + - 'lib/coderay/scanners/c.rb' + - 'lib/coderay/scanners/cpp.rb' + - 'lib/coderay/scanners/diff.rb' + - 'lib/coderay/scanners/groovy.rb' + - 'lib/coderay/scanners/java.rb' + - 'lib/coderay/scanners/java_script.rb' + - 'lib/coderay/scanners/python.rb' + - 'lib/coderay/scanners/ruby/patterns.rb' + - 'rake_tasks/code_statistics.rb' + - 'test/unit/json_encoder.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Layout/SpaceBeforeComment: + Exclude: + - 'ideosyncratic-ruby.rb' + - 'lib/coderay/token_kinds.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/SpaceBeforeSemicolon: + Exclude: + - 'lib/coderay/scanners/diff.rb' + +# Offense count: 17 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'lib/coderay/encoders/encoder.rb' + - 'lib/coderay/scanners/scanner.rb' + - 'lib/coderay/styles/style.rb' + - 'test/unit/json_encoder.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceInsideParens: + Exclude: + - 'rake_tasks/code_statistics.rb' + +# Offense count: 32 +# Cop supports --auto-correct. +Layout/SpaceInsidePercentLiteralDelimiters: + Exclude: + - 'lib/coderay/scanners/clojure.rb' + - 'lib/coderay/scanners/groovy.rb' + - 'lib/coderay/scanners/java.rb' + - 'lib/coderay/scanners/java_script.rb' + - 'lib/coderay/scanners/php.rb' + - 'lib/coderay/scanners/ruby/patterns.rb' + - 'lib/coderay/scanners/sql.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Layout/SpaceInsideRangeLiteral: + Exclude: + - 'lib/coderay/encoders/html/css.rb' + - 'lib/coderay/encoders/html/numbering.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBrackets: space, no_space +Layout/SpaceInsideReferenceBrackets: + Exclude: + - 'lib/coderay/scanners/ruby/string_state.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceInsideStringInterpolation: + Exclude: + - 'ideosyncratic-ruby.rb' + - 'lib/coderay/scanners/ruby/string_state.rb' + +# Offense count: 12 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingBlankLines: + Exclude: + - 'lib/coderay/for_redcloth.rb' + - 'lib/coderay/scanners/clojure.rb' + - 'test/executable/source.rb' + - 'test/functional/for_redcloth.rb' + - 'test/unit/comment_filter.rb' + - 'test/unit/count.rb' + - 'test/unit/json_encoder.rb' + - 'test/unit/lines_of_code.rb' + - 'test/unit/null.rb' + - 'test/unit/statistic.rb' + - 'test/unit/text.rb' + - 'test/unit/tokens.rb' + +# Offense count: 1680 +# Cop supports --auto-correct. +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Enabled: false + +# Offense count: 485 +# Configuration parameters: AllowSafeAssignment. +Lint/AssignmentInCondition: + Enabled: false + +# Offense count: 2 +# Configuration parameters: AllowComments. +Lint/HandleExceptions: + Exclude: + - 'bin/coderay' + - 'lib/coderay/scanners/ruby.rb' + +# Offense count: 2 +Lint/IneffectiveAccessModifier: + Exclude: + - 'lib/coderay/encoders/html.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: runtime_error, standard_error +Lint/InheritException: + Exclude: + - 'lib/coderay/helpers/file_type.rb' + - 'lib/coderay/helpers/plugin_host.rb' + +# Offense count: 3 +Lint/LiteralAsCondition: + Exclude: + - 'ideosyncratic-ruby.rb' + - 'lib/coderay/scanners/haml.rb' + - 'test/executable/suite.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/LiteralInInterpolation: + Exclude: + - 'ideosyncratic-ruby.rb' + +# Offense count: 2 +Lint/Loop: + Exclude: + - 'lib/coderay/helpers/plugin_host.rb' + - 'lib/coderay/tokens.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/RedundantSplatExpansion: + Exclude: + - 'lib/coderay/scanners/ruby/string_state.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/SendWithMixinArgument: + Exclude: + - 'lib/coderay/for_redcloth.rb' + +# Offense count: 1 +# Configuration parameters: IgnoreImplicitReferences. +Lint/ShadowedArgument: + Exclude: + - 'lib/coderay/for_redcloth.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. +Lint/UnusedBlockArgument: + Exclude: + - 'lib/coderay/encoders/statistic.rb' + - 'lib/coderay/scanners/diff.rb' + - 'rake_tasks/code_statistics.rb' + +# Offense count: 38 +# Cop supports --auto-correct. +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods. +Lint/UnusedMethodArgument: + Enabled: false + +# Offense count: 2 +# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods. +Lint/UselessAccessModifier: + Exclude: + - 'lib/coderay/scanners/java_script.rb' + - 'lib/coderay/scanners/php.rb' + +# Offense count: 8 +Lint/UselessAssignment: + Exclude: + - 'lib/coderay/scanners/sql.rb' + - 'lib/coderay/scanners/yaml.rb' + - 'rake_tasks/code_statistics.rb' + - 'test/executable/suite.rb' + +# Offense count: 7 +# Configuration parameters: CheckForMethodsWithNoSideEffects. +Lint/Void: + Exclude: + - 'ideosyncratic-ruby.rb' + +# Offense count: 49 +Metrics/AbcSize: + Max: 361 + +# Offense count: 5 +# Configuration parameters: CountComments, ExcludedMethods. +# ExcludedMethods: refine +Metrics/BlockLength: + Max: 71 + +# Offense count: 183 +# Configuration parameters: CountBlocks. +Metrics/BlockNesting: + Max: 8 + +# Offense count: 27 +# Configuration parameters: CountComments. +Metrics/ClassLength: + Max: 380 + +# Offense count: 34 +Metrics/CyclomaticComplexity: + Max: 148 + +# Offense count: 63 +# Configuration parameters: CountComments, ExcludedMethods. +Metrics/MethodLength: + Max: 366 + +# Offense count: 5 +# Configuration parameters: CountComments. +Metrics/ModuleLength: + Max: 410 + +# Offense count: 34 +Metrics/PerceivedComplexity: + Max: 161 + +# Offense count: 2 +Naming/AccessorMethodName: + Exclude: + - 'lib/coderay/scanners/scanner.rb' + +# Offense count: 24 +Naming/ConstantName: + Exclude: + - 'lib/coderay/helpers/file_type.rb' + - 'lib/coderay/scanners/css.rb' + - 'lib/coderay/scanners/java/builtin_types.rb' + +# Offense count: 1 +# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS +Naming/FileName: + Exclude: + - 'ideosyncratic-ruby.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyleForLeadingUnderscores. +# SupportedStylesForLeadingUnderscores: disallowed, required, optional +Naming/MemoizedInstanceVariableName: + Exclude: + - 'lib/coderay/scanners/scanner.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: PreferredName. +Naming/RescuedExceptionsVariableName: + Exclude: + - 'bin/coderay' + - 'lib/coderay/helpers/plugin_host.rb' + +# Offense count: 5 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: io, id, to, by, on, in, at, ip, db, os +Naming/UncommunicativeMethodParamName: + Exclude: + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/scanners/diff.rb' + - 'lib/coderay/scanners/scanner.rb' + +# Offense count: 8 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: snake_case, camelCase +Naming/VariableName: + Exclude: + - 'lib/coderay/encoders/encoder.rb' + - 'lib/coderay/encoders/html.rb' + - 'test/functional/basic.rb' + +# Offense count: 2 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: snake_case, normalcase, non_integer +Naming/VariableNumber: + Exclude: + - 'test/unit/tokens.rb' + +# Offense count: 1 +Performance/Caller: + Exclude: + - 'lib/coderay/scanners/scanner.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Performance/Casecmp: + Exclude: + - 'rake_tasks/generator.rake' + +# Offense count: 1 +# Cop supports --auto-correct. +Performance/StringReplacement: + Exclude: + - 'lib/coderay/encoders/html.rb' + +# Offense count: 3 +Performance/UnfreezeString: + Exclude: + - 'lib/coderay/encoders/encoder.rb' + - 'lib/coderay/encoders/html.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect. +Security/JSONLoad: + Exclude: + - 'test/unit/json_encoder.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Security/YAMLLoad: + Exclude: + - 'test/unit/duo.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: inline, group +Style/AccessModifierDeclarations: + Exclude: + - 'lib/coderay/encoders/encoder.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, conditionals +Style/AndOr: + Exclude: + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/scanners/clojure.rb' + - 'lib/coderay/scanners/erb.rb' + - 'lib/coderay/scanners/lua.rb' + - 'lib/coderay/scanners/yaml.rb' + +# Offense count: 9 +# Configuration parameters: AllowedChars. +Style/AsciiComments: + Exclude: + - 'lib/coderay/scanners/lua.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/Attr: + Exclude: + - 'lib/coderay/encoders/html/css.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners. +# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# IgnoredMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'lib/coderay/scanners/python.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: braces, no_braces, context_dependent +Style/BracesAroundHashParameters: + Exclude: + - 'lib/coderay/scanners/ruby/patterns.rb' + +# Offense count: 3 +Style/CaseEquality: + Exclude: + - 'bin/coderay' + - 'rake_tasks/generator.rake' + - 'test/executable/suite.rb' + +# Offense count: 35 +# Cop supports --auto-correct. +Style/CharacterLiteral: + Exclude: + - 'ideosyncratic-ruby.rb' + - 'lib/coderay/encoders/html/numbering.rb' + - 'lib/coderay/scanners/c.rb' + - 'lib/coderay/scanners/cpp.rb' + - 'lib/coderay/scanners/css.rb' + - 'lib/coderay/scanners/go.rb' + - 'lib/coderay/scanners/groovy.rb' + - 'lib/coderay/scanners/java_script.rb' + - 'lib/coderay/scanners/python.rb' + - 'lib/coderay/scanners/ruby.rb' + - 'lib/coderay/scanners/sass.rb' + - 'lib/coderay/scanners/scanner.rb' + - 'lib/coderay/scanners/sql.rb' + - 'lib/coderay/scanners/yaml.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, EnforcedStyle. +# SupportedStyles: nested, compact +Style/ClassAndModuleChildren: + Exclude: + - 'lib/coderay/helpers/word_list.rb' + - 'lib/coderay/scanners/java/builtin_types.rb' + - 'lib/coderay/scanners/ruby/patterns.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/ClassMethods: + Exclude: + - 'lib/coderay/encoders/html/css.rb' + +# Offense count: 2 +Style/ClassVars: + Exclude: + - 'lib/coderay/encoders/encoder.rb' + +# Offense count: 2 +Style/CommentedKeyword: + Exclude: + - 'lib/coderay/scanners/scanner.rb' + +# Offense count: 16 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'bin/coderay' + - 'coderay.gemspec' + - 'lib/coderay/encoders/html.rb' + - 'lib/coderay/encoders/html/numbering.rb' + - 'lib/coderay/encoders/xml.rb' + - 'lib/coderay/scanners/debug.rb' + - 'lib/coderay/scanners/html.rb' + - 'lib/coderay/scanners/java_script.rb' + - 'lib/coderay/scanners/php.rb' + - 'lib/coderay/scanners/raydebug.rb' + - 'lib/coderay/scanners/scanner.rb' + - 'rake_tasks/code_statistics.rb' + - 'test/executable/suite.rb' + +# Offense count: 21 +Style/Documentation: + Enabled: false + +# Offense count: 2 +Style/DoubleNegation: + Exclude: + - 'lib/coderay/scanners/python.rb' + - 'lib/coderay/scanners/ruby.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Style/EachWithObject: + Exclude: + - 'bin/coderay' + - 'lib/coderay/helpers/plugin.rb' + - 'rake_tasks/code_statistics.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Style/EmptyCaseCondition: + Exclude: + - 'lib/coderay/encoders/xml.rb' + - 'lib/coderay/scanners/yaml.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/EmptyLiteral: + Exclude: + - 'lib/coderay/encoders/html/css.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: compact, expanded +Style/EmptyMethod: + Exclude: + - 'lib/coderay/encoders/encoder.rb' + - 'lib/coderay/scanners/scanner.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +Style/Encoding: + Exclude: + - 'lib/coderay.rb' + - 'lib/coderay/scanners/clojure.rb' + - 'lib/coderay/scanners/lua.rb' + - 'lib/coderay/scanners/php.rb' + - 'lib/coderay/scanners/ruby/patterns.rb' + - 'lib/coderay/scanners/ruby/string_state.rb' + - 'lib/coderay/scanners/scanner.rb' + - 'test/functional/basic.rb' + +# Offense count: 12 +# Cop supports --auto-correct. +Style/ExpandPathArguments: + Exclude: + - 'bench/bench.rb' + - 'coderay.gemspec' + - 'lib/coderay.rb' + - 'test/executable/suite.rb' + - 'test/functional/basic.rb' + - 'test/functional/examples.rb' + - 'test/functional/for_redcloth.rb' + - 'test/functional/suite.rb' + - 'test/unit/file_type.rb' + - 'test/unit/lines_of_code.rb' + - 'test/unit/plugin.rb' + +# Offense count: 22 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: each, for +Style/For: + Exclude: + - 'Rakefile' + - 'lib/coderay/encoders/encoder.rb' + - 'lib/coderay/encoders/html/css.rb' + - 'lib/coderay/helpers/file_type.rb' + - 'lib/coderay/helpers/plugin_host.rb' + - 'lib/coderay/scanners/diff.rb' + - 'lib/coderay/tokens.rb' + - 'rake_tasks/generator.rake' + - 'rake_tasks/test.rake' + - 'test/functional/basic.rb' + - 'test/functional/suite.rb' + - 'test/unit/html.rb' + - 'test/unit/json_encoder.rb' + - 'test/unit/suite.rb' + - 'test/unit/token_kind_filter.rb' + +# Offense count: 62 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: format, sprintf, percent +Style/FormatString: + Enabled: false + +# Offense count: 87 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: annotated, template, unannotated +Style/FormatStringToken: + Enabled: false + +# Offense count: 112 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, never +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 9 +# Configuration parameters: AllowedVariables. +Style/GlobalVars: + Exclude: + - 'bin/coderay' + - 'lib/coderay.rb' + - 'lib/coderay/encoders/html.rb' + - 'lib/coderay/scanners/ruby.rb' + - 'test/functional/suite.rb' + - 'test/unit/suite.rb' + +# Offense count: 16 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'lib/coderay/encoders/html.rb' + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/encoders/terminal.rb' + - 'lib/coderay/helpers/plugin_host.rb' + - 'lib/coderay/scanners/haml.rb' + - 'lib/coderay/scanners/html.rb' + - 'lib/coderay/scanners/python.rb' + - 'lib/coderay/scanners/scanner.rb' + - 'test/executable/suite.rb' + - 'test/unit/file_type.rb' + +# Offense count: 306 +# Cop supports --auto-correct. +# Configuration parameters: UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +Style/HashSyntax: + EnforcedStyle: hash_rockets + +# Offense count: 4 +Style/IdenticalConditionalBranches: + Exclude: + - 'lib/coderay/scanners/html.rb' + - 'lib/coderay/scanners/ruby.rb' + +# Offense count: 2 +# Configuration parameters: AllowIfModifier. +Style/IfInsideElse: + Exclude: + - 'lib/coderay/scanners/css.rb' + - 'lib/coderay/scanners/sass.rb' + +# Offense count: 42 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Enabled: false + +# Offense count: 3 +Style/IfUnlessModifierOfIfUnless: + Exclude: + - 'lib/coderay/encoders/text.rb' + - 'lib/coderay/scanners/erb.rb' + - 'rake_tasks/test.rake' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/InfiniteLoop: + Exclude: + - 'lib/coderay/scanners/haml.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/LineEndConcatenation: + Exclude: + - 'lib/coderay/for_redcloth.rb' + - 'test/functional/basic.rb' + +# Offense count: 221 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline +Style/MethodDefParentheses: + Enabled: false + +# Offense count: 1 +Style/MethodMissingSuper: + Exclude: + - 'lib/coderay/tokens_proxy.rb' + +# Offense count: 2 +Style/MissingRespondToMissing: + Exclude: + - 'lib/coderay/tokens.rb' + - 'lib/coderay/tokens_proxy.rb' + +# Offense count: 1 +Style/MultilineBlockChain: + Exclude: + - 'lib/coderay/helpers/plugin_host.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +Style/MultilineIfModifier: + Exclude: + - 'lib/coderay/encoders/text.rb' + - 'lib/coderay/scanners/erb.rb' + - 'rake_tasks/documentation.rake' + - 'rake_tasks/test.rake' + - 'test/functional/for_redcloth.rb' + +# Offense count: 10 +Style/MultilineTernaryOperator: + Exclude: + - 'lib/coderay/scanners/ruby.rb' + +# Offense count: 7 +Style/MultipleComparison: + Exclude: + - 'lib/coderay/scanners/groovy.rb' + - 'lib/coderay/scanners/html.rb' + - 'lib/coderay/scanners/java.rb' + - 'lib/coderay/scanners/java_script.rb' + - 'lib/coderay/scanners/sass.rb' + - 'lib/coderay/scanners/yaml.rb' + +# Offense count: 247 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Enabled: false + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: both, prefix, postfix +Style/NegatedIf: + Exclude: + - 'lib/coderay/scanners/diff.rb' + - 'lib/coderay/scanners/groovy.rb' + +# Offense count: 6 +Style/NestedTernaryOperator: + Exclude: + - 'Gemfile' + - 'lib/coderay/scanners/php.rb' + - 'lib/coderay/scanners/python.rb' + - 'lib/coderay/scanners/sass.rb' + - 'lib/coderay/scanners/sql.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: predicate, comparison +Style/NilComparison: + Exclude: + - 'lib/coderay/encoders/html/numbering.rb' + - 'lib/coderay/scanners/python.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/Not: + Exclude: + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/scanners/clojure.rb' + - 'lib/coderay/scanners/erb.rb' + +# Offense count: 12 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'spec/**/*' + - 'lib/coderay/encoders/html.rb' + - 'lib/coderay/encoders/html/numbering.rb' + - 'lib/coderay/scanners/diff.rb' + - 'lib/coderay/scanners/groovy.rb' + - 'lib/coderay/scanners/haml.rb' + - 'lib/coderay/scanners/lua.rb' + - 'lib/coderay/scanners/ruby.rb' + - 'lib/coderay/tokens.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/OneLineConditional: + Exclude: + - 'rake_tasks/code_statistics.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/OrAssignment: + Exclude: + - 'lib/coderay/scanners/groovy.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/ParallelAssignment: + Exclude: + - 'lib/coderay/encoders/statistic.rb' + - 'lib/coderay/scanners/ruby.rb' + +# Offense count: 30 +# Cop supports --auto-correct. +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Enabled: false + +# Offense count: 6 +# Cop supports --auto-correct. +Style/PerlBackrefs: + Exclude: + - 'bin/coderay' + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/for_redcloth.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: short, verbose +Style/PreferredHashMethods: + Exclude: + - 'lib/coderay/encoders/debug_lint.rb' + - 'lib/coderay/encoders/lint.rb' + - 'lib/coderay/helpers/plugin_host.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Exclude: + - 'lib/coderay/encoders/html/css.rb' + - 'lib/coderay/scanners/diff.rb' + - 'lib/coderay/scanners/scanner.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/RedundantSelf: + Exclude: + - 'lib/coderay/encoders/html/output.rb' + - 'lib/coderay/helpers/plugin_host.rb' + - 'lib/coderay/scanners/scanner.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantSort: + Exclude: + - 'test/unit/plugin.rb' + +# Offense count: 58 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, AllowInnerSlashes. +# SupportedStyles: slashes, percent_r, mixed +Style/RegexpLiteral: + Enabled: false + +# Offense count: 4 +# Cop supports --auto-correct. +Style/RescueModifier: + Exclude: + - 'rake_tasks/code_statistics.rb' + - 'rake_tasks/test.rake' + - 'test/functional/for_redcloth.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, explicit +Style/RescueStandardError: + Exclude: + - 'lib/coderay/scanners/ruby.rb' + - 'lib/coderay/scanners/scanner.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist. +# Whitelist: present?, blank?, presence, try, try! +Style/SafeNavigation: + Exclude: + - 'bin/coderay' + - 'lib/coderay/scanners/ruby.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowAsExpressionSeparator. +Style/Semicolon: + Exclude: + - 'lib/coderay/scanners/diff.rb' + - 'lib/coderay/scanners/ruby/string_state.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: AllowIfMethodIsEmpty. +Style/SingleLineMethods: + Exclude: + - 'lib/coderay/tokens.rb' + +# Offense count: 24 +# Cop supports --auto-correct. +# Configuration parameters: . +# SupportedStyles: use_perl_names, use_english_names +Style/SpecialGlobalVars: + EnforcedStyle: use_perl_names + +# Offense count: 1 +# Cop supports --auto-correct. +Style/StderrPuts: + Exclude: + - 'lib/coderay/encoders/json.rb' + +# Offense count: 131 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiteralsInInterpolation: + Exclude: + - 'rake_tasks/code_statistics.rb' + +# Offense count: 1 +Style/StructInheritance: + Exclude: + - 'lib/coderay/scanners/ruby/string_state.rb' + +# Offense count: 37 +# Cop supports --auto-correct. +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: IgnoredMethods. +# IgnoredMethods: respond_to, define_method +Style/SymbolProc: + Exclude: + - 'bin/coderay' + - 'lib/coderay/scanners/scanner.rb' + - 'test/unit/plugin.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex +Style/TernaryParentheses: + Exclude: + - 'lib/coderay/scanners/diff.rb' + +# Offense count: 21 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArrayLiteral: + Exclude: + - 'lib/coderay/scanners/c.rb' + - 'lib/coderay/scanners/cpp.rb' + - 'lib/coderay/scanners/css.rb' + - 'lib/coderay/scanners/delphi.rb' + - 'lib/coderay/scanners/go.rb' + - 'lib/coderay/scanners/html.rb' + - 'lib/coderay/scanners/json.rb' + - 'lib/coderay/scanners/python.rb' + - 'lib/coderay/scanners/scanner.rb' + - 'test/unit/json_encoder.rb' + +# Offense count: 26 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInHashLiteral: + Exclude: + - 'lib/coderay/encoders/html.rb' + - 'lib/coderay/encoders/terminal.rb' + - 'lib/coderay/encoders/xml.rb' + - 'lib/coderay/for_redcloth.rb' + - 'lib/coderay/helpers/file_type.rb' + - 'lib/coderay/scanners/diff.rb' + - 'lib/coderay/scanners/groovy.rb' + - 'lib/coderay/scanners/html.rb' + - 'lib/coderay/scanners/java.rb' + - 'lib/coderay/scanners/java_script.rb' + - 'lib/coderay/scanners/ruby/patterns.rb' + - 'lib/coderay/scanners/sql.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/VariableInterpolation: + Exclude: + - 'bin/coderay' + - 'ideosyncratic-ruby.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: WordRegex. +# SupportedStyles: percent, brackets +Style/WordArray: + EnforcedStyle: percent + MinSize: 69 + +# Offense count: 1 +# Cop supports --auto-correct. +Style/ZeroLengthPredicate: + Exclude: + - 'lib/coderay/encoders/html.rb' + +# Offense count: 813 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Metrics/LineLength: + Max: 266 From 279c9239afa1d6537db5965b31b9e883a0877876 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 03:29:11 +0100 Subject: [PATCH 060/103] not available on CodeClimate --- .rubocop.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index cfc5479a..978ab2bd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,8 +1,5 @@ inherit_from: .rubocop_todo.yml -require: - - rubocop-performance - AllCops: TargetRubyVersion: 2.3 Exclude: From a632d9056853984aac6c930523a27fde42ae28a5 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 14:28:25 +0100 Subject: [PATCH 061/103] Update README.markdown --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 1402fe10..410d1bff 100644 --- a/README.markdown +++ b/README.markdown @@ -1,7 +1,7 @@ # CodeRay [![Build Status](https://travis-ci.org/rubychan/coderay.svg?branch=master)](https://travis-ci.org/rubychan/coderay) -[![Gem Version](https://badge.fury.io/rb/coderay.svg)](https://badge.fury.io/rb/coderay) +[![Gem Version](https://badge.fury.io/rb/coderay.svg)](https://badge.fury.io/rb/coderay) [![Maintainability](https://api.codeclimate.com/v1/badges/e015bbd5eab45d948b6b/maintainability)](https://codeclimate.com/github/rubychan/coderay/maintainability) ## About From dceb150aff9dca50e1817636f03aa7fd7d1bb9a5 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 14:36:39 +0100 Subject: [PATCH 062/103] try setting up code climate test coverage --- .travis.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 81917894..19932b4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ env: global: - "JRUBY_OPTS=-Xcext.enabled=true" + - "CC_TEST_REPORTER_ID=faa393209ff0a104cf37511a9a03510bcee37951971b1ca4ffc2af217851d47e" +language: ruby rvm: - 1.8.7 - ree @@ -14,15 +16,20 @@ rvm: - 2.6 - ruby-head - jruby -branches: - only: - - master -before_script: -- if (ruby -e "exit RUBY_VERSION.to_f >= 2.3"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT matrix: allow_failures: - rvm: 1.8.7 - rvm: ruby-head - rvm: jruby +branches: + only: + - master +before_script: + - if (ruby -e "exit RUBY_VERSION.to_f >= 2.3"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + - chmod +x ./cc-test-reporter + - ./cc-test-reporter before-build script: "rake test" # test:scanners" +after_script: + - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT sudo: false From 3b34dc32db8e9371ad6a4bc0f810656aac8c3385 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 14:50:20 +0100 Subject: [PATCH 063/103] enfore SpaceAroundOperators --- .rubocop_todo.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 57b00e4d..317e6a47 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -237,18 +237,7 @@ Layout/SpaceAfterComma: # Cop supports --auto-correct. # Configuration parameters: AllowForAlignment. Layout/SpaceAroundOperators: - Exclude: - - 'ideosyncratic-ruby.rb' - - 'lib/coderay/scanners/c.rb' - - 'lib/coderay/scanners/cpp.rb' - - 'lib/coderay/scanners/diff.rb' - - 'lib/coderay/scanners/groovy.rb' - - 'lib/coderay/scanners/java.rb' - - 'lib/coderay/scanners/java_script.rb' - - 'lib/coderay/scanners/python.rb' - - 'lib/coderay/scanners/ruby/patterns.rb' - - 'rake_tasks/code_statistics.rb' - - 'test/unit/json_encoder.rb' + AllowForAlignment: true # Offense count: 2 # Cop supports --auto-correct. From ad756954fda50c328f000bf88da30a2b09c99043 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 14:55:02 +0100 Subject: [PATCH 064/103] tweaks to RuboCop config --- .rubocop.yml | 1 + .rubocop_todo.yml | 23 ----------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 978ab2bd..e248a433 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,6 +2,7 @@ inherit_from: .rubocop_todo.yml AllCops: TargetRubyVersion: 2.3 + DisplayStyleGuide: true Exclude: - 'test/scanners/**/*' - 'bench/example.ruby' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 317e6a47..17f16e57 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -530,29 +530,6 @@ Naming/VariableNumber: Exclude: - 'test/unit/tokens.rb' -# Offense count: 1 -Performance/Caller: - Exclude: - - 'lib/coderay/scanners/scanner.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Performance/Casecmp: - Exclude: - - 'rake_tasks/generator.rake' - -# Offense count: 1 -# Cop supports --auto-correct. -Performance/StringReplacement: - Exclude: - - 'lib/coderay/encoders/html.rb' - -# Offense count: 3 -Performance/UnfreezeString: - Exclude: - - 'lib/coderay/encoders/encoder.rb' - - 'lib/coderay/encoders/html.rb' - # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect. From 7eee081137cd911678e63c62413fc8edba337ea1 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 15:08:54 +0100 Subject: [PATCH 065/103] enforce RuboCop version --- .codeclimate.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 00000000..ae1b8e51 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,4 @@ +plugins: + rubocop: + enabled: true + channel: rubocop-0-76 From 88ca92c19d51307dd365210b5bc824afdbcc1833 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 15:16:26 +0100 Subject: [PATCH 066/103] tunr off maintainability checks --- .codeclimate.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.codeclimate.yml b/.codeclimate.yml index ae1b8e51..c01311f6 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,3 +1,25 @@ +version: "2" +checks: + argument-count: + enabled: false + complex-logic: + enabled: false + file-lines: + enabled: false + identical-code: + enabled: false + method-complexity: + enabled: false + method-count: + enabled: false + method-lines: + enabled: false + nested-control-flow: + enabled: false + return-statements: + enabled: false + similar-code: + enabled: false plugins: rubocop: enabled: true From 591c67b65dc4daada24ed1809605e9cbcfb3336b Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 15:20:45 +0100 Subject: [PATCH 067/103] fix spaces in JSONEncoderTest --- test/unit/json_encoder.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/unit/json_encoder.rb b/test/unit/json_encoder.rb index 4e44a646..a3a8152b 100644 --- a/test/unit/json_encoder.rb +++ b/test/unit/json_encoder.rb @@ -10,13 +10,13 @@ def test_json_output $:.delete File.dirname(__FILE__) json = CodeRay.scan('puts "Hello world!"', :ruby).json assert_equal [ - {"type"=>"text", "text"=>"puts", "kind"=>"ident"}, - {"type"=>"text", "text"=>" ", "kind"=>"space"}, - {"type"=>"block", "action"=>"open", "kind"=>"string"}, - {"type"=>"text", "text"=>"\"", "kind"=>"delimiter"}, - {"type"=>"text", "text"=>"Hello world!", "kind"=>"content"}, - {"type"=>"text", "text"=>"\"", "kind"=>"delimiter"}, - {"type"=>"block", "action"=>"close", "kind"=>"string"}, + { "type" => "text", "text" => "puts", "kind" => "ident" }, + { "type" => "text", "text" => " ", "kind" => "space" }, + { "type" => "block", "action" => "open", "kind" => "string" }, + { "type" => "text", "text" => "\"", "kind" => "delimiter" }, + { "type" => "text", "text" => "Hello world!", "kind" => "content" }, + { "type" => "text", "text" => "\"", "kind" => "delimiter" }, + { "type" => "block", "action" => "close", "kind" => "string" }, ], JSON.load(json) ensure for path in old_load_paths - $: From b5b3430d4635682b767c44469e28a70fe234187e Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 15:22:21 +0100 Subject: [PATCH 068/103] 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 84b6e8ec..fb2f30db 100644 --- a/lib/coderay/scanners/c.rb +++ b/lib/coderay/scanners/c.rb @@ -37,7 +37,7 @@ class C < Scanner 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 40aeb426..cd4d0941 100644 --- a/lib/coderay/scanners/cpp.rb +++ b/lib/coderay/scanners/cpp.rb @@ -49,7 +49,7 @@ class CPlusPlus < Scanner 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 74a6c27a..a2a6fccf 100644 --- a/lib/coderay/scanners/diff.rb +++ b/lib/coderay/scanners/diff.rb @@ -109,7 +109,7 @@ def scan_tokens encoder, options 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 @@ def diff a, b # 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 c64454f0..c52ce8d3 100644 --- a/lib/coderay/scanners/groovy.rb +++ b/lib/coderay/scanners/groovy.rb @@ -22,8 +22,8 @@ class Groovy < Java 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 a490ec60..7dd1919e 100644 --- a/lib/coderay/scanners/java.rb +++ b/lib/coderay/scanners/java.rb @@ -38,7 +38,7 @@ class Java < Scanner 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 5e278137..8c13d4ff 100644 --- a/lib/coderay/scanners/java_script.rb +++ b/lib/coderay/scanners/java_script.rb @@ -40,8 +40,8 @@ class JavaScript < Scanner 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 09c8b6e7..5da553a6 100644 --- a/lib/coderay/scanners/python.rb +++ b/lib/coderay/scanners/python.rb @@ -63,7 +63,7 @@ class Python < Scanner 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 e5a156d8..cd942d0d 100644 --- a/lib/coderay/scanners/ruby/patterns.rb +++ b/lib/coderay/scanners/ruby/patterns.rb @@ -60,7 +60,7 @@ module Ruby::Patterns # :nodoc: all 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 0a2016bd..32eb3f06 100644 --- a/rake_tasks/code_statistics.rb +++ b/rake_tasks/code_statistics.rb @@ -156,7 +156,7 @@ def print_code_test_stats 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 From 3dbf995d6d09430a0d3ae9f24b38d7bd7314574e Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 15:31:40 +0100 Subject: [PATCH 069/103] enforce UselessAccessModifier --- .rubocop_todo.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 17f16e57..2b0c3708 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -412,13 +412,6 @@ Lint/UnusedBlockArgument: Lint/UnusedMethodArgument: Enabled: false -# Offense count: 2 -# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods. -Lint/UselessAccessModifier: - Exclude: - - 'lib/coderay/scanners/java_script.rb' - - 'lib/coderay/scanners/php.rb' - # Offense count: 8 Lint/UselessAssignment: Exclude: From 668f7fb8d8fa105638155973b73606aca16e3dc4 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 15:44:32 +0100 Subject: [PATCH 070/103] add RSpec --- Gemfile | 1 + spec/coderay_spec.rb | 7 +++ spec/spec_helper.rb | 100 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 spec/coderay_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/Gemfile b/Gemfile index 10dc31c2..12eeccc0 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,7 @@ group :development do gem 'rake', RUBY_VERSION < '1.9' ? '~> 10.5' : '>= 10.5' gem 'rdoc', Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3') ? '~> 4.2.2' : Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2') ? '< 6' : '>= 6' gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3' + gem 'rspec', '~> 3.9.0' gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1' gem 'term-ansicolor', RUBY_VERSION < '2.0' ? '~> 1.3.2' : '>= 1.3.2' gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0' diff --git a/spec/coderay_spec.rb b/spec/coderay_spec.rb new file mode 100644 index 00000000..85e66606 --- /dev/null +++ b/spec/coderay_spec.rb @@ -0,0 +1,7 @@ +RSpec.describe CodeRay do + describe 'version' do + it "returns the Gem's version" do + expect(CodeRay::VERSION).to match(/\A\d\.\d\.\d?\z/) + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 00000000..251aa510 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,100 @@ +# This file was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + + # This option will default to `:apply_to_host_groups` in RSpec 4 (and will + # have no way to turn it off -- the option exists only for backwards + # compatibility in RSpec 3). It causes shared context metadata to be + # inherited by the metadata hash of host groups and examples, rather than + # triggering implicit auto-inclusion in groups with matching metadata. + config.shared_context_metadata_behavior = :apply_to_host_groups + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # This allows you to limit a spec run to individual examples or groups + # you care about by tagging them with `:focus` metadata. When nothing + # is tagged with `:focus`, all examples get run. RSpec also provides + # aliases for `it`, `describe`, and `context` that include `:focus` + # metadata: `fit`, `fdescribe` and `fcontext`, respectively. + config.filter_run_when_matching :focus + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + config.disable_monkey_patching! + + # This setting enables warnings. It's recommended, but in some cases may + # be too noisy due to issues in dependencies. + config.warnings = true + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = "doc" + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end +end From 25de07df92d9c0ecf535d60052c6afd307c0f972 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 15:51:16 +0100 Subject: [PATCH 071/103] run specs on rake test --- rake_tasks/test.rake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake index ce32a02a..277bd33b 100644 --- a/rake_tasks/test.rake +++ b/rake_tasks/test.rake @@ -79,4 +79,7 @@ Please rename or remove it and run again to use the GitHub repository: end end -task :test => %w(test:functional test:units test:exe) +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new(:spec) + +task :test => %w(test:functional test:units test:exe spec) From 0d373531da1231575345be1df8710cac7c0ab079 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 15:56:03 +0100 Subject: [PATCH 072/103] fix load path --- spec/spec_helper.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 251aa510..a63ebfee 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -98,3 +98,6 @@ Kernel.srand config.seed =end end + +$:.unshift File.expand_path('../lib', __FILE__) +require 'coderay' From a59099685e34c29438b11dc6eacaeea1215a150b Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:01:53 +0100 Subject: [PATCH 073/103] still not loaded? --- spec/coderay_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/coderay_spec.rb b/spec/coderay_spec.rb index 85e66606..2c7b91e4 100644 --- a/spec/coderay_spec.rb +++ b/spec/coderay_spec.rb @@ -1,3 +1,5 @@ +require File.expand_path('../spec_helper', __FILE__) + RSpec.describe CodeRay do describe 'version' do it "returns the Gem's version" do From 1962f994113aec922cb3b1902ca1dc77f78de930 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:12:09 +0100 Subject: [PATCH 074/103] add SimpleCov --- Gemfile | 1 + spec/spec_helper.rb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index 12eeccc0..0369afec 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,7 @@ group :development do gem 'rdoc', Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3') ? '~> 4.2.2' : Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2') ? '< 6' : '>= 6' gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3' gem 'rspec', '~> 3.9.0' + gem 'simplecov', '~> 0.17.1' gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1' gem 'term-ansicolor', RUBY_VERSION < '2.0' ? '~> 1.3.2' : '>= 1.3.2' gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a63ebfee..9c1bc729 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,6 @@ +require 'simplecov' +SimpleCov.start + # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause From 77734f6cfa1d90b80c53ac71c880dc5978e58dd7 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:14:18 +0100 Subject: [PATCH 075/103] fix tests for Ruby Enterprise Edition? --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9c1bc729..66f4127b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -29,7 +29,7 @@ # ...rather than: # # => "be bigger than 2" expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end + end if RUBY_VERSION >= '1.9' # rspec-mocks config goes here. You can use an alternate test double # library (such as bogus or mocha) by changing the `mock_with` option here. From 8d25b7227f3eb3efb92de2d2ff57e83aed47e8b6 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:21:29 +0100 Subject: [PATCH 076/103] add spec for CodeRay.coderay_path --- spec/coderay_spec.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/coderay_spec.rb b/spec/coderay_spec.rb index 2c7b91e4..8a299b3c 100644 --- a/spec/coderay_spec.rb +++ b/spec/coderay_spec.rb @@ -1,9 +1,16 @@ require File.expand_path('../spec_helper', __FILE__) RSpec.describe CodeRay do - describe 'version' do + describe '::VERSION' do it "returns the Gem's version" do expect(CodeRay::VERSION).to match(/\A\d\.\d\.\d?\z/) end end + + describe '.coderay_path' do + it 'returns an absolute file path to the given code file' do + base = File.expand_path('../..', __FILE__) + expect(CodeRay.coderay_path('file')).to eq("#{base}/lib/coderay/file") + end + end end From 69ec4d90ee666563d32341f81b388dd25c3cbbff Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:37:06 +0100 Subject: [PATCH 077/103] fix tests for Ruby 2.3 --- rake_tasks/test.rake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake index 277bd33b..51239fbb 100644 --- a/rake_tasks/test.rake +++ b/rake_tasks/test.rake @@ -79,7 +79,9 @@ Please rename or remove it and run again to use the GitHub repository: end end -require 'rspec/core/rake_task' -RSpec::Core::RakeTask.new(:spec) +unless RUBY_VERSION[/^2.3/] + require 'rspec/core/rake_task' + RSpec::Core::RakeTask.new(:spec) +end task :test => %w(test:functional test:units test:exe spec) From 70ea6b742137f97efd1ce02f0e16599cd1258f58 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:37:31 +0100 Subject: [PATCH 078/103] actually, we only need to disable SimpleCov --- rake_tasks/test.rake | 6 ++---- spec/spec_helper.rb | 6 ++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake index 51239fbb..277bd33b 100644 --- a/rake_tasks/test.rake +++ b/rake_tasks/test.rake @@ -79,9 +79,7 @@ Please rename or remove it and run again to use the GitHub repository: end end -unless RUBY_VERSION[/^2.3/] - require 'rspec/core/rake_task' - RSpec::Core::RakeTask.new(:spec) -end +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new(:spec) task :test => %w(test:functional test:units test:exe spec) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 66f4127b..78a60b29 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,7 @@ -require 'simplecov' -SimpleCov.start +unless RUBY_VERSION[/^2.3/] + require 'simplecov' + SimpleCov.start +end # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. From a5fe57486659b79a006d97489dbe2b4637543658 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:39:15 +0100 Subject: [PATCH 079/103] also disable for Ruby 1.8.7 --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 78a60b29..282f576b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,4 @@ -unless RUBY_VERSION[/^2.3/] +if RUBY_VERSION >= '1.9' && !RUBY_VERSION[/^2.3/] require 'simplecov' SimpleCov.start end From a24c39336d85e3d41b709dac1ae1f0ae1cd2f658 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:41:38 +0100 Subject: [PATCH 080/103] also test with 2.7.0-preview3 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 19932b4e..cc067acb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ rvm: - 2.4 - 2.5 - 2.6 + - 2.7.0-preview3 - ruby-head - jruby matrix: From 951ea4fab6f9c8a984bd87d5abf77a84322bf011 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:43:11 +0100 Subject: [PATCH 081/103] reorder gems --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 0369afec..559648a2 100644 --- a/Gemfile +++ b/Gemfile @@ -12,8 +12,8 @@ group :development do gem 'rdoc', Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3') ? '~> 4.2.2' : Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2') ? '< 6' : '>= 6' gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3' gem 'rspec', '~> 3.9.0' - gem 'simplecov', '~> 0.17.1' gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1' + gem 'simplecov', '~> 0.17.1' gem 'term-ansicolor', RUBY_VERSION < '2.0' ? '~> 1.3.2' : '>= 1.3.2' gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0' gem 'tins', RUBY_VERSION < '2.0' ? '~> 1.6.0' : '>= 1.6.0' From e18aa32071f4ca83a622c9ed600b1cf4145edc06 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:52:50 +0100 Subject: [PATCH 082/103] maybe like this? --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cc067acb..a8f407e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ rvm: - 2.4 - 2.5 - 2.6 - - 2.7.0-preview3 + - 2.7 - ruby-head - jruby matrix: From f3b1f3dc9dbf1145e3244c1cc6d81438c180ea29 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 16:54:03 +0100 Subject: [PATCH 083/103] disable specs for Ruby 1.8.7 --- rake_tasks/test.rake | 6 ++++-- spec/spec_helper.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake index 277bd33b..e72c96b2 100644 --- a/rake_tasks/test.rake +++ b/rake_tasks/test.rake @@ -79,7 +79,9 @@ Please rename or remove it and run again to use the GitHub repository: end end -require 'rspec/core/rake_task' -RSpec::Core::RakeTask.new(:spec) +if RUBY_VERSION >= '1.9' + require 'rspec/core/rake_task' + RSpec::Core::RakeTask.new(:spec) +end task :test => %w(test:functional test:units test:exe spec) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 282f576b..78a60b29 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,4 @@ -if RUBY_VERSION >= '1.9' && !RUBY_VERSION[/^2.3/] +unless RUBY_VERSION[/^2.3/] require 'simplecov' SimpleCov.start end From e0b08d754b205f9204415c8d08b93a30cb92c04b Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 17:01:34 +0100 Subject: [PATCH 084/103] add simple spec for CodeRay.scan --- spec/coderay_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/coderay_spec.rb b/spec/coderay_spec.rb index 8a299b3c..88c9aece 100644 --- a/spec/coderay_spec.rb +++ b/spec/coderay_spec.rb @@ -13,4 +13,23 @@ expect(CodeRay.coderay_path('file')).to eq("#{base}/lib/coderay/file") end end + + describe '.scan' do + let(:code) { 'puts "Hello, World!"' } + let(:tokens) do + [ + ['puts', :ident], + [' ', :space], + [:begin_group, :string], + ['"', :delimiter], + ['Hello, World!', :content], + ['"', :delimiter], + [:end_group, :string] + ].flatten + end + + it 'returns tokens' do + expect(CodeRay.scan(code, :ruby).tokens).to eq(tokens) + end + end end From ae1c07408eb367ba4d72198e0f4c09efccf67153 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 17:18:35 +0100 Subject: [PATCH 085/103] merge coverage --- .simplecov | 4 ++++ spec/spec_helper.rb | 5 +---- test/executable/suite.rb | 1 + test/functional/for_redcloth.rb | 1 + test/functional/suite.rb | 1 + test/unit/suite.rb | 1 + 6 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .simplecov diff --git a/.simplecov b/.simplecov new file mode 100644 index 00000000..f498df81 --- /dev/null +++ b/.simplecov @@ -0,0 +1,4 @@ +unless RUBY_VERSION[/^2.3/] + SimpleCov.command_name $0 + SimpleCov.start +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 78a60b29..4e2dac6e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,4 @@ -unless RUBY_VERSION[/^2.3/] - require 'simplecov' - SimpleCov.start -end +require 'simplecov' # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. diff --git a/test/executable/suite.rb b/test/executable/suite.rb index 997405ca..4eb86c1c 100644 --- a/test/executable/suite.rb +++ b/test/executable/suite.rb @@ -1,3 +1,4 @@ +require 'simplecov' require 'test/unit' require 'rubygems' unless defined? Gem require 'shoulda-context' diff --git a/test/functional/for_redcloth.rb b/test/functional/for_redcloth.rb index d2b53f80..05c6e2d6 100644 --- a/test/functional/for_redcloth.rb +++ b/test/functional/for_redcloth.rb @@ -1,3 +1,4 @@ +require 'simplecov' require 'test/unit' $:.unshift File.expand_path('../../../lib', __FILE__) diff --git a/test/functional/suite.rb b/test/functional/suite.rb index ec23eec0..f87ca0fe 100644 --- a/test/functional/suite.rb +++ b/test/functional/suite.rb @@ -1,3 +1,4 @@ +require 'simplecov' require 'test/unit' $VERBOSE = $CODERAY_DEBUG = true diff --git a/test/unit/suite.rb b/test/unit/suite.rb index 417dfed8..26ebe1b5 100755 --- a/test/unit/suite.rb +++ b/test/unit/suite.rb @@ -1,3 +1,4 @@ +require 'simplecov' require 'test/unit' require 'rubygems' From ac45fe740c0ad9f89f7cd0c3620815e9033cb1e9 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 24 Nov 2019 17:28:51 +0100 Subject: [PATCH 086/103] don't load simplecov on Ruby 1.8.7 --- test/executable/suite.rb | 2 +- test/functional/for_redcloth.rb | 2 +- test/functional/suite.rb | 2 +- test/unit/suite.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/executable/suite.rb b/test/executable/suite.rb index 4eb86c1c..a6f40972 100644 --- a/test/executable/suite.rb +++ b/test/executable/suite.rb @@ -1,4 +1,4 @@ -require 'simplecov' +require 'simplecov' if RUBY_VERSION >= '1.9' require 'test/unit' require 'rubygems' unless defined? Gem require 'shoulda-context' diff --git a/test/functional/for_redcloth.rb b/test/functional/for_redcloth.rb index 05c6e2d6..32a1a1b3 100644 --- a/test/functional/for_redcloth.rb +++ b/test/functional/for_redcloth.rb @@ -1,4 +1,4 @@ -require 'simplecov' +require 'simplecov' if RUBY_VERSION >= '1.9' require 'test/unit' $:.unshift File.expand_path('../../../lib', __FILE__) diff --git a/test/functional/suite.rb b/test/functional/suite.rb index f87ca0fe..2bbc29c5 100644 --- a/test/functional/suite.rb +++ b/test/functional/suite.rb @@ -1,4 +1,4 @@ -require 'simplecov' +require 'simplecov' if RUBY_VERSION >= '1.9' require 'test/unit' $VERBOSE = $CODERAY_DEBUG = true diff --git a/test/unit/suite.rb b/test/unit/suite.rb index 26ebe1b5..7d20dc0c 100755 --- a/test/unit/suite.rb +++ b/test/unit/suite.rb @@ -1,4 +1,4 @@ -require 'simplecov' +require 'simplecov' if RUBY_VERSION >= '1.9' require 'test/unit' require 'rubygems' From 21b7ae87d67226a137cfa524ae623144c2296293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Sat, 18 Jan 2020 16:34:13 +0100 Subject: [PATCH 087/103] Fix rubygems deprecation ``` NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01. Gem::Specification#rubyforge_project= called from /home/deivid/.rbenv/versions/2.4.9/lib/ruby/gems/2.4.0/specifications/coderay-1.1.2.gemspec:21. ``` --- coderay.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/coderay.gemspec b/coderay.gemspec index 50c195b5..14500ad9 100644 --- a/coderay.gemspec +++ b/coderay.gemspec @@ -28,7 +28,6 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } s.require_paths = ['lib'] - s.rubyforge_project = s.name s.rdoc_options = '-SNw2', "-m#{readme_file}", '-t CodeRay Documentation' s.extra_rdoc_files = readme_file end From bef6209fba095c707c0592f4439e5af219d8f710 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 30 May 2020 07:58:35 +0200 Subject: [PATCH 088/103] add changelog --- Changes.textile | 1 + 1 file changed, 1 insertion(+) diff --git a/Changes.textile b/Changes.textile index 99b79c8d..8c4f3e95 100644 --- a/Changes.textile +++ b/Changes.textile @@ -7,6 +7,7 @@ h2. Changes in 1.1.3 * Tokens: Ensure Ruby 2.6 compatibility. [#233, thanks to Jun Aruga] * SQL scanner: Add @numeric@ data type. [#223, thanks to m16a1] * Java scanner: Add @var@ as type. [#229, thanks to Davide Angelocola] +* Gem: Fix deprecation warning. [#246, thanks to David Rodríguez] h2. Changes in 1.1.2 From cf4025bf3d1a151e56626bea50e1ef7573f4e939 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 30 May 2020 07:58:43 +0200 Subject: [PATCH 089/103] trying to fix tests for 1.9.3 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 559648a2..96f0d649 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gemspec # Include everything needed to run rake, tests, features, etc. group :development do gem 'bundler' - gem 'json', '>= 1.8' if RUBY_VERSION < '1.9' + gem 'json', '>= 1.8' if RUBY_VERSION < '2.0' gem 'rake', RUBY_VERSION < '1.9' ? '~> 10.5' : '>= 10.5' gem 'rdoc', Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3') ? '~> 4.2.2' : Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2') ? '< 6' : '>= 6' gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3' From 846c2f7d8a2ea99f45a3a0dedaf838d17a966ed2 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 30 May 2020 09:07:47 +0200 Subject: [PATCH 090/103] like this? --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 96f0d649..1851939d 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gemspec # Include everything needed to run rake, tests, features, etc. group :development do gem 'bundler' - gem 'json', '>= 1.8' if RUBY_VERSION < '2.0' + gem 'json', '~> 1.8' if RUBY_VERSION < '2.0' gem 'rake', RUBY_VERSION < '1.9' ? '~> 10.5' : '>= 10.5' gem 'rdoc', Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3') ? '~> 4.2.2' : Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2') ? '< 6' : '>= 6' gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3' From d30855fe96e33fed39bd5aa7ba6879ba62306860 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 30 May 2020 09:20:17 +0200 Subject: [PATCH 091/103] bump version --- lib/coderay/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coderay/version.rb b/lib/coderay/version.rb index f5e7a39d..3c68bd83 100644 --- a/lib/coderay/version.rb +++ b/lib/coderay/version.rb @@ -1,3 +1,3 @@ module CodeRay - VERSION = '1.1.2' + VERSION = '1.1.3' end From a135917a983b99b3f0c07e9decf74e7a83bcc51c Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 30 May 2020 09:39:12 +0200 Subject: [PATCH 092/103] fix simplecov for Ruby 2.7 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 1851939d..49ac338d 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ group :development do gem 'RedCloth', RUBY_PLATFORM == 'java' ? '= 4.2.9' : '>= 4.0.3' gem 'rspec', '~> 3.9.0' gem 'shoulda-context', RUBY_VERSION < '1.9' ? '= 1.2.1' : '>= 1.2.1' - gem 'simplecov', '~> 0.17.1' + gem 'simplecov', RUBY_VERSION < '2.7' ? '~> 0.17.1' : '>= 0.18.5' gem 'term-ansicolor', RUBY_VERSION < '2.0' ? '~> 1.3.2' : '>= 1.3.2' gem 'test-unit', RUBY_VERSION < '1.9' ? '~> 2.0' : '>= 3.0' gem 'tins', RUBY_VERSION < '2.0' ? '~> 1.6.0' : '>= 1.6.0' From a283730a26c33431df11e5dcfa48124a74dcd732 Mon Sep 17 00:00:00 2001 From: Daniel Berger Date: Thu, 18 Jun 2020 09:18:52 -0400 Subject: [PATCH 093/103] Remove invalid -S option from rdoc_options. --- coderay.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coderay.gemspec b/coderay.gemspec index 14500ad9..9aba34eb 100644 --- a/coderay.gemspec +++ b/coderay.gemspec @@ -28,6 +28,6 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } s.require_paths = ['lib'] - s.rdoc_options = '-SNw2', "-m#{readme_file}", '-t CodeRay Documentation' + s.rdoc_options = '-Nw2', "-m#{readme_file}", '-t CodeRay Documentation' s.extra_rdoc_files = readme_file end From 228e87307c2faab06f854a79ab592a2737c20f65 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Wed, 24 Jun 2020 10:44:07 +0200 Subject: [PATCH 094/103] Update MIT-LICENSE --- MIT-LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MIT-LICENSE b/MIT-LICENSE index d8d009d1..9431e246 100644 --- a/MIT-LICENSE +++ b/MIT-LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2005-2012 Kornelius Kalnbach (@murphy_karasu) +Copyright (C) 2005 Kornelius Kalnbach (@murphy_karasu) http://coderay.rubychan.de/ @@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From c1c15034749684fcad91ad2bcb2fcd2056faf18d Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Sun, 21 Feb 2021 23:04:03 +0900 Subject: [PATCH 095/103] Fix test suite for ruby 3.0 change for methods on subclass of Array With ruby 3.0, especially with https://github.com/ruby/ruby/pull/3690 , for subclass of Array, `flatten` method now returns the instance of Array, not of the subclass. To keep the object instance of the subclass, use `flatten!` instead. --- test/unit/debug.rb | 3 ++- test/unit/statistic.rb | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/unit/debug.rb b/test/unit/debug.rb index 88baf563..b694f21e 100644 --- a/test/unit/debug.rb +++ b/test/unit/debug.rb @@ -24,7 +24,8 @@ def test_creation [" \n", :space], ["[]", :method], [:end_line, :head], - ].flatten + ] + TEST_INPUT.flatten! TEST_OUTPUT = <<-'DEBUG'.chomp integer(10)operator((\\\))stringhead[ diff --git a/test/unit/statistic.rb b/test/unit/statistic.rb index 1326dca6..776774d4 100644 --- a/test/unit/statistic.rb +++ b/test/unit/statistic.rb @@ -24,7 +24,8 @@ def test_creation [" \n", :space], ["[]", :method], [:end_line, :test], - ].flatten + ] + TEST_INPUT.flatten! TEST_OUTPUT = <<-'DEBUG' Code Statistics @@ -56,4 +57,4 @@ def test_filtering_text_tokens assert_equal TEST_OUTPUT, TEST_INPUT.statistic end -end \ No newline at end of file +end From 050259de50e5dd744b193fac7823ce1b1c2be7ef Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 1 Mar 2021 16:07:34 +0100 Subject: [PATCH 096/103] test for ruby 3, too --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index a8f407e5..8eaee3ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,11 +15,13 @@ rvm: - 2.5 - 2.6 - 2.7 + - 3.0 - ruby-head - jruby matrix: allow_failures: - rvm: 1.8.7 + - rvm: ree - rvm: ruby-head - rvm: jruby branches: From c25e8ef53cef6e72b98547139a6a27bdd4f1aaf3 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Mon, 1 Mar 2021 16:12:22 +0100 Subject: [PATCH 097/103] fix Travis warnings --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8eaee3ff..45fb2441 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ env: - "JRUBY_OPTS=-Xcext.enabled=true" - "CC_TEST_REPORTER_ID=faa393209ff0a104cf37511a9a03510bcee37951971b1ca4ffc2af217851d47e" language: ruby +os: linux rvm: - 1.8.7 - ree @@ -18,7 +19,7 @@ rvm: - 3.0 - ruby-head - jruby -matrix: +jobs: allow_failures: - rvm: 1.8.7 - rvm: ree @@ -35,4 +36,3 @@ before_script: script: "rake test" # test:scanners" after_script: - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT -sudo: false From bd3a1676792aa2e370a308eca5753e6c52192d1a Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 13 Nov 2022 20:30:17 +0100 Subject: [PATCH 098/103] add latest Rubies to test matrix --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 45fb2441..6c607d27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,8 @@ rvm: - 2.6 - 2.7 - 3.0 + - 3.1 + - 3.2 - ruby-head - jruby jobs: From 286211777036fb67f82b3a24475a8fc61301bf53 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 13 Nov 2022 20:51:56 +0100 Subject: [PATCH 099/103] add CircleCI config --- .circleci/config.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..9dd6de46 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,12 @@ +jobs: + build: + docker: + - image: cimg/ruby:3.1.2 + environment: + RAILS_ENV: test + steps: + - checkout + - run: | + bundle install + - run: | + bundle exec rake test From 3e35c86617335f2e9edba018f51c0889f2362ebf Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 13 Nov 2022 20:55:40 +0100 Subject: [PATCH 100/103] replace Travis badge with CircleCI --- README.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 410d1bff..da594599 100644 --- a/README.markdown +++ b/README.markdown @@ -1,7 +1,6 @@ # CodeRay -[![Build Status](https://travis-ci.org/rubychan/coderay.svg?branch=master)](https://travis-ci.org/rubychan/coderay) -[![Gem Version](https://badge.fury.io/rb/coderay.svg)](https://badge.fury.io/rb/coderay) [![Maintainability](https://api.codeclimate.com/v1/badges/e015bbd5eab45d948b6b/maintainability)](https://codeclimate.com/github/rubychan/coderay/maintainability) +[![CircleCI](https://dl.circleci.com/status-badge/img/gh/rubychan/coderay/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/rubychan/coderay/tree/master) [![Gem Version](https://badge.fury.io/rb/coderay.svg)](https://badge.fury.io/rb/coderay) [![Maintainability](https://api.codeclimate.com/v1/badges/e015bbd5eab45d948b6b/maintainability)](https://codeclimate.com/github/rubychan/coderay/maintainability) ## About From f71b25d3112ac7fcc43ca48055030319ecc7a840 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sun, 13 Nov 2022 20:59:43 +0100 Subject: [PATCH 101/103] add missing badge token --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index da594599..e9263837 100644 --- a/README.markdown +++ b/README.markdown @@ -1,6 +1,6 @@ # CodeRay -[![CircleCI](https://dl.circleci.com/status-badge/img/gh/rubychan/coderay/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/rubychan/coderay/tree/master) [![Gem Version](https://badge.fury.io/rb/coderay.svg)](https://badge.fury.io/rb/coderay) [![Maintainability](https://api.codeclimate.com/v1/badges/e015bbd5eab45d948b6b/maintainability)](https://codeclimate.com/github/rubychan/coderay/maintainability) +[![CircleCI](https://dl.circleci.com/status-badge/img/gh/rubychan/coderay/tree/master.svg?style=svg&circle-token=cdc86dfde1b86067977f0fc1d3cbdd7e3171c873)](https://dl.circleci.com/status-badge/redirect/gh/rubychan/coderay/tree/master) [![Gem Version](https://badge.fury.io/rb/coderay.svg)](https://badge.fury.io/rb/coderay) [![Maintainability](https://api.codeclimate.com/v1/badges/e015bbd5eab45d948b6b/maintainability)](https://codeclimate.com/github/rubychan/coderay/maintainability) ## About From 01144a3f9d311a3f7f8ee52ccded7b31d1d69b5f Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 2 Nov 2024 02:18:11 +0100 Subject: [PATCH 102/103] fix CircleCI status badge --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index e9263837..a768ef10 100644 --- a/README.markdown +++ b/README.markdown @@ -1,6 +1,6 @@ # CodeRay -[![CircleCI](https://dl.circleci.com/status-badge/img/gh/rubychan/coderay/tree/master.svg?style=svg&circle-token=cdc86dfde1b86067977f0fc1d3cbdd7e3171c873)](https://dl.circleci.com/status-badge/redirect/gh/rubychan/coderay/tree/master) [![Gem Version](https://badge.fury.io/rb/coderay.svg)](https://badge.fury.io/rb/coderay) [![Maintainability](https://api.codeclimate.com/v1/badges/e015bbd5eab45d948b6b/maintainability)](https://codeclimate.com/github/rubychan/coderay/maintainability) +[![CircleCI](https://dl.circleci.com/status-badge/img/gh/rubychan/coderay/tree/master.svg?style=svg&circle-token=CCIPRJ_BbFff6nMhNtPdrCBNMDxNq_be00bbb00849a29d8d8d2e28e7b84cbf76a9ee5c)](https://dl.circleci.com/status-badge/redirect/gh/rubychan/coderay/tree/master) [![Gem Version](https://badge.fury.io/rb/coderay.svg)](https://badge.fury.io/rb/coderay) [![Maintainability](https://api.codeclimate.com/v1/badges/e015bbd5eab45d948b6b/maintainability)](https://codeclimate.com/github/rubychan/coderay/maintainability) ## About From eabc13c2a17895dec54cfde2a2d1288e17b6722a Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Sat, 2 Nov 2024 02:22:07 +0100 Subject: [PATCH 103/103] update Ruby version in CircleCI config to 3.3.5 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9dd6de46..c76072a8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ jobs: build: docker: - - image: cimg/ruby:3.1.2 + - image: cimg/ruby:3.3.5 environment: RAILS_ENV: test steps: