Safely autocorrect Style/QuotedSymbols

Inspecting 1509 files
.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.................................................................................................................................................................................................................................................................................................................................C............................................................C...........................................................................................................................................................................................................................................................................................................................................C.C.........................................................................................................................................C........................................................................................................................................

Offenses:

app/services/exchange_products_renderer.rb:50:13: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
      where("spree_variants.id": incoming_exchanges_variants)
            ^^^^^^^^^^^^^^^^^^^
lib/stripe/credit_card_cloner.rb:67:50: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
                                   { metadata: { "ofn-clone": true } },
                                                 ^^^^^^^^^^^
spec/controllers/api/v0/exchange_products_controller_spec.rb:59:52: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
          Spree::Product.includes(:variants).where("spree_variants.id": exchange.variants.map(&:id))
                                                   ^^^^^^^^^^^^^^^^^^^
spec/requests/api/orders_spec.rb:35:11: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
          "application/json": {
          ^^^^^^^^^^^^^^^^^^
spec/requests/api/v1/customers_spec.rb:39:16: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
        schema "$ref": "#/components/schemas/customers_collection"
               ^^^^^^
spec/requests/api/v1/customers_spec.rb:186:16: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
        schema "$ref": "#/components/schemas/customer"
               ^^^^^^
spec/requests/api/v1/customers_spec.rb:207:16: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
        schema "$ref": "#/components/schemas/customer"
               ^^^^^^
spec/requests/api/v1/customers_spec.rb:230:16: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
        schema "$ref": "#/components/schemas/error_response"
               ^^^^^^
spec/requests/api/v1/customers_spec.rb:239:16: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
        schema "$ref": "#/components/schemas/error_response"
               ^^^^^^
spec/requests/api/v1/customers_spec.rb:274:16: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
        schema "$ref": "#/components/schemas/error_response"
               ^^^^^^
spec/requests/api/v1/customers_spec.rb:286:18: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
          schema "$ref": "#/components/schemas/error_response"
                 ^^^^^^
spec/requests/api/v1/customers_spec.rb:361:16: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
        schema "$ref": "#/components/schemas/customer"
               ^^^^^^
spec/requests/api/v1/customers_spec.rb:427:16: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
        schema "$ref": "#/components/schemas/error_response"
               ^^^^^^
spec/requests/api/v1/customers_spec.rb:440:16: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
        schema "$ref": "#/components/schemas/customer"
               ^^^^^^
spec/requests/api/v1/customers_spec.rb:455:16: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
        schema "$ref": "#/components/schemas/customers_collection"
               ^^^^^^
spec/support/request/stripe_stubs.rb:72:42: C: [Corrected] Style/QuotedSymbols: Prefer single-quoted symbols when you don't need string interpolation or special symbols.
    stub = stub.with(body: { metadata: { "ofn-clone": true } })
                                         ^^^^^^^^^^^

1509 files inspected, 16 offenses detected, 16 offenses corrected
This commit is contained in:
Neal Chambers
2023-11-09 09:39:05 +09:00
parent 3c7c345534
commit ef928aa6fe
7 changed files with 16 additions and 29 deletions

View File

@@ -915,19 +915,6 @@ Style/PreferredHashMethods:
Exclude:
- 'app/controllers/api/v0/shipments_controller.rb'
# Offense count: 16
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: same_as_string_literals, single_quotes, double_quotes
Style/QuotedSymbols:
Exclude:
- 'app/services/exchange_products_renderer.rb'
- 'lib/stripe/credit_card_cloner.rb'
- 'spec/controllers/api/v0/exchange_products_controller_spec.rb'
- 'spec/requests/api/orders_spec.rb'
- 'spec/requests/api/v1/customers_spec.rb'
- 'spec/support/request/stripe_stubs.rb'
# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Methods.

View File

@@ -47,7 +47,7 @@ class ExchangeProductsRenderer
def products_for_outgoing_exchange
supplied_products(enterprises_for_outgoing_exchange.select(:id)).
includes(:variants).
where("spree_variants.id": incoming_exchanges_variants)
where('spree_variants.id': incoming_exchanges_variants)
end
def incoming_exchanges_variants

View File

@@ -64,7 +64,7 @@ module Stripe
def add_metadata_to_payment_method(payment_method_id)
Stripe::PaymentMethod.update(payment_method_id,
{ metadata: { "ofn-clone": true } },
{ metadata: { 'ofn-clone': true } },
stripe_account: @stripe_account)
end
end

View File

@@ -56,7 +56,7 @@ module Api
describe "pagination" do
let(:exchange) { order_cycle.exchanges.outgoing.first }
let(:products_relation) {
Spree::Product.includes(:variants).where("spree_variants.id": exchange.variants.map(&:id))
Spree::Product.includes(:variants).where('spree_variants.id': exchange.variants.map(&:id))
}
before do

View File

@@ -32,7 +32,7 @@ describe 'api/v0/orders', swagger_doc: 'v0.yaml', type: :request do
# Which would also validate the response in the test, this is an open
# issue with rswag: https://github.com/rswag/rswag/issues/268
metadata[:response][:content] = {
"application/json": {
'application/json': {
schema: { '$ref' => '#/components/schemas/Order_Concise' }
}
}

View File

@@ -36,7 +36,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
response "200", "Customers list" do
param(:enterprise_id) { enterprise1.id }
param("extra_fields[customer]") { :balance }
schema "$ref": "#/components/schemas/customers_collection"
schema '$ref': "#/components/schemas/customers_collection"
run_test!
end
@@ -183,7 +183,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
enterprise_id: enterprise1.id.to_s
}
end
schema "$ref": "#/components/schemas/customer"
schema '$ref': "#/components/schemas/customer"
run_test! do
expect(json_response[:data][:attributes]).to include(
@@ -204,7 +204,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
enterprise_id: enterprise1.id,
)
end
schema "$ref": "#/components/schemas/customer"
schema '$ref': "#/components/schemas/customer"
run_test! do
expect(json_response[:data][:attributes]).to include(
@@ -227,7 +227,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
allow_charges: true,
}
end
schema "$ref": "#/components/schemas/error_response"
schema '$ref': "#/components/schemas/error_response"
run_test! do
expect(json_error_detail).to eq "Parameters not allowed in this request: allow_charges"
@@ -236,7 +236,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
response "422", "Unprocessable entity" do
param(:customer) { {} }
schema "$ref": "#/components/schemas/error_response"
schema '$ref': "#/components/schemas/error_response"
run_test! do
expect(json_error_detail).to eq "A required parameter is missing or empty: customer"
@@ -271,7 +271,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
response "404", "Not found" do
param(:id) { 0 }
schema "$ref": "#/components/schemas/error_response"
schema '$ref': "#/components/schemas/error_response"
run_test! do
expect(json_error_detail).to eq "The resource you were looking for could not be found."
@@ -283,7 +283,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
response "401", "Unauthorized" do
param(:id) { customer1.id }
schema "$ref": "#/components/schemas/error_response"
schema '$ref': "#/components/schemas/error_response"
run_test! do
expect(json_error_detail).to eq "You are not authorized to perform that action."
@@ -358,7 +358,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
enterprise_id: enterprise1.id.to_s
}
end
schema "$ref": "#/components/schemas/customer"
schema '$ref': "#/components/schemas/customer"
run_test! do
# Tags should not be overridden when the param is missing:
@@ -424,7 +424,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
response "422", "Unprocessable entity" do
param(:id) { customer1.id }
param(:customer) { {} }
schema "$ref": "#/components/schemas/error_response"
schema '$ref': "#/components/schemas/error_response"
run_test!
end
@@ -437,7 +437,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
response "200", "Customer deleted" do
param(:id) { customer1.id }
schema "$ref": "#/components/schemas/customer"
schema '$ref': "#/components/schemas/customer"
run_test!
end
@@ -452,7 +452,7 @@ describe "Customers", type: :request, swagger_doc: "v1.yaml" do
response "200", "Customers list" do
param(:enterprise_id) { enterprise1.id }
schema "$ref": "#/components/schemas/customers_collection"
schema '$ref': "#/components/schemas/customers_collection"
run_test!
end

View File

@@ -69,7 +69,7 @@ module StripeStubs
def stub_add_metadata_request(payment_method: "pm_456", response: {})
stub = stub_request(:post, "https://api.stripe.com/v1/payment_methods/#{payment_method}")
stub = stub.with(body: { metadata: { "ofn-clone": true } })
stub = stub.with(body: { metadata: { 'ofn-clone': true } })
stub = stub.with(
headers: { 'Stripe-Account' => 'abc123' }
)