Skip to content

Commit a0ed71f

Browse files
authored
Enable all cops, but opt all files out of rubocop (#2708)
* Enable all cops, but opt all files out of rubocop * only install rubocop on ruby >= 2.6 * ignore rubocop for jrubies as well * solargraph 0.49 depends on rbs, which won't build for jruby for some reason * restrict solargraph to mri * fix typo
1 parent 30bcf22 commit a0ed71f

File tree

929 files changed

+989
-925
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

929 files changed

+989
-925
lines changed

.rubocop.yml

+29-9
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,49 @@
1+
require:
2+
- rubocop-performance
3+
- rubocop-rake
4+
- rubocop-rspec
5+
16
AllCops:
27
TargetRubyVersion: 2.5
3-
NewCops: disable
4-
Include:
5-
- 'lib/**/*'
8+
NewCops: enable
9+
Exclude:
10+
- 'spec/shared/**/*'
11+
- 'vendor/**/*'
612

713
Bundler:
8-
Enabled: false
14+
Enabled: true
915

1016
Gemspec:
11-
Enabled: false
17+
Enabled: true
1218

1319
Layout:
14-
Enabled: false
20+
Enabled: true
1521

1622
Lint:
17-
Enabled: false
23+
Enabled: true
1824

1925
Metrics:
20-
Enabled: false
26+
Enabled: true
2127

2228
Naming:
23-
Enabled: false
29+
Enabled: true
2430

2531
Security:
2632
Enabled: true
2733

2834
Style:
35+
Enabled: true
36+
37+
# --------------------------------------
38+
# Cops below this line set intentionally
39+
# --------------------------------------
40+
41+
Bundler/OrderedGems:
42+
Enabled: false
43+
44+
Gemspec/OrderedDependencies:
2945
Enabled: false
46+
47+
Style/Documentation:
48+
Exclude:
49+
- 'spec/**/*'

Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# frozen_string_literal: true
2+
# rubocop:todo all
3+
14
source 'https://rubygems.org'
25

36
gemspec

Rakefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# -*- mode: ruby -*-
1+
# frozen_string_literal: true
2+
# rubocop:todo all
23

34
require 'bundler'
45
require 'bundler/gem_tasks'

bin/mongo_console

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
# rubocop:todo all
24

35
$LOAD_PATH[0, 0] = File.join(File.dirname(__FILE__), '..', 'lib')
46

examples/aggregate.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Group documents by field and calculate count.
55

examples/create.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Insert a document
55

examples/delete.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Delete all documents matching a condition
55

examples/index.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Create a single field index
55

examples/query.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Query for all documents in a collection
55

examples/update.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Update top-level fields in a single document
55

gemfiles/bson_4-stable.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# rubocop:todo all
12
source "https://rubygems.org"
23
gemspec path: '..'
34

gemfiles/bson_master.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# rubocop:todo all
12
source "https://rubygems.org"
23
gemspec path: '..'
34

gemfiles/bson_min.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# rubocop:todo all
12
source "https://rubygems.org"
23
gemspec path: '..'
34

gemfiles/mongo_kerberos.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# rubocop:todo all
12
source "https://rubygems.org"
23
gemspec path: '..'
34

gemfiles/snappy_compression.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# rubocop:todo all
12
source "https://rubygems.org"
23
gemspec path: '..'
34

gemfiles/standard.rb

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
def standard_dependencies
55
gem 'yard'
@@ -29,8 +29,14 @@ def standard_dependencies
2929
gem 'yajl-ruby', platforms: :mri, require: false
3030
gem 'celluloid', platforms: :mri, require: false
3131

32-
# for static analysis
33-
gem 'rubocop', '~> 1.27.0'
32+
# for static analysis -- ignore ruby < 2.6 because of rubocop
33+
# version incompatibilities
34+
if RUBY_VERSION > "2.5.99"
35+
gem 'rubocop', '~> 1.45.1'
36+
gem 'rubocop-performance', '~> 1.16.0'
37+
gem 'rubocop-rake', '~> 0.6.0'
38+
gem 'rubocop-rspec', '~> 2.18.1'
39+
end
3440

3541
platform :mri do
3642
# Debugger for VSCode.
@@ -60,7 +66,8 @@ def standard_dependencies
6066
gem 'ruby-prof', platforms: :mri
6167
gem 'erubi'
6268
gem 'tilt'
63-
gem 'solargraph'
69+
# solargraph depends on rbs, which won't build on jruby for some reason
70+
gem 'solargraph', platforms: :mri
6471
end
6572

6673
if ENV['FLE'] == 'helper'

gemfiles/zstd_compression.gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# rubocop:todo all
12
source "https://rubygems.org"
23
gemspec path: '..'
34

lib/mongo.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/active_support.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2019-2020 MongoDB Inc.
55
#

lib/mongo/address.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/address/ipv4.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/address/ipv6.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/address/unix.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/address/validator.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2017-2020 MongoDB Inc.
55
#

lib/mongo/auth.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/auth/aws.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2020 MongoDB Inc.
55
#

lib/mongo/auth/aws/conversation.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2020 MongoDB Inc.
55
#

lib/mongo/auth/aws/credentials.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
2+
# rubocop:todo all
23

34
# Copyright (C) 2023-present MongoDB Inc.
45
#

lib/mongo/auth/aws/credentials_cache.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
2+
# rubocop:todo all
23

34
# Copyright (C) 2023-present MongoDB Inc.
45
#

lib/mongo/auth/aws/credentials_retriever.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2020 MongoDB Inc.
55
#

lib/mongo/auth/aws/request.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2020 MongoDB Inc.
55
#

lib/mongo/auth/base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/auth/conversation_base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2020 MongoDB Inc.
55
#

lib/mongo/auth/cr.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/auth/cr/conversation.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/auth/credential_cache.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2019-2020 MongoDB Inc.
55
#

lib/mongo/auth/gssapi.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB, Inc.
55
#

lib/mongo/auth/gssapi/conversation.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2015-2020 MongoDB Inc.
55
#

lib/mongo/auth/ldap.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/auth/ldap/conversation.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/auth/roles.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/auth/sasl_conversation_base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2020 MongoDB Inc.
55
#

lib/mongo/auth/scram.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/auth/scram/conversation.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2014-2020 MongoDB Inc.
55
#

lib/mongo/auth/scram256.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2020 MongoDB Inc.
55
#

lib/mongo/auth/scram256/conversation.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2020 MongoDB Inc.
55
#

lib/mongo/auth/scram_conversation_base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
2-
# encoding: utf-8
2+
# rubocop:todo all
33

44
# Copyright (C) 2020 MongoDB Inc.
55
#

0 commit comments

Comments
 (0)