Skip to content
Snippets Groups Projects
Commit 7ea641b6 authored by Douwe Maan's avatar Douwe Maan
Browse files

Enable Style/ColonMethodCall

parent b2da4623
No related branches found
No related tags found
No related merge requests found
Showing
with 28 additions and 30 deletions
Loading
Loading
@@ -959,6 +959,9 @@ Style/BracesAroundHashParameters:
Style/CaseEquality:
Enabled: false
 
Style/ColonMethodCall:
Enabled: true
Style/CommentAnnotation:
Enabled: false
 
Loading
Loading
Loading
Loading
@@ -38,11 +38,6 @@ RSpec/SingleArgumentMessageChain:
Exclude:
- 'spec/requests/api/internal_spec.rb'
 
# Offense count: 33
# Cop supports --auto-correct.
Style/ColonMethodCall:
Enabled: false
# Offense count: 32
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
Loading
Loading
Loading
Loading
@@ -80,7 +80,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
 
def build_qr_code
uri = current_user.otp_provisioning_uri(account_string, issuer: issuer_host)
RQRCode::render_qrcode(uri, :svg, level: :m, unit: 3)
RQRCode.render_qrcode(uri, :svg, level: :m, unit: 3)
end
 
def account_string
Loading
Loading
Loading
Loading
@@ -105,7 +105,7 @@ class Commit
end
 
def diff_line_count
@diff_line_count ||= Commit::diff_line_count(raw_diffs)
@diff_line_count ||= Commit.diff_line_count(raw_diffs)
@diff_line_count
end
 
Loading
Loading
Loading
Loading
@@ -39,7 +39,7 @@ class DroneCiService < CiService
def commit_status_path(sha, ref)
url = [drone_url,
"gitlab/#{project.full_path}/commits/#{sha}",
"?branch=#{URI::encode(ref.to_s)}&access_token=#{token}"]
"?branch=#{URI.encode(ref.to_s)}&access_token=#{token}"]
 
URI.join(*url).to_s
end
Loading
Loading
@@ -74,7 +74,7 @@ class DroneCiService < CiService
def build_page(sha, ref)
url = [drone_url,
"gitlab/#{project.full_path}/redirect/commits/#{sha}",
"?branch=#{URI::encode(ref.to_s)}"]
"?branch=#{URI.encode(ref.to_s)}"]
 
URI.join(*url).to_s
end
Loading
Loading
Loading
Loading
@@ -892,7 +892,7 @@ class Repository
 
def get_committer_and_author(user, email: nil, name: nil)
committer = user_to_committer(user)
author = Gitlab::Git::committer_hash(email: email, name: name) || committer
author = Gitlab::Git.committer_hash(email: email, name: name) || committer
 
