Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
0a09925d
Commit
0a09925d
authored
Mar 31, 2017
by
mhasbini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable Style/Proc cop for rubocop
parent
9fc17f6f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
16 additions
and
13 deletions
+16
-13
.rubocop.yml
.rubocop.yml
+4
-0
.rubocop_todo.yml
.rubocop_todo.yml
+0
-5
app/mailers/base_mailer.rb
app/mailers/base_mailer.rb
+2
-2
app/models/milestone.rb
app/models/milestone.rb
+1
-1
app/models/service.rb
app/models/service.rb
+1
-1
changelogs/unreleased/style-proc-cop.yml
changelogs/unreleased/style-proc-cop.yml
+4
-0
lib/api/api_guard.rb
lib/api/api_guard.rb
+1
-1
lib/gitlab/ldap/config.rb
lib/gitlab/ldap/config.rb
+2
-2
spec/initializers/trusted_proxies_spec.rb
spec/initializers/trusted_proxies_spec.rb
+1
-1
No files found.
.rubocop.yml
View file @
0a09925d
...
...
@@ -533,6 +533,10 @@ Style/WhileUntilModifier:
Style/WordArray
:
Enabled
:
true
# Use `proc` instead of `Proc.new`.
Style/Proc
:
Enabled
:
true
# Metrics #####################################################################
# A calculated magnitude based on number of assignments,
...
...
.rubocop_todo.yml
View file @
0a09925d
...
...
@@ -226,11 +226,6 @@ Style/PredicateName:
Style/PreferredHashMethods
:
Enabled
:
false
# Offense count: 8
# Cop supports --auto-correct.
Style/Proc
:
Enabled
:
false
# Offense count: 62
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
...
...
app/mailers/base_mailer.rb
View file @
0a09925d
...
...
@@ -5,8 +5,8 @@ class BaseMailer < ActionMailer::Base
attr_accessor
:current_user
helper_method
:current_user
,
:can?
default
from:
Proc
.
new
{
default_sender_address
.
format
}
default
reply_to:
Proc
.
new
{
default_reply_to_address
.
format
}
default
from:
proc
{
default_sender_address
.
format
}
default
reply_to:
proc
{
default_reply_to_address
.
format
}
def
can?
Ability
.
allowed?
(
current_user
,
action
,
subject
)
...
...
app/models/milestone.rb
View file @
0a09925d
...
...
@@ -30,7 +30,7 @@ class Milestone < ActiveRecord::Base
validates
:title
,
presence:
true
,
uniqueness:
{
scope: :project_id
}
validates
:project
,
presence:
true
validate
:start_date_should_be_less_than_due_date
,
if:
Proc
.
new
{
|
m
|
m
.
start_date
.
present?
&&
m
.
due_date
.
present?
}
validate
:start_date_should_be_less_than_due_date
,
if:
proc
{
|
m
|
m
.
start_date
.
present?
&&
m
.
due_date
.
present?
}
strip_attributes
:title
...
...
app/models/service.rb
View file @
0a09925d
...
...
@@ -25,7 +25,7 @@ class Service < ActiveRecord::Base
belongs_to
:project
,
inverse_of: :services
has_one
:service_hook
validates
:project_id
,
presence:
true
,
unless:
Proc
.
new
{
|
service
|
service
.
template?
}
validates
:project_id
,
presence:
true
,
unless:
proc
{
|
service
|
service
.
template?
}
scope
:visible
,
->
{
where
.
not
(
type:
'GitlabIssueTrackerService'
)
}
scope
:issue_trackers
,
->
{
where
(
category:
'issue_tracker'
)
}
...
...
changelogs/unreleased/style-proc-cop.yml
0 → 100644
View file @
0a09925d
---
title
:
Enable Style/Proc cop for rubocop
merge_request
:
author
:
mhasbini
lib/api/api_guard.rb
View file @
0a09925d
...
...
@@ -121,7 +121,7 @@ module API
end
def
oauth2_bearer_token_error_handler
Proc
.
new
do
|
e
|
proc
do
|
e
|
response
=
case
e
when
MissingTokenError
...
...
lib/gitlab/ldap/config.rb
View file @
0a09925d
...
...
@@ -124,9 +124,9 @@ module Gitlab
def
name_proc
if
allow_username_or_email_login
Proc
.
new
{
|
name
|
name
.
gsub
(
/@.*\z/
,
''
)
}
proc
{
|
name
|
name
.
gsub
(
/@.*\z/
,
''
)
}
else
Proc
.
new
{
|
name
|
name
}
proc
{
|
name
|
name
}
end
end
...
...
spec/initializers/trusted_proxies_spec.rb
View file @
0a09925d
...
...
@@ -56,7 +56,7 @@ describe 'trusted_proxies', lib: true do
end
def
stub_request
(
headers
=
{})
ActionDispatch
::
RemoteIp
.
new
(
Proc
.
new
{
},
false
,
Rails
.
application
.
config
.
action_dispatch
.
trusted_proxies
).
call
(
headers
)
ActionDispatch
::
RemoteIp
.
new
(
proc
{
},
false
,
Rails
.
application
.
config
.
action_dispatch
.
trusted_proxies
).
call
(
headers
)
ActionDispatch
::
Request
.
new
(
headers
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment