Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
modosc committed Jun 13, 2024
1 parent 9d00c02 commit 162eab6
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 44 deletions.
63 changes: 23 additions & 40 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-12-16 21:20:23 UTC using RuboCop version 1.59.0.
# on 2024-06-13 00:13:47 UTC using RuboCop version 1.64.1.
# 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
Expand All @@ -11,21 +11,21 @@
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/cloudflare/rails_spec.rb'
- "spec/cloudflare/rails_spec.rb"

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedMethods.
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?, presence, present?
Lint/RedundantSafeNavigation:
Exclude:
- 'spec/cloudflare/rails_spec.rb'
- "spec/cloudflare/rails_spec.rb"

# Offense count: 1
# Configuration parameters: AllowComments, AllowNil.
Lint/SuppressedException:
Exclude:
- 'lib/cloudflare_rails/check_trusted_proxies.rb'
- "lib/cloudflare_rails/check_trusted_proxies.rb"

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Expand All @@ -43,46 +43,39 @@ Metrics/MethodLength:
# 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:
- 'lib/cloudflare-rails.rb'
- "lib/cloudflare-rails.rb"

# Offense count: 2
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'lib/cloudflare_rails/fallback_ips.rb'
- "lib/cloudflare_rails/fallback_ips.rb"

# Offense count: 3
RSpec/AnyInstance:
Exclude:
- 'spec/cloudflare/rails_spec.rb'
- "spec/cloudflare/rails_spec.rb"

# Offense count: 1
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/cloudflare/rails_spec.rb'
- "spec/cloudflare/rails_spec.rb"

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples.
# DisallowedExamples: works
RSpec/ExampleWording:
Exclude:
- 'spec/cloudflare/rails_spec.rb'

# Offense count: 1
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/cloudflare/rails_spec.rb'
- "spec/cloudflare/rails_spec.rb"

# Offense count: 1
RSpec/LeakyConstantDeclaration:
Exclude:
- 'spec/cloudflare/rails_spec.rb'
- "spec/cloudflare/rails_spec.rb"

# Offense count: 5
RSpec/MultipleExpectations:
Expand All @@ -98,7 +91,7 @@ RSpec/MultipleMemoizedHelpers:
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/cloudflare/rails_spec.rb'
- "spec/cloudflare/rails_spec.rb"

# Offense count: 16
# Configuration parameters: AllowedGroups.
Expand All @@ -110,34 +103,34 @@ RSpec/NestedGroups:
# Include: **/*_spec.rb
RSpec/SpecFilePathFormat:
Exclude:
- 'spec/cloudflare/rails_spec.rb'
- "spec/cloudflare/rails_spec.rb"

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Rails/ApplicationController:
Exclude:
- 'spec/cloudflare/rails_spec.rb'
- "spec/cloudflare/rails_spec.rb"

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Rails/CompactBlank:
Exclude:
- 'lib/cloudflare_rails/importer.rb'
- "lib/cloudflare_rails/importer.rb"

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Include.
# Include: **/Rakefile, **/*.rake
Rails/RakeEnvironment:
Exclude:
- 'Rakefile'
- "Rakefile"

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowOnConstant, AllowOnSelfClass.
Style/CaseEquality:
Exclude:
- 'lib/cloudflare_rails/check_trusted_proxies.rb'
- "lib/cloudflare_rails/check_trusted_proxies.rb"

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Expand All @@ -147,32 +140,22 @@ Style/CaseEquality:
Style/FormatStringToken:
EnforcedStyle: unannotated

# Offense count: 15
# Offense count: 13
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'Appraisals'
- 'Gemfile'
- 'Rakefile'
- 'cloudflare-rails.gemspec'
- 'gemfiles/rails_6.1.gemfile'
- 'gemfiles/rails_7.0.gemfile'
- 'gemfiles/rails_7.1.gemfile'
- 'lib/cloudflare_rails.rb'
- 'lib/cloudflare_rails/check_trusted_proxies.rb'
- 'lib/cloudflare_rails/importer.rb'
- 'lib/cloudflare_rails/railtie.rb'
- 'lib/cloudflare_rails/remote_ip_proxies.rb'
- 'lib/cloudflare_rails/version.rb'
- 'spec/cloudflare/rails_spec.rb'
- 'spec/spec_helper.rb'
- "Appraisals"
- "Gemfile"
- "Rakefile"
- "cloudflare-rails.gemspec"
- "gemfiles/rails_7.1.gemfile"

# Offense count: 1
Style/MultilineBlockChain:
Exclude:
- 'lib/cloudflare_rails/railtie.rb'
- "lib/cloudflare_rails/railtie.rb"

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Expand Down
2 changes: 2 additions & 0 deletions lib/cloudflare_rails.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'zeitwerk'
loader = Zeitwerk::Loader.for_gem
loader.ignore("#{__dir__}/cloudflare-rails.rb")
Expand Down
2 changes: 2 additions & 0 deletions lib/cloudflare_rails/check_trusted_proxies.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module CloudflareRails
# patch rack::request::helpers to use our cloudflare ips - this way request.ip is
# correct inside of rack and rails
Expand Down
8 changes: 5 additions & 3 deletions lib/cloudflare_rails/importer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'net/http'
require 'uri'

Expand All @@ -19,9 +21,9 @@ def initialize(response)
end
end

BASE_URL = 'https://www.cloudflare.com'.freeze
IPS_V4_URL = '/ips-v4/'.freeze
IPS_V6_URL = '/ips-v6/'.freeze
BASE_URL = 'https://www.cloudflare.com'
IPS_V4_URL = '/ips-v4/'
IPS_V6_URL = '/ips-v6/'

class << self
def ips_v6
Expand Down
2 changes: 2 additions & 0 deletions lib/cloudflare_rails/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'active_support/core_ext/integer/time'

module CloudflareRails
Expand Down
2 changes: 2 additions & 0 deletions lib/cloudflare_rails/remote_ip_proxies.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module CloudflareRails
# patch ActionDispatch::RemoteIP to use our cloudflare ips - this way
# request.remote_ip is correct inside of rails
Expand Down
4 changes: 3 additions & 1 deletion lib/cloudflare_rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module CloudflareRails
VERSION = '6.0.0'.freeze
VERSION = '6.0.0'
end
2 changes: 2 additions & 0 deletions spec/cloudflare/rails_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe CloudflareRails do
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

ENV['RAILS_ENV'] ||= 'test'

require 'bundler/setup'
Expand Down

0 comments on commit 162eab6

Please sign in to comment.