{
author: author,
Loading
Loading
Loading
Loading
@@ -25,7 +25,7 @@ module Projects
end
 
def http?(url)
url =~ /\A#{URI::regexp(['http', 'https'])}\z/
url =~ /\A#{URI.regexp(['http', 'https'])}\z/
end
 
def valid_domain?(url)
Loading
Loading
Loading
Loading
@@ -120,8 +120,8 @@ class IrkerWorker
end
 
def compare_url(data, repo_path)
sha1 = Commit::truncate_sha(data['before'])
sha2 = Commit::truncate_sha(data['after'])
sha1 = Commit.truncate_sha(data['before'])
sha2 = Commit.truncate_sha(data['after'])
compare_url = "#{Gitlab.config.gitlab.url}/#{repo_path}/compare"
compare_url += "/#{sha1}...#{sha2}"
colorize_url compare_url
Loading
Loading
@@ -129,7 +129,7 @@ class IrkerWorker
 
def send_one_commit(project, hook_attrs, repo_name, branch)
commit = commit_from_id project, hook_attrs['id']
sha = colorize_sha Commit::truncate_sha(hook_attrs['id'])
sha = colorize_sha Commit.truncate_sha(hook_attrs['id'])
author = hook_attrs['author']['name']
files = colorize_nb_files(files_count commit)
title = commit.title
Loading
Loading
Loading
Loading
@@ -85,7 +85,7 @@ module API
note = ::Notes::CreateService.new(user_project, current_user, opts).execute
 
if note.valid?
present note, with: Entities::const_get(note.class.name)
present note, with: Entities.const_get(note.class.name)
else
not_found!("Note #{note.errors.messages}")
end
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@ module Bitbucket
url = raw['links']['clone'].find { |link| link['name'] == 'https' }.fetch('href')
 
if token.present?
clone_url = URI::parse(url)
clone_url = URI.parse(url)
clone_url.user = "x-token-auth:#{token}"
clone_url.to_s
else
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@ module Gitlab
module GonHelper
def add_gon_variables
gon.api_version = API::API.version
gon.default_avatar_url = URI::join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s
gon.default_avatar_url = URI.join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s
gon.max_file_size = current_application_settings.max_attachment_size
gon.relative_url_root = Gitlab.config.gitlab.relative_url_root
gon.shortcuts_path = help_page_path('shortcuts')
Loading
Loading
Loading
Loading
@@ -82,7 +82,7 @@ module Gitlab
def import_repository(storage, name, url)
# Timeout should be less than 900 ideally, to prevent the memory killer
# to silently kill the process without knowing we are timing out here.
output, status = Popen::popen([gitlab_shell_projects_path, 'import-project',
output, status = Popen.popen([gitlab_shell_projects_path, 'import-project',
storage, "#{name}.git", url, '800'])
raise Error, output unless status.zero?
true
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@ describe "Dashboard Issues Feed", feature: true do
visit issues_dashboard_path(:atom, private_token: user.private_token, state: 'opened', assignee_id: user.id)
 
link = find('link[type="application/atom+xml"]')
params = CGI::parse(URI.parse(link[:href]).query)
params = CGI.parse(URI.parse(link[:href]).query)
 
expect(params).to include('private_token' => [user.private_token])
expect(params).to include('state' => ['opened'])
Loading
Loading
Loading
Loading
@@ -43,7 +43,7 @@ describe 'Issues Feed', feature: true do
:atom, private_token: user.private_token, state: 'opened', assignee_id: user.id)
 
link = find('link[type="application/atom+xml"]')
params = CGI::parse(URI.parse(link[:href]).query)
params = CGI.parse(URI.parse(link[:href]).query)
 
expect(params).to include('private_token' => [user.private_token])
expect(params).to include('state' => ['opened'])
Loading
Loading
@@ -54,7 +54,7 @@ describe 'Issues Feed', feature: true do
visit issues_group_path(group, :atom, private_token: user.private_token, state: 'opened', assignee_id: user.id)
 
link = find('link[type="application/atom+xml"]')
params = CGI::parse(URI.parse(link[:href]).query)
params = CGI.parse(URI.parse(link[:href]).query)
 
expect(params).to include('private_token' => [user.private_token])
expect(params).to include('state' => ['opened'])
Loading
Loading
Loading
Loading
@@ -49,9 +49,9 @@ describe "Dashboard Issues filtering", feature: true, js: true do
visit_issues(milestone_title: '', assignee_id: user.id)
 
link = find('.nav-controls a', text: 'Subscribe')
params = CGI::parse(URI.parse(link[:href]).query)
params = CGI.parse(URI.parse(link[:href]).query)
auto_discovery_link = find('link[type="application/atom+xml"]', visible: false)
auto_discovery_params = CGI::parse(URI.parse(auto_discovery_link[:href]).query)
auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query)
 
expect(params).to include('private_token' => [user.private_token])
expect(params).to include('milestone_title' => [''])
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@ feature 'Import/Export - project export integration test', feature: true, js: tr
include ExportFileHelper
 
let(:user) { create(:admin) }
let(:export_path) { "#{Dir::tmpdir}/import_file_spec" }
let(:export_path) { "#{Dir.tmpdir}/import_file_spec" }
let(:config_hash) { YAML.load_file(Gitlab::ImportExport.config_file).deep_stringify_keys }
 
let(:sensitive_words) { %w[pass secret token key] }
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@ feature 'Import/Export - project import integration test', feature: true, js: tr
include Select2Helper
 
let(:file) { File.join(Rails.root, 'spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz') }
let(:export_path) { "#{Dir::tmpdir}/import_file_spec" }
let(:export_path) { "#{Dir.tmpdir}/import_file_spec" }
 
background do
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
Loading
Loading
require 'spec_helper'
 
feature 'Import/Export - Namespace export file cleanup', feature: true, js: true do
let(:export_path) { "#{Dir::tmpdir}/import_file_spec" }
let(:export_path) { "#{Dir.tmpdir}/import_file_spec" }
let(:config_hash) { YAML.load_file(Gitlab::ImportExport.config_file).deep_stringify_keys }
 
let(:project) { create(:empty_project) }
Loading
Loading
Loading
Loading
@@ -292,7 +292,7 @@ describe Gitlab::Git::Blob, seed_helper: true do
it 'should preserve file modes with commit' do
commit_options[:file][:path] = 'files/executables/ls'
 
entry = Gitlab::Git::Blob::find_entry_by_path(repository, commit.tree.oid, commit_options[:file][:path])
entry = Gitlab::Git::Blob.find_entry_by_path(repository, commit.tree.oid, commit_options[:file][:path])
expect(entry[:filemode]).to eq(0100755)
end
end
Loading
Loading
Loading
Loading
@@ -19,7 +19,7 @@ describe Gitlab::Git, lib: true do
 
describe 'committer_hash' do
it "returns a hash containing the given email and name" do
committer_hash = Gitlab::Git::committer_hash(email: committer_email, name: committer_name)
committer_hash = Gitlab::Git.committer_hash(email: committer_email, name: committer_name)
 
expect(committer_hash[:email]).to eq(committer_email)
expect(committer_hash[:name]).to eq(committer_name)
Loading
Loading
@@ -28,7 +28,7 @@ describe Gitlab::Git, lib: true do
 
context 'when email is nil' do
it "returns nil" do
committer_hash = Gitlab::Git::committer_hash(email: nil, name: committer_name)
committer_hash = Gitlab::Git.committer_hash(email: nil, name: committer_name)
 
expect(committer_hash).to be_nil
end
Loading
Loading
@@ -36,7 +36,7 @@ describe Gitlab::Git, lib: true do
 
context 'when name is nil' do
it "returns nil" do
committer_hash = Gitlab::Git::committer_hash(email: committer_email, name: nil)
committer_hash = Gitlab::Git.committer_hash(email: committer_email, name: nil)
 
expect(committer_hash).to be_nil
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment