Skip to content

Commit 9d7e280

Browse files
authored
Merge pull request #58 from mtsmfm/use-released-rubocop
Use released rubocop
2 parents 57df5b9 + 10bbc84 commit 9d7e280

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

.rubocop.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
inherit_from:
2-
- https://github.com/onk/onkcop/raw/v0.51.0.0/config/rubocop.yml
2+
- https://github.com/onk/onkcop/raw/v0.52.0.0/config/rubocop.yml
33

44
AllCops:
55
TargetRubyVersion: 2.2
@@ -43,3 +43,6 @@ Metrics/ModuleLength:
4343

4444
Metrics/LineLength:
4545
Max: 200
46+
Exclude:
47+
# To use power_assert, we must pub assertion in one line
48+
- 'test/**/*'

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ source "https://rubygems.org"
33
# Specify your gem's dependencies in language_server.gemspec
44
gemspec
55

6-
# TODO: Use released gem after new release includes https://github.com/bbatsov/rubocop/pull/4987
7-
gem "rubocop", git: "https://github.com/bbatsov/rubocop", ref: "88d9e3b"
6+
gem "rubocop", "0.52"

lib/language_server/project/node.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class << self
55
def attributes(*attrs)
66
attr_accessor(*attrs)
77
attribute_names.concat(attrs)
8-
class_eval <<-RUBY, __FILE__, __LINE__
8+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
99
def initialize(#{attribute_names.map { |n| "#{n}:" }.join(",")})
1010
#{attribute_names.map { |n|
1111
"@#{n} = #{n}"

test/language_server/linter/rubocop_test.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,23 @@ def test_fatal_error
1010
source = 'require "foo'
1111
actual = Rubocop.new(source, @config_path).call
1212
assert do
13-
actual == [
14-
Error.new(
15-
line_num: 0,
16-
message: "unterminated string meets end of file\n(Using Ruby 2.1 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)",
17-
type: "error",
18-
),
19-
]
13+
actual.first == Error.new(line_num: 0, message: "Lint/Syntax: unterminated string meets end of file\n(Using Ruby 2.1 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)", type: "error")
2014
end
2115
end
2216

2317
def test_warning_error
2418
source = "a = 'a'"
2519
actual = Rubocop.new(source, @config_path).call
2620
assert do
27-
actual.first == Error.new(line_num: 0, message: "Useless assignment to variable - `a`.", type: "warning")
21+
actual.first == Error.new(line_num: 0, message: "Lint/UselessAssignment: Useless assignment to variable - `a`.", type: "warning")
2822
end
2923
end
3024

3125
def test_convention_error
3226
source = 'require "foo"'
3327
actual = Rubocop.new(source, @config_path).call
3428
assert do
35-
actual.first == Error.new(line_num: 0, message: "Prefer single-quoted strings when you don't need string interpolation or special symbols.", type: "warning")
29+
actual.first == Error.new(line_num: 0, message: "Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.", type: "warning")
3630
end
3731
end
3832
end

0 commit comments

Comments
 (0)