diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index daca142..2eab29d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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 @@ -11,7 +11,7 @@ # 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). @@ -19,13 +19,13 @@ Lint/ConstantDefinitionInBlock: # 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. @@ -43,26 +43,26 @@ 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). @@ -70,19 +70,12 @@ RSpec/ContextWording: # 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: @@ -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. @@ -110,19 +103,19 @@ 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). @@ -130,14 +123,14 @@ Rails/CompactBlank: # 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). @@ -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). diff --git a/lib/cloudflare_rails.rb b/lib/cloudflare_rails.rb index a785a77..09f1ef2 100644 --- a/lib/cloudflare_rails.rb +++ b/lib/cloudflare_rails.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'zeitwerk' loader = Zeitwerk::Loader.for_gem loader.ignore("#{__dir__}/cloudflare-rails.rb") diff --git a/lib/cloudflare_rails/check_trusted_proxies.rb b/lib/cloudflare_rails/check_trusted_proxies.rb index fa46390..8ed753b 100644 --- a/lib/cloudflare_rails/check_trusted_proxies.rb +++ b/lib/cloudflare_rails/check_trusted_proxies.rb @@ -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 diff --git a/lib/cloudflare_rails/importer.rb b/lib/cloudflare_rails/importer.rb index f54c619..1e9ef46 100644 --- a/lib/cloudflare_rails/importer.rb +++ b/lib/cloudflare_rails/importer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'net/http' require 'uri' @@ -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 diff --git a/lib/cloudflare_rails/railtie.rb b/lib/cloudflare_rails/railtie.rb index 714cf7a..3f18b17 100644 --- a/lib/cloudflare_rails/railtie.rb +++ b/lib/cloudflare_rails/railtie.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'active_support/core_ext/integer/time' module CloudflareRails diff --git a/lib/cloudflare_rails/remote_ip_proxies.rb b/lib/cloudflare_rails/remote_ip_proxies.rb index a72ee72..024434c 100644 --- a/lib/cloudflare_rails/remote_ip_proxies.rb +++ b/lib/cloudflare_rails/remote_ip_proxies.rb @@ -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 diff --git a/lib/cloudflare_rails/version.rb b/lib/cloudflare_rails/version.rb index 855f967..ab02471 100644 --- a/lib/cloudflare_rails/version.rb +++ b/lib/cloudflare_rails/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module CloudflareRails - VERSION = '6.0.0'.freeze + VERSION = '6.0.0' end diff --git a/spec/cloudflare/rails_spec.rb b/spec/cloudflare/rails_spec.rb index 12f50d3..925935b 100644 --- a/spec/cloudflare/rails_spec.rb +++ b/spec/cloudflare/rails_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe CloudflareRails do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 97aa0f6..3eb85ca 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV['RAILS_ENV'] ||= 'test' require 'bundler/setup'