Skip to content

Commit be330d5

Browse files
authored
Merge pull request #205 from launchdarkly/eb/sc-159609/no-rubocop-rails
disable rubocop Rails rules and fix some remaining syntax offenses
2 parents bf82e5f + 00e8a25 commit be330d5

File tree

7 files changed

+6
-63
lines changed

7 files changed

+6
-63
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ workflows:
1111
- rubocop/rubocop:
1212
after-install-rubocop:
1313
- run: gem install rubocop-performance
14-
- run: gem install rubocop-rails
1514
- build-test-windows
1615
- build-test-linux:
1716
name: Ruby 2.6

.rubocop.yml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require:
2-
- rubocop-rails
32
- rubocop-performance
43

54
AllCops:
@@ -113,10 +112,6 @@ Metrics/CyclomaticComplexity:
113112
of test cases needed to validate a method.
114113
Enabled: false
115114

116-
Rails/Delegate:
117-
Description: 'Prefer delegate method for delegations.'
118-
Enabled: false
119-
120115
Style/PreferredHashMethods:
121116
Description: 'Checks for use of deprecated Hash methods.'
122117
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
@@ -586,54 +581,6 @@ Performance/StringReplacement:
586581
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
587582
Enabled: false
588583

589-
# Rails
590-
591-
Rails/ActionFilter:
592-
Description: 'Enforces consistent use of action filter methods.'
593-
Enabled: false
594-
595-
Rails/Date:
596-
Description: >-
597-
Checks the correct usage of date aware methods,
598-
such as Date.today, Date.current etc.
599-
Enabled: false
600-
601-
Rails/FindBy:
602-
Description: 'Prefer find_by over where.first.'
603-
Enabled: false
604-
605-
Rails/FindEach:
606-
Description: 'Prefer all.find_each over all.find.'
607-
Enabled: false
608-
609-
Rails/HasAndBelongsToMany:
610-
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
611-
Enabled: false
612-
613-
Rails/Output:
614-
Description: 'Checks for calls to puts, print, etc.'
615-
Enabled: false
616-
617-
Rails/ReadWriteAttribute:
618-
Description: >-
619-
Checks for read_attribute(:attr) and
620-
write_attribute(:attr, val).
621-
Enabled: false
622-
623-
Rails/ScopeArgs:
624-
Description: 'Checks the arguments of ActiveRecord scopes.'
625-
Enabled: false
626-
627-
Rails/TimeZone:
628-
Description: 'Checks the correct usage of time zone aware methods.'
629-
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
630-
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
631-
Enabled: false
632-
633-
Rails/Validation:
634-
Description: 'Use validates :attribute, hash of validations.'
635-
Enabled: false
636-
637584
# Disabled temporarily while we bring code base inline
638585
Layout/ArgumentAlignment:
639586
Enabled: false
@@ -794,9 +741,6 @@ Naming/RescuedExceptionsVariableName:
794741
Naming/VariableNumber:
795742
Enabled: false
796743

797-
Rails/SkipsModelValidations:
798-
Enabled: false
799-
800744
Style/AccessorGrouping:
801745
Enabled: false
802746

contract-tests/service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
'all-flags-client-side-only',
3131
'all-flags-details-only-for-tracked-flags',
3232
'tags',
33-
]
33+
],
3434
}.to_json
3535
end
3636

lib/ldclient-rb/impl/event_sender.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def send_event_data(event_data, description, is_diagnostic)
3333
begin
3434
http_client = @http_client_pool.acquire()
3535
response = nil
36-
(0..1).each do |attempt|
36+
2.times do |attempt|
3737
if attempt > 0
3838
@logger.warn { "[LDClient] Will retry posting events after #{@retry_interval} second" }
3939
sleep(@retry_interval)

lib/ldclient-rb/impl/util.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def self.validate_application_value(value, name, logger)
5656
return ""
5757
end
5858

59-
if value.match(/[^a-zA-Z0-9._-]/)
59+
if /[^a-zA-Z0-9._-]/.match?(value)
6060
logger.warn { "Value of application[#{name}] contained invalid characters and was discarded" }
6161
return ""
6262
end

spec/config_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
end
7777

7878
it "will drop invalid values" do
79-
[" ", "@", ":", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-a"]. each do |value|
79+
[" ", "@", ":", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-a"].each do |value|
8080
expect(subject.new(logger: $null_log, application: { id: value, version: value }).application).to eq ({ id: "", version: "" })
8181
end
8282
end
@@ -86,7 +86,7 @@
8686
{ :id => "id", :version => "version", :expected => "application-id/id application-version/version" },
8787
{ :id => "id", :version => "", :expected => "application-id/id" },
8888
{ :id => "", :version => "version", :expected => "application-version/version" },
89-
{ :id => "", :version => "", :expected => "" }
89+
{ :id => "", :version => "", :expected => "" },
9090
].each do |test_case|
9191
config = subject.new(application: { id: test_case[:id], version: test_case[:version] })
9292
expect(LaunchDarkly::Impl::Util.application_header_value(config.application)).to eq test_case[:expected]

spec/event_sender_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def with_sender_and_server
4545
"user-agent" => [ "RubyClient/" + LaunchDarkly::VERSION ],
4646
"x-launchdarkly-event-schema" => [ "3" ],
4747
"x-launchdarkly-tags" => [ "application-id/id application-version/version" ],
48-
"connection" => [ "Keep-Alive" ]
48+
"connection" => [ "Keep-Alive" ],
4949
})
5050
expect(req.header['x-launchdarkly-payload-id']).not_to eq []
5151
end

0 commit comments

Comments
 (0)