Skip to content

Commit bfbbc6d

Browse files
committed
Update rubocop config and fix rubocop issues
1 parent b157002 commit bfbbc6d

64 files changed

Lines changed: 1513 additions & 1478 deletions

Some content is hidden

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

.rubocop.yml

Lines changed: 13 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,24 @@
1-
require: rubocop-rspec
1+
require:
2+
- standard/cop/block_single_line_braces
3+
- rubocop-rspec
4+
5+
inherit_gem:
6+
standard: config/base.yml
27

38
AllCops:
4-
TargetRubyVersion: 2.5
59
Exclude:
6-
- 'spec/dummy/**/*'
7-
- 'vendor/**/*'
810
- 'tmp/**/*'
11+
- '.github/**/*'
12+
DisplayCopNames: true
13+
SuggestExtensions: false
914
NewCops: enable
15+
TargetRubyVersion: 2.7
1016

11-
Gemspec/RequiredRubyVersion:
17+
Standard/BlockSingleLineBraces:
1218
Enabled: false
1319

14-
Style/StringLiterals:
15-
EnforcedStyle: double_quotes
16-
17-
Style/NumericLiterals:
18-
Enabled: false
19-
20-
Style/Alias:
21-
Enabled: false # `alias_method` and `alias` have diferent behaviour
22-
2320
Style/FrozenStringLiteralComment:
24-
Enabled: false # not to be used before migration to Ruby 3+
25-
26-
Style/DoubleNegation:
27-
Enabled: false
28-
29-
Layout/LineLength:
30-
Max: 100
31-
32-
Metrics/ClassLength:
33-
Max: 120
34-
35-
Metrics/BlockLength:
36-
Exclude:
37-
- spec/**/*
21+
Enabled: true
3822

3923
Style/TrailingCommaInArguments:
4024
Enabled: true
@@ -48,58 +32,7 @@ Style/TrailingCommaInArrayLiteral:
4832
Enabled: true
4933
EnforcedStyleForMultiline: comma
5034

51-
Layout/EmptyLineAfterGuardClause:
52-
Enabled: false
53-
54-
Naming/FileName:
55-
Exclude:
56-
- "*file" # Rakefile, etc
57-
58-
Layout/HashAlignment:
59-
Enabled: false
60-
61-
Layout/EmptyLinesAroundAttributeAccessor:
62-
Enabled: true
63-
64-
Layout/SpaceAroundMethodCallOperator:
65-
Enabled: true
66-
67-
Lint/RaiseException:
68-
Enabled: true
69-
70-
Lint/StructNewOverride:
71-
Enabled: true
72-
73-
Style/ExponentialNotation:
74-
Enabled: true
75-
76-
Style/HashEachMethods:
77-
Enabled: true
78-
79-
Style/HashTransformKeys:
80-
Enabled: true
81-
82-
Style/HashTransformValues:
83-
Enabled: true
84-
85-
Style/SlicingWithRange:
86-
Enabled: true
87-
8835
RSpec/FilePath:
8936
Enabled: false
90-
RSpec/LeadingSubject:
91-
Enabled: false
92-
RSpec/NamedSubject:
37+
RSpec/SpecFilePathFormat:
9338
Enabled: false
94-
RSpec/NestedGroups:
95-
Max: 4
96-
RSpec/SubjectStub:
97-
Enabled: false # Need this ime by time
98-
RSpec/MultipleExpectations:
99-
Max: 5
100-
RSpec/ExampleLength:
101-
Max: 10
102-
RSpec/EmptyLineAfterFinalLet:
103-
Enabled: false # This works wrong somatimes
104-
RSpec/BeforeAfterAll:
105-
Enabled: false # Not suitable here

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
source "https://rubygems.org"
24
gemspec

docs/yard/fix_pictures.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require "uri"
44
require "yard"
55

6-
# rubocop:disable Style/Documentation
76
module YARD
87
# Replaces <picture> tags with <img> and relative src with absolute ones
98
module ReplacePicture
@@ -24,4 +23,3 @@ def html_markup_markdown(text)
2423

2524
Templates::Template.extra_includes << ReplacePicture
2625
end
27-
# rubocop:enable Style/Documentation

docs/yard/github_alerts.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require "uri"
44
require "yard"
55

6-
# rubocop:disable Style/Documentation
76
module YARD
87
# Add some formatting to the GitHub alert tags since they are not supported
98
# by YARD
@@ -15,4 +14,3 @@ def html_markup_markdown(text)
1514

1615
Templates::Template.extra_includes << GithubAlerts
1716
end
18-
# rubocop:enable Style/Documentation

docs/yard/relative_markdown_links.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
require "yard"
44

5-
# rubocop:disable Style/Documentation, Metrics/MethodLength, Metrics/AbcSize
65
module YARD
76
# Fixes relative links in markdown files.
87
module RelativeMarkdownLinks
@@ -12,7 +11,7 @@ def resolve_links(text)
1211
filenames = options.files.each_with_object({}) do |file, fns|
1312
fn = file.filename
1413
fns[fn] = fn
15-
fns["#{fn.tr('.', '_')}.html"] = fn
14+
fns["#{fn.tr(".", "_")}.html"] = fn
1615
end
1716

1817
# puts text
@@ -30,4 +29,3 @@ def resolve_links(text)
3029

3130
Templates::Template.extra_includes << RelativeMarkdownLinks
3231
end
33-
# rubocop:enable Style/Documentation, Metrics/MethodLength, Metrics/AbcSize

lib/imgproxy.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "imgproxy/version"
24
require "imgproxy/config"
35
require "imgproxy/url_builders/processing"

lib/imgproxy/config.rb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "anyway_config"
24

35
require "imgproxy/service_config"
@@ -43,13 +45,15 @@ class Config < Anyway::Config
4345
services: {},
4446
)
4547

46-
coerce_types use_short_options: :boolean,
47-
base64_encode_urls: :boolean,
48-
always_escape_plain_urls: :boolean,
49-
use_s3_urls: :boolean,
50-
use_gcs_urls: :boolean,
51-
gcs_bucket: :string,
52-
shrine_host: :string
48+
coerce_types(
49+
use_short_options: :boolean,
50+
base64_encode_urls: :boolean,
51+
always_escape_plain_urls: :boolean,
52+
use_s3_urls: :boolean,
53+
use_gcs_urls: :boolean,
54+
gcs_bucket: :string,
55+
shrine_host: :string,
56+
)
5357

5458
def endpoint
5559
service(:default).endpoint
@@ -131,7 +135,6 @@ def service(name)
131135
services[name.to_sym]
132136
end
133137

134-
# rubocop: disable Metrics/AbcSize
135138
def services
136139
@services ||= {}.tap do |s|
137140
s[:default] = ServiceConfig.new
@@ -146,7 +149,6 @@ def services
146149
end
147150
end
148151
end
149-
# rubocop: enable Metrics/AbcSize
150152

151153
# @deprecated Please use {#key} instead
152154
def hex_key=(value)

lib/imgproxy/extensions/active_storage.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Imgproxy
24
module Extensions
35
# Extension for ActiveStorage

lib/imgproxy/extensions/shrine.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Imgproxy
24
module Extensions
35
# Extension for Shrine::UploadedFile

lib/imgproxy/option_aliases/info.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Imgproxy
24
module OptionAliases
35
INFO = {

0 commit comments

Comments
 (0)