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
Tatuya Kamada
gitlab-ce
Commits
f729f604
Commit
f729f604
authored
Mar 25, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'more-rubocop-styles' into 'master'
More rubocop styles See merge request !449
parents
de9d51ee
69454e36
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
25 additions
and
22 deletions
+25
-22
.rubocop.yml
.rubocop.yml
+8
-8
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+3
-3
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+1
-1
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+5
-2
app/mailers/notify.rb
app/mailers/notify.rb
+1
-1
app/models/project_services/asana_service.rb
app/models/project_services/asana_service.rb
+1
-1
lib/api/helpers.rb
lib/api/helpers.rb
+2
-2
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+1
-1
lib/gitlab/popen.rb
lib/gitlab/popen.rb
+1
-1
lib/gitlab/satellite/merge_action.rb
lib/gitlab/satellite/merge_action.rb
+1
-1
lib/gitlab/theme.rb
lib/gitlab/theme.rb
+1
-1
No files found.
.rubocop.yml
View file @
f729f604
...
@@ -355,7 +355,7 @@ Style/MultilineBlockChain:
...
@@ -355,7 +355,7 @@ Style/MultilineBlockChain:
Style/MultilineBlockLayout
:
Style/MultilineBlockLayout
:
Description
:
'
Ensures
newlines
after
multiline
block
do
statements.'
Description
:
'
Ensures
newlines
after
multiline
block
do
statements.'
Enabled
:
fals
e
Enabled
:
tru
e
Style/MultilineIfThen
:
Style/MultilineIfThen
:
Description
:
'
Do
not
use
then
for
multi-line
if/unless.'
Description
:
'
Do
not
use
then
for
multi-line
if/unless.'
...
@@ -390,7 +390,7 @@ Style/NegatedWhile:
...
@@ -390,7 +390,7 @@ Style/NegatedWhile:
Style/NestedTernaryOperator
:
Style/NestedTernaryOperator
:
Description
:
'
Use
one
expression
per
branch
in
a
ternary
operator.'
Description
:
'
Use
one
expression
per
branch
in
a
ternary
operator.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-nested-ternary'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-nested-ternary'
Enabled
:
fals
e
Enabled
:
tru
e
Style/Next
:
Style/Next
:
Description
:
'
Use
`next`
to
skip
iteration
instead
of
a
condition
at
the
end.'
Description
:
'
Use
`next`
to
skip
iteration
instead
of
a
condition
at
the
end.'
...
@@ -400,17 +400,17 @@ Style/Next:
...
@@ -400,17 +400,17 @@ Style/Next:
Style/NilComparison
:
Style/NilComparison
:
Description
:
'
Prefer
x.nil?
to
x
==
nil.'
Description
:
'
Prefer
x.nil?
to
x
==
nil.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#predicate-methods'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#predicate-methods'
Enabled
:
fals
e
Enabled
:
tru
e
Style/NonNilCheck
:
Style/NonNilCheck
:
Description
:
'
Checks
for
redundant
nil
checks.'
Description
:
'
Checks
for
redundant
nil
checks.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks'
Enabled
:
fals
e
Enabled
:
tru
e
Style/Not
:
Style/Not
:
Description
:
'
Use
!
instead
of
not.'
Description
:
'
Use
!
instead
of
not.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#bang-not-not'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#bang-not-not'
Enabled
:
fals
e
Enabled
:
tru
e
Style/NumericLiterals
:
Style/NumericLiterals
:
Description
:
>-
Description
:
>-
...
@@ -424,7 +424,7 @@ Style/OneLineConditional:
...
@@ -424,7 +424,7 @@ Style/OneLineConditional:
Favor the ternary operator(?:) over
Favor the ternary operator(?:) over
if/then/else/end constructs.
if/then/else/end constructs.
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#ternary-operator'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#ternary-operator'
Enabled
:
fals
e
Enabled
:
tru
e
Style/OpMethod
:
Style/OpMethod
:
Description
:
'
When
defining
binary
operators,
name
the
argument
other.'
Description
:
'
When
defining
binary
operators,
name
the
argument
other.'
...
@@ -436,7 +436,7 @@ Style/ParenthesesAroundCondition:
...
@@ -436,7 +436,7 @@ Style/ParenthesesAroundCondition:
Don't use parentheses around the condition of an
Don't use parentheses around the condition of an
if/unless/while.
if/unless/while.
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-parens-if'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-parens-if'
Enabled
:
fals
e
Enabled
:
tru
e
Style/PercentLiteralDelimiters
:
Style/PercentLiteralDelimiters
:
Description
:
'
Use
`%`-literal
delimiters
consistently'
Description
:
'
Use
`%`-literal
delimiters
consistently'
...
@@ -480,7 +480,7 @@ Style/RedundantException:
...
@@ -480,7 +480,7 @@ Style/RedundantException:
Style/RedundantReturn
:
Style/RedundantReturn
:
Description
:
"
Don't
use
return
where
it's
not
required."
Description
:
"
Don't
use
return
where
it's
not
required."
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-explicit-return'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-explicit-return'
Enabled
:
fals
e
Enabled
:
tru
e
Style/RedundantSelf
:
Style/RedundantSelf
:
Description
:
"
Don't
use
self
where
it's
not
needed."
Description
:
"
Don't
use
self
where
it's
not
needed."
...
...
app/helpers/gitlab_markdown_helper.rb
View file @
f729f604
...
@@ -29,7 +29,7 @@ module GitlabMarkdownHelper
...
@@ -29,7 +29,7 @@ module GitlabMarkdownHelper
end
end
def
markdown
(
text
,
options
=
{})
def
markdown
(
text
,
options
=
{})
unless
(
@markdown
and
options
==
@options
)
unless
@markdown
&&
options
==
@options
@options
=
options
@options
=
options
gitlab_renderer
=
Redcarpet
::
Render
::
GitlabHTML
.
new
(
self
,
gitlab_renderer
=
Redcarpet
::
Render
::
GitlabHTML
.
new
(
self
,
user_color_scheme_class
,
user_color_scheme_class
,
...
@@ -182,7 +182,7 @@ module GitlabMarkdownHelper
...
@@ -182,7 +182,7 @@ module GitlabMarkdownHelper
def
file_exists?
(
path
)
def
file_exists?
(
path
)
return
false
if
path
.
nil?
return
false
if
path
.
nil?
return
@repository
.
blob_at
(
current_sha
,
path
).
present?
||
@repository
.
tree
(
current_sha
,
path
).
entries
.
any?
@repository
.
blob_at
(
current_sha
,
path
).
present?
||
@repository
.
tree
(
current_sha
,
path
).
entries
.
any?
end
end
# Check if the path is pointing to a directory(tree) or a file(blob)
# Check if the path is pointing to a directory(tree) or a file(blob)
...
@@ -190,7 +190,7 @@ module GitlabMarkdownHelper
...
@@ -190,7 +190,7 @@ module GitlabMarkdownHelper
def
local_path
(
path
)
def
local_path
(
path
)
return
"tree"
if
@repository
.
tree
(
current_sha
,
path
).
entries
.
any?
return
"tree"
if
@repository
.
tree
(
current_sha
,
path
).
entries
.
any?
return
"raw"
if
@repository
.
blob_at
(
current_sha
,
path
).
image?
return
"raw"
if
@repository
.
blob_at
(
current_sha
,
path
).
image?
return
"blob"
"blob"
end
end
def
current_sha
def
current_sha
...
...
app/helpers/merge_requests_helper.rb
View file @
f729f604
...
@@ -17,7 +17,7 @@ module MergeRequestsHelper
...
@@ -17,7 +17,7 @@ module MergeRequestsHelper
end
end
def
new_mr_from_push_event
(
event
,
target_project
)
def
new_mr_from_push_event
(
event
,
target_project
)
return
{
{
merge_request:
{
merge_request:
{
source_project_id:
event
.
project
.
id
,
source_project_id:
event
.
project
.
id
,
target_project_id:
target_project
.
id
,
target_project_id:
target_project
.
id
,
...
...
app/helpers/submodule_helper.rb
View file @
f729f604
...
@@ -49,7 +49,7 @@ module SubmoduleHelper
...
@@ -49,7 +49,7 @@ module SubmoduleHelper
def
standard_links
(
host
,
namespace
,
project
,
commit
)
def
standard_links
(
host
,
namespace
,
project
,
commit
)
base
=
[
'https://'
,
host
,
'/'
,
namespace
,
'/'
,
project
].
join
(
''
)
base
=
[
'https://'
,
host
,
'/'
,
namespace
,
'/'
,
project
].
join
(
''
)
return
base
,
[
base
,
'/tree/'
,
commit
].
join
(
''
)
[
base
,
[
base
,
'/tree/'
,
commit
].
join
(
''
)]
end
end
def
relative_self_links
(
url
,
commit
)
def
relative_self_links
(
url
,
commit
)
...
@@ -58,7 +58,10 @@ module SubmoduleHelper
...
@@ -58,7 +58,10 @@ module SubmoduleHelper
else
else
base
=
[
@project
.
group
.
path
,
'/'
,
url
[
/([^\/]*)\.git/
,
1
]
].
join
(
''
)
base
=
[
@project
.
group
.
path
,
'/'
,
url
[
/([^\/]*)\.git/
,
1
]
].
join
(
''
)
end
end
return
namespace_project_path
(
base
.
namespace
,
base
),
[
namespace_project_path
(
base
.
namespace
,
base
),
namespace_project_tree_path
(
base
.
namespace
,
base
,
commit
)
namespace_project_tree_path
(
base
.
namespace
,
base
,
commit
)
]
end
end
end
end
app/mailers/notify.rb
View file @
f729f604
...
@@ -148,7 +148,7 @@ class Notify < ActionMailer::Base
...
@@ -148,7 +148,7 @@ class Notify < ActionMailer::Base
headers
[
'References'
]
=
message_id
(
model
)
headers
[
'References'
]
=
message_id
(
model
)
headers
[
'X-GitLab-Project'
]
=
"
#{
@project
.
name
}
| "
if
@project
headers
[
'X-GitLab-Project'
]
=
"
#{
@project
.
name
}
| "
if
@project
if
(
headers
[
:subject
])
if
headers
[
:subject
]
headers
[
:subject
].
prepend
(
'Re: '
)
headers
[
:subject
].
prepend
(
'Re: '
)
end
end
...
...
app/models/project_services/asana_service.rb
View file @
f729f604
...
@@ -82,7 +82,7 @@ automatically inspected. Leave blank to include all branches.'
...
@@ -82,7 +82,7 @@ automatically inspected. Leave blank to include all branches.'
branch_restriction
=
restrict_to_branch
.
to_s
branch_restriction
=
restrict_to_branch
.
to_s
# check the branch restriction is poplulated and branch is not included
# check the branch restriction is poplulated and branch is not included
if
branch_restriction
.
length
>
0
&&
branch_restriction
.
index
(
branch
)
==
nil
if
branch_restriction
.
length
>
0
&&
branch_restriction
.
index
(
branch
)
.
nil?
return
return
end
end
...
...
lib/api/helpers.rb
View file @
f729f604
...
@@ -20,7 +20,7 @@ module API
...
@@ -20,7 +20,7 @@ module API
identifier
=
sudo_identifier
()
identifier
=
sudo_identifier
()
# If the sudo is the current user do nothing
# If the sudo is the current user do nothing
if
(
identifier
&&
!
(
@current_user
.
id
==
identifier
||
@current_user
.
username
==
identifier
)
)
if
identifier
&&
!
(
@current_user
.
id
==
identifier
||
@current_user
.
username
==
identifier
)
render_api_error!
(
'403 Forbidden: Must be admin to use sudo'
,
403
)
unless
@current_user
.
is_admin?
render_api_error!
(
'403 Forbidden: Must be admin to use sudo'
,
403
)
unless
@current_user
.
is_admin?
@current_user
=
User
.
by_username_or_id
(
identifier
)
@current_user
=
User
.
by_username_or_id
(
identifier
)
not_found!
(
"No user id or username for:
#{
identifier
}
"
)
if
@current_user
.
nil?
not_found!
(
"No user id or username for:
#{
identifier
}
"
)
if
@current_user
.
nil?
...
@@ -33,7 +33,7 @@ module API
...
@@ -33,7 +33,7 @@ module API
identifier
||=
params
[
SUDO_PARAM
]
||=
env
[
SUDO_HEADER
]
identifier
||=
params
[
SUDO_PARAM
]
||=
env
[
SUDO_HEADER
]
# Regex for integers
# Regex for integers
if
(
!!
(
identifier
=~
/^[0-9]+$/
)
)
if
!!
(
identifier
=~
/^[0-9]+$/
)
identifier
.
to_i
identifier
.
to_i
else
else
identifier
identifier
...
...
lib/gitlab/git_access.rb
View file @
f729f604
...
@@ -30,7 +30,7 @@ module Gitlab
...
@@ -30,7 +30,7 @@ module Gitlab
def
can_push_to_branch?
(
ref
)
def
can_push_to_branch?
(
ref
)
return
false
unless
user
return
false
unless
user
if
project
.
protected_branch?
(
ref
)
&&
if
project
.
protected_branch?
(
ref
)
&&
!
(
project
.
developers_can_push_to_protected_branch?
(
ref
)
&&
project
.
team
.
developer?
(
user
))
!
(
project
.
developers_can_push_to_protected_branch?
(
ref
)
&&
project
.
team
.
developer?
(
user
))
user
.
can?
(
:push_code_to_protected_branches
,
project
)
user
.
can?
(
:push_code_to_protected_branches
,
project
)
...
...
lib/gitlab/popen.rb
View file @
f729f604
...
@@ -29,7 +29,7 @@ module Gitlab
...
@@ -29,7 +29,7 @@ module Gitlab
@cmd_status
=
wait_thr
.
value
.
exitstatus
@cmd_status
=
wait_thr
.
value
.
exitstatus
end
end
return
@cmd_output
,
@cmd_status
[
@cmd_output
,
@cmd_status
]
end
end
end
end
end
end
lib/gitlab/satellite/merge_action.rb
View file @
f729f604
...
@@ -97,7 +97,7 @@ module Gitlab
...
@@ -97,7 +97,7 @@ module Gitlab
in_locked_and_timed_satellite
do
|
merge_repo
|
in_locked_and_timed_satellite
do
|
merge_repo
|
prepare_satellite!
(
merge_repo
)
prepare_satellite!
(
merge_repo
)
update_satellite_source_and_target!
(
merge_repo
)
update_satellite_source_and_target!
(
merge_repo
)
if
(
merge_request
.
for_fork?
)
if
merge_request
.
for_fork?
repository
=
Gitlab
::
Git
::
Repository
.
new
(
merge_repo
.
path
)
repository
=
Gitlab
::
Git
::
Repository
.
new
(
merge_repo
.
path
)
commits
=
Gitlab
::
Git
::
Commit
.
between
(
commits
=
Gitlab
::
Git
::
Commit
.
between
(
repository
,
repository
,
...
...
lib/gitlab/theme.rb
View file @
f729f604
...
@@ -19,7 +19,7 @@ module Gitlab
...
@@ -19,7 +19,7 @@ module Gitlab
id
||=
Gitlab
.
config
.
gitlab
.
default_theme
id
||=
Gitlab
.
config
.
gitlab
.
default_theme
return
themes
[
id
]
themes
[
id
]
end
end
def
self
.
type_css_class_by_id
(
id
)
def
self
.
type_css_class_by_id
(
id
)
...
...
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