mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Safely autocorrect Style/FileRead
Inspecting 1488 files
.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C............................................................................................................................................................................
Offenses:
lib/tasks/karma.rake:33:15: C: [Corrected] Style/FileRead: Use File.read.
unit_js = File.open('config/ng-test.conf.js', 'r').read
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/services/upload_sanitizer_spec.rb:13:41: C: [Corrected] Style/FileRead: Use File.read.
let(:service) { UploadSanitizer.new(File.open(upload).read) }
^^^^^^^^^^^^^^^^^^^^^^
1488 files inspected, 2 offenses detected, 2 offenses corrected
This commit is contained in:
@@ -783,13 +783,6 @@ Style/ClassVars:
|
||||
Exclude:
|
||||
- 'lib/spree/core/delegate_belongs_to.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/FileRead:
|
||||
Exclude:
|
||||
- 'lib/tasks/karma.rake'
|
||||
- 'spec/services/upload_sanitizer_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace :karma do
|
||||
|
||||
def unit_js(files)
|
||||
puts files
|
||||
unit_js = File.open('config/ng-test.conf.js', 'r').read
|
||||
unit_js = File.read('config/ng-test.conf.js')
|
||||
unit_js.gsub "APPLICATION_SPEC", "\"#{files.join("\",\n\"")}\""
|
||||
end
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ describe UploadSanitizer do
|
||||
f << "Test"
|
||||
end
|
||||
end
|
||||
let(:service) { UploadSanitizer.new(File.open(upload).read) }
|
||||
let(:service) { UploadSanitizer.new(File.read(upload)) }
|
||||
|
||||
it "sanitizes the uploaded file" do
|
||||
sanitized_upload = service.call
|
||||
|
||||
Reference in New Issue
Block a user