Commit 7e2d6db9 authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Rémy Coutable

Fix Style/EmptyLiteral cop

parent a9e9dbba
......@@ -623,17 +623,6 @@ Style/EmptyLambdaParameter:
- 'app/models/ci/build.rb'
- 'app/models/ci/runner.rb'
# Offense count: 7
# Cop supports --auto-correct.
Style/EmptyLiteral:
Exclude:
- 'lib/gitlab/fogbugz_import/importer.rb'
- 'lib/gitlab/git/diff_collection.rb'
- 'lib/gitlab/gitaly_client.rb'
- 'spec/helpers/merge_requests_helper_spec.rb'
- 'spec/lib/gitlab/workhorse_spec.rb'
- 'spec/requests/api/jobs_spec.rb'
# Offense count: 170
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
......
---
title: Fix Style/EmptyLiteral cop
merge_request: 41110
author: Rajendra Kadam
type: fixed
......@@ -39,7 +39,7 @@ module Gitlab
def user_map
@user_map ||= begin
user_map = Hash.new
user_map = {}
import_data = project.import_data.try(:data)
stored_user_map = import_data['user_map'] if import_data
user_map.update(stored_user_map) if stored_user_map
......
......@@ -37,7 +37,7 @@ module Gitlab
@byte_count = 0
@overflow = false
@empty = true
@array = Array.new
@array = []
end
def each(&block)
......
......@@ -450,7 +450,7 @@ module Gitlab
stack_string = Gitlab::BacktraceCleaner.clean_backtrace(caller).drop(1).join("\n")
Gitlab::SafeRequestStore[:stack_counter] ||= Hash.new
Gitlab::SafeRequestStore[:stack_counter] ||= {}
count = Gitlab::SafeRequestStore[:stack_counter][stack_string] || 0
Gitlab::SafeRequestStore[:stack_counter][stack_string] = count + 1
......
......@@ -75,7 +75,7 @@ RSpec.describe MergeRequestsHelper do
describe '#tab_link_for' do
let(:merge_request) { create(:merge_request, :simple) }
let(:options) { Hash.new }
let(:options) { {} }
subject { tab_link_for(merge_request, :show, options) { 'Discussion' } }
......
......@@ -71,7 +71,7 @@ RSpec.describe Gitlab::Workhorse do
context "when the repository doesn't have an archive file path" do
before do
allow(project.repository).to receive(:archive_metadata).and_return(Hash.new)
allow(project.repository).to receive(:archive_metadata).and_return({})
end
it "raises an error" do
......
......@@ -56,7 +56,7 @@ RSpec.describe API::Jobs do
end
describe 'GET /projects/:id/jobs' do
let(:query) { Hash.new }
let(:query) { {} }
before do |example|
unless example.metadata[:skip_before_request]
......@@ -167,7 +167,7 @@ RSpec.describe API::Jobs do
end
describe 'GET /projects/:id/pipelines/:pipeline_id/jobs' do
let(:query) { Hash.new }
let(:query) { {} }
before do |example|
unless example.metadata[:skip_before_request]
......@@ -296,7 +296,7 @@ RSpec.describe API::Jobs do
project: downstream_pipeline.project)
end
let(:query) { Hash.new }
let(:query) { {} }
before do |example|
unless example.metadata[:skip_before_request]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment