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
Jérome Perrin
gitlab-ce
Commits
863f3873
Commit
863f3873
authored
Feb 03, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'rubycop-improvements' into 'master'
Rubycop improvements See merge request !1463
parents
8c577a57
61cc6a92
Changes
40
Show whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
199 additions
and
170 deletions
+199
-170
.rubocop.yml
.rubocop.yml
+26
-22
app/controllers/namespaces_controller.rb
app/controllers/namespaces_controller.rb
+0
-1
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+1
-2
app/controllers/projects/raw_controller.rb
app/controllers/projects/raw_controller.rb
+0
-1
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+4
-4
app/controllers/projects/wikis_controller.rb
app/controllers/projects/wikis_controller.rb
+10
-10
app/finders/notes_finder.rb
app/finders/notes_finder.rb
+13
-12
app/finders/snippets_finder.rb
app/finders/snippets_finder.rb
+1
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+3
-3
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+7
-6
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+1
-1
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+0
-1
app/helpers/tab_helper.rb
app/helpers/tab_helper.rb
+1
-1
app/models/application_setting.rb
app/models/application_setting.rb
+2
-1
app/models/commit.rb
app/models/commit.rb
+6
-5
app/models/namespace.rb
app/models/namespace.rb
+13
-8
app/models/project.rb
app/models/project.rb
+11
-7
app/models/project_services/bamboo_service.rb
app/models/project_services/bamboo_service.rb
+12
-6
app/models/project_services/teamcity_service.rb
app/models/project_services/teamcity_service.rb
+9
-6
app/models/snippet.rb
app/models/snippet.rb
+5
-3
app/models/user.rb
app/models/user.rb
+6
-4
app/models/wiki_page.rb
app/models/wiki_page.rb
+1
-1
app/services/oauth2/access_token_validation_service.rb
app/services/oauth2/access_token_validation_service.rb
+1
-1
app/services/projects/image_service.rb
app/services/projects/image_service.rb
+2
-2
app/services/projects/participants_service.rb
app/services/projects/participants_service.rb
+6
-5
config/initializers/7_omniauth.rb
config/initializers/7_omniauth.rb
+1
-1
config/initializers/acts_as_taggable_on_patch.rb
config/initializers/acts_as_taggable_on_patch.rb
+18
-17
config/initializers/carrierwave.rb
config/initializers/carrierwave.rb
+13
-5
config/initializers/gitlab_shell_secret_token.rb
config/initializers/gitlab_shell_secret_token.rb
+1
-1
config/routes.rb
config/routes.rb
+4
-6
lib/api/api_guard.rb
lib/api/api_guard.rb
+4
-7
lib/api/internal.rb
lib/api/internal.rb
+1
-3
lib/api/namespaces.rb
lib/api/namespaces.rb
+2
-2
lib/api/system_hooks.rb
lib/api/system_hooks.rb
+2
-2
lib/email_validator.rb
lib/email_validator.rb
+1
-1
lib/gitlab/backend/shell_adapter.rb
lib/gitlab/backend/shell_adapter.rb
+0
-1
lib/gitlab/diff/parser.rb
lib/gitlab/diff/parser.rb
+2
-2
lib/gitlab/force_push_check.rb
lib/gitlab/force_push_check.rb
+0
-1
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+5
-5
lib/gitlab/ldap/adapter.rb
lib/gitlab/ldap/adapter.rb
+4
-2
No files found.
.rubocop.yml
View file @
863f3873
Style/AccessModifierIndentation
:
Style/AccessModifierIndentation
:
Description
:
Check indentation of private/protected visibility modifiers.
Description
:
Check indentation of private/protected visibility modifiers.
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected'
Enabled
:
fals
e
Enabled
:
tru
e
Style/AccessorMethodName
:
Style/AccessorMethodName
:
Description
:
Check the naming of accessor methods for get_/set_.
Description
:
Check the naming of accessor methods for get_/set_.
...
@@ -10,20 +10,20 @@ Style/AccessorMethodName:
...
@@ -10,20 +10,20 @@ Style/AccessorMethodName:
Style/Alias
:
Style/Alias
:
Description
:
'
Use
alias_method
instead
of
alias.'
Description
:
'
Use
alias_method
instead
of
alias.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#alias-method'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#alias-method'
Enabled
:
fals
e
Enabled
:
tru
e
Style/AlignArray
:
Style/AlignArray
:
Description
:
>-
Description
:
>-
Align the elements of an array literal if they span more than
Align the elements of an array literal if they span more than
one line.
one line.
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
Enabled
:
fals
e
Enabled
:
tru
e
Style/AlignHash
:
Style/AlignHash
:
Description
:
>-
Description
:
>-
Align the elements of a hash literal if they span more than
Align the elements of a hash literal if they span more than
one line.
one line.
Enabled
:
fals
e
Enabled
:
tru
e
Style/AlignParameters
:
Style/AlignParameters
:
Description
:
>-
Description
:
>-
...
@@ -45,12 +45,12 @@ Style/ArrayJoin:
...
@@ -45,12 +45,12 @@ Style/ArrayJoin:
Style/AsciiComments
:
Style/AsciiComments
:
Description
:
'
Use
only
ascii
symbols
in
comments.'
Description
:
'
Use
only
ascii
symbols
in
comments.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#english-comments'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#english-comments'
Enabled
:
fals
e
Enabled
:
tru
e
Style/AsciiIdentifiers
:
Style/AsciiIdentifiers
:
Description
:
'
Use
only
ascii
symbols
in
identifiers.'
Description
:
'
Use
only
ascii
symbols
in
identifiers.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#english-identifiers'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#english-identifiers'
Enabled
:
fals
e
Enabled
:
tru
e
Style/Attr
:
Style/Attr
:
Description
:
'
Checks
for
uses
of
Module#attr.'
Description
:
'
Checks
for
uses
of
Module#attr.'
...
@@ -60,7 +60,7 @@ Style/Attr:
...
@@ -60,7 +60,7 @@ Style/Attr:
Style/BeginBlock
:
Style/BeginBlock
:
Description
:
'
Avoid
the
use
of
BEGIN
blocks.'
Description
:
'
Avoid
the
use
of
BEGIN
blocks.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks'
Enabled
:
fals
e
Enabled
:
tru
e
Style/BarePercentLiterals
:
Style/BarePercentLiterals
:
Description
:
'
Checks
if
usage
of
%()
or
%Q()
matches
configuration.'
Description
:
'
Checks
if
usage
of
%()
or
%Q()
matches
configuration.'
...
@@ -74,7 +74,7 @@ Style/BlockComments:
...
@@ -74,7 +74,7 @@ Style/BlockComments:
Style/BlockEndNewline
:
Style/BlockEndNewline
:
Description
:
'
Put
end
statement
of
multiline
block
on
its
own
line.'
Description
:
'
Put
end
statement
of
multiline
block
on
its
own
line.'
Enabled
:
fals
e
Enabled
:
tru
e
Style/Blocks
:
Style/Blocks
:
Description
:
>-
Description
:
>-
...
@@ -82,7 +82,7 @@ Style/Blocks:
...
@@ -82,7 +82,7 @@ Style/Blocks:
always ugly).
always ugly).
Prefer {...} over do...end for single-line blocks.
Prefer {...} over do...end for single-line blocks.
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
Enabled
:
fals
e
Enabled
:
tru
e
Style/BracesAroundHashParameters
:
Style/BracesAroundHashParameters
:
Description
:
'
Enforce
braces
style
around
hash
parameters.'
Description
:
'
Enforce
braces
style
around
hash
parameters.'
...
@@ -96,17 +96,17 @@ Style/CaseEquality:
...
@@ -96,17 +96,17 @@ Style/CaseEquality:
Style/CaseIndentation
:
Style/CaseIndentation
:
Description
:
'
Indentation
of
when
in
a
case/when/[else/]end.'
Description
:
'
Indentation
of
when
in
a
case/when/[else/]end.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#indent-when-to-case'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#indent-when-to-case'
Enabled
:
fals
e
Enabled
:
tru
e
Style/CharacterLiteral
:
Style/CharacterLiteral
:
Description
:
'
Checks
for
uses
of
character
literals.'
Description
:
'
Checks
for
uses
of
character
literals.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-character-literals'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-character-literals'
Enabled
:
fals
e
Enabled
:
tru
e
Style/ClassAndModuleCamelCase
:
Style/ClassAndModuleCamelCase
:
Description
:
'
Use
CamelCase
for
classes
and
modules.'
Description
:
'
Use
CamelCase
for
classes
and
modules.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#camelcase-classes'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#camelcase-classes'
Enabled
:
fals
e
Enabled
:
tru
e
Style/ClassAndModuleChildren
:
Style/ClassAndModuleChildren
:
Description
:
'
Checks
style
of
children
classes
and
modules.'
Description
:
'
Checks
style
of
children
classes
and
modules.'
...
@@ -124,7 +124,7 @@ Style/ClassMethods:
...
@@ -124,7 +124,7 @@ Style/ClassMethods:
Style/ClassVars
:
Style/ClassVars
:
Description
:
'
Avoid
the
use
of
class
variables.'
Description
:
'
Avoid
the
use
of
class
variables.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-class-vars'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-class-vars'
Enabled
:
fals
e
Enabled
:
tru
e
Style/ColonMethodCall
:
Style/ColonMethodCall
:
Description
:
'
Do
not
use
::
for
method
call.'
Description
:
'
Do
not
use
::
for
method
call.'
...
@@ -140,12 +140,12 @@ Style/CommentAnnotation:
...
@@ -140,12 +140,12 @@ Style/CommentAnnotation:
Style/CommentIndentation
:
Style/CommentIndentation
:
Description
:
'
Indentation
of
comments.'
Description
:
'
Indentation
of
comments.'
Enabled
:
fals
e
Enabled
:
tru
e
Style/ConstantName
:
Style/ConstantName
:
Description
:
'
Constants
should
use
SCREAMING_SNAKE_CASE.'
Description
:
'
Constants
should
use
SCREAMING_SNAKE_CASE.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#screaming-snake-case'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#screaming-snake-case'
Enabled
:
fals
e
Enabled
:
tru
e
Style/DefWithParentheses
:
Style/DefWithParentheses
:
Description
:
'
Use
def
with
parentheses
when
there
are
arguments.'
Description
:
'
Use
def
with
parentheses
when
there
are
arguments.'
...
@@ -177,7 +177,7 @@ Style/EachWithObject:
...
@@ -177,7 +177,7 @@ Style/EachWithObject:
Style/ElseAlignment
:
Style/ElseAlignment
:
Description
:
'
Align
elses
and
elsifs
correctly.'
Description
:
'
Align
elses
and
elsifs
correctly.'
Enabled
:
fals
e
Enabled
:
tru
e
Style/EmptyElse
:
Style/EmptyElse
:
Description
:
'
Avoid
empty
else-clauses.'
Description
:
'
Avoid
empty
else-clauses.'
...
@@ -283,12 +283,12 @@ Style/IfWithSemicolon:
...
@@ -283,12 +283,12 @@ Style/IfWithSemicolon:
Style/IndentationConsistency
:
Style/IndentationConsistency
:
Description
:
'
Keep
indentation
straight.'
Description
:
'
Keep
indentation
straight.'
Enabled
:
fals
e
Enabled
:
tru
e
Style/IndentationWidth
:
Style/IndentationWidth
:
Description
:
'
Use
2
spaces
for
indentation.'
Description
:
'
Use
2
spaces
for
indentation.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
Enabled
:
fals
e
Enabled
:
tru
e
Style/IndentArray
:
Style/IndentArray
:
Description
:
>-
Description
:
>-
...
@@ -657,7 +657,7 @@ Style/Tab:
...
@@ -657,7 +657,7 @@ Style/Tab:
Style/TrailingBlankLines
:
Style/TrailingBlankLines
:
Description
:
'
Checks
trailing
blank
lines
and
final
newline.'
Description
:
'
Checks
trailing
blank
lines
and
final
newline.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#newline-eof'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#newline-eof'
Enabled
:
fals
e
Enabled
:
tru
e
Style/TrailingComma
:
Style/TrailingComma
:
Description
:
'
Checks
for
trailing
comma
in
parameter
lists
and
literals.'
Description
:
'
Checks
for
trailing
comma
in
parameter
lists
and
literals.'
...
@@ -909,7 +909,7 @@ Lint/StringConversionInInterpolation:
...
@@ -909,7 +909,7 @@ Lint/StringConversionInInterpolation:
Lint/UnderscorePrefixedVariableName
:
Lint/UnderscorePrefixedVariableName
:
Description
:
'
Do
not
use
prefix
`_`
for
a
variable
that
is
used.'
Description
:
'
Do
not
use
prefix
`_`
for
a
variable
that
is
used.'
Enabled
:
fals
e
Enabled
:
tru
e
Lint/UnusedBlockArgument
:
Lint/UnusedBlockArgument
:
Description
:
'
Checks
for
unused
block
arguments.'
Description
:
'
Checks
for
unused
block
arguments.'
...
@@ -966,11 +966,11 @@ Rails/Delegate:
...
@@ -966,11 +966,11 @@ Rails/Delegate:
Rails/HasAndBelongsToMany
:
Rails/HasAndBelongsToMany
:
Description
:
'
Prefer
has_many
:through
to
has_and_belongs_to_many.'
Description
:
'
Prefer
has_many
:through
to
has_and_belongs_to_many.'
Enabled
:
fals
e
Enabled
:
tru
e
Rails/Output
:
Rails/Output
:
Description
:
'
Checks
for
calls
to
puts,
print,
etc.'
Description
:
'
Checks
for
calls
to
puts,
print,
etc.'
Enabled
:
fals
e
Enabled
:
tru
e
Rails/ReadWriteAttribute
:
Rails/ReadWriteAttribute
:
Description
:
>-
Description
:
>-
...
@@ -991,6 +991,7 @@ Rails/Validation:
...
@@ -991,6 +991,7 @@ Rails/Validation:
#
#
#
#
AllCops
:
AllCops
:
RunRailsCops
:
true
Exclude
:
Exclude
:
-
'
spec/**/*'
-
'
spec/**/*'
-
'
features/**/*'
-
'
features/**/*'
...
@@ -1000,3 +1001,6 @@ AllCops:
...
@@ -1000,3 +1001,6 @@ AllCops:
-
'
bin/**/*'
-
'
bin/**/*'
-
'
lib/backup/**/*'
-
'
lib/backup/**/*'
-
'
lib/tasks/**/*'
-
'
lib/tasks/**/*'
-
'
lib/email_validator.rb'
-
'
lib/gitlab/upgrader.rb'
-
'
lib/gitlab/seeder.rb'
app/controllers/namespaces_controller.rb
View file @
863f3873
...
@@ -15,4 +15,3 @@ class NamespacesController < ApplicationController
...
@@ -15,4 +15,3 @@ class NamespacesController < ApplicationController
end
end
end
end
end
end
app/controllers/projects/blob_controller.rb
View file @
863f3873
...
@@ -59,8 +59,7 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -59,8 +59,7 @@ class Projects::BlobController < Projects::ApplicationController
def
preview
def
preview
@content
=
params
[
:content
]
@content
=
params
[
:content
]
diffy
=
Diffy
::
Diff
.
new
(
@blob
.
data
,
@content
,
diff:
'-U 3'
,
diffy
=
Diffy
::
Diff
.
new
(
@blob
.
data
,
@content
,
diff:
'-U 3'
,
include_diff_info:
true
)
include_diff_info:
true
)
@diff_lines
=
Gitlab
::
Diff
::
Parser
.
new
.
parse
(
diffy
.
diff
.
scan
(
/.*\n/
))
@diff_lines
=
Gitlab
::
Diff
::
Parser
.
new
.
parse
(
diffy
.
diff
.
scan
(
/.*\n/
))
render
layout:
false
render
layout:
false
...
...
app/controllers/projects/raw_controller.rb
View file @
863f3873
...
@@ -35,4 +35,3 @@ class Projects::RawController < Projects::ApplicationController
...
@@ -35,4 +35,3 @@ class Projects::RawController < Projects::ApplicationController
end
end
end
end
end
end
app/controllers/projects/refs_controller.rb
View file @
863f3873
app/controllers/projects/wikis_controller.rb
View file @
863f3873
app/finders/notes_finder.rb
View file @
863f3873
...
@@ -7,7 +7,8 @@ class NotesFinder
...
@@ -7,7 +7,8 @@ class NotesFinder
# Default to 0 to remain compatible with old clients
# Default to 0 to remain compatible with old clients
last_fetched_at
=
Time
.
at
(
params
.
fetch
(
:last_fetched_at
,
0
).
to_i
)
last_fetched_at
=
Time
.
at
(
params
.
fetch
(
:last_fetched_at
,
0
).
to_i
)
notes
=
case
target_type
notes
=
case
target_type
when
"commit"
when
"commit"
project
.
notes
.
for_commit_id
(
target_id
).
not_inline
.
fresh
project
.
notes
.
for_commit_id
(
target_id
).
not_inline
.
fresh
when
"issue"
when
"issue"
...
...
app/finders/snippets_finder.rb
View file @
863f3873
app/helpers/application_helper.rb
View file @
863f3873
...
@@ -75,9 +75,9 @@ module ApplicationHelper
...
@@ -75,9 +75,9 @@ module ApplicationHelper
options
[
:class
]
||=
''
options
[
:class
]
||=
''
options
[
:class
]
<<
' identicon'
options
[
:class
]
<<
' identicon'
bg_key
=
project
.
id
%
7
bg_key
=
project
.
id
%
7
style
=
"background-color: #
#{
allowed_colors
.
values
[
bg_key
]
}
; color: #555"
content_tag
(
:div
,
class:
options
[
:class
],
content_tag
(
:div
,
class:
options
[
:class
],
style:
style
)
do
style:
"background-color: #
#{
allowed_colors
.
values
[
bg_key
]
}
; color: #555"
)
do
project
.
name
[
0
,
1
].
upcase
project
.
name
[
0
,
1
].
upcase
end
end
end
end
...
...
app/helpers/commits_helper.rb
View file @
863f3873
...
@@ -112,7 +112,8 @@ module CommitsHelper
...
@@ -112,7 +112,8 @@ module CommitsHelper
person_name
=
user
.
nil?
?
source_name
:
user
.
name
person_name
=
user
.
nil?
?
source_name
:
user
.
name
person_email
=
user
.
nil?
?
source_email
:
user
.
email
person_email
=
user
.
nil?
?
source_email
:
user
.
email
text
=
if
options
[
:avatar
]
text
=
if
options
[
:avatar
]
avatar
=
image_tag
(
avatar_icon
(
person_email
,
options
[
:size
]),
class:
"avatar
#{
"s
#{
options
[
:size
]
}
"
if
options
[
:size
]
}
"
,
width:
options
[
:size
],
alt:
""
)
avatar
=
image_tag
(
avatar_icon
(
person_email
,
options
[
:size
]),
class:
"avatar
#{
"s
#{
options
[
:size
]
}
"
if
options
[
:size
]
}
"
,
width:
options
[
:size
],
alt:
""
)
%Q{
#{
avatar
}
<span class="commit-
#{
options
[
:source
]
}
-name">
#{
person_name
}
</span>}
%Q{
#{
avatar
}
<span class="commit-
#{
options
[
:source
]
}
-name">
#{
person_name
}
</span>}
else
else
...
...
app/helpers/notes_helper.rb
View file @
863f3873
app/helpers/projects_helper.rb
View file @
863f3873
...
@@ -254,4 +254,3 @@ module ProjectsHelper
...
@@ -254,4 +254,3 @@ module ProjectsHelper
enabled_oauth_providers
.
include?
(
:github
)
enabled_oauth_providers
.
include?
(
:github
)
end
end
end
end
app/helpers/tab_helper.rb
View file @
863f3873
app/models/application_setting.rb
View file @
863f3873
...
@@ -14,7 +14,8 @@
...
@@ -14,7 +14,8 @@
#
#
class
ApplicationSetting
<
ActiveRecord
::
Base
class
ApplicationSetting
<
ActiveRecord
::
Base
validates
:home_page_url
,
allow_blank:
true
,
validates
:home_page_url
,
allow_blank:
true
,
format:
{
with:
URI
::
regexp
(
%w(http https)
),
message:
"should be a valid url"
},
format:
{
with:
URI
::
regexp
(
%w(http https)
),
message:
"should be a valid url"
},
if: :home_page_url_column_exist
if: :home_page_url_column_exist
...
...
app/models/commit.rb
View file @
863f3873
...
@@ -88,7 +88,8 @@ class Commit
...
@@ -88,7 +88,8 @@ class Commit
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
def
description
def
description
title_end
=
safe_message
.
index
(
"
\n
"
)
title_end
=
safe_message
.
index
(
"
\n
"
)
@description
||=
if
(
!
title_end
&&
safe_message
.
length
>
100
)
||
(
title_end
&&
title_end
>
100
)
@description
||=
if
(
!
title_end
&&
safe_message
.
length
>
100
)
||
(
title_end
&&
title_end
>
100
)
"…"
.
html_safe
<<
safe_message
[
80
..-
1
]
"…"
.
html_safe
<<
safe_message
[
80
..-
1
]
else
else
safe_message
.
split
(
"
\n
"
,
2
)[
1
].
try
(
:chomp
)
safe_message
.
split
(
"
\n
"
,
2
)[
1
].
try
(
:chomp
)
...
...
app/models/namespace.rb
View file @
863f3873
...
@@ -20,12 +20,17 @@ class Namespace < ActiveRecord::Base
...
@@ -20,12 +20,17 @@ class Namespace < ActiveRecord::Base
belongs_to
:owner
,
class_name:
"User"
belongs_to
:owner
,
class_name:
"User"
validates
:owner
,
presence:
true
,
unless:
->
(
n
)
{
n
.
type
==
"Group"
}
validates
:owner
,
presence:
true
,
unless:
->
(
n
)
{
n
.
type
==
"Group"
}
validates
:name
,
presence:
true
,
uniqueness:
true
,
validates
:name
,
presence:
true
,
uniqueness:
true
,
length:
{
within:
0
..
255
},
length:
{
within:
0
..
255
},
format:
{
with:
Gitlab
::
Regex
.
name_regex
,
format:
{
with:
Gitlab
::
Regex
.
name_regex
,
message:
Gitlab
::
Regex
.
name_regex_message
}
message:
Gitlab
::
Regex
.
name_regex_message
}
validates
:description
,
length:
{
within:
0
..
255
}
validates
:description
,
length:
{
within:
0
..
255
}
validates
:path
,
uniqueness:
{
case_sensitive:
false
},
presence:
true
,
length:
{
within:
1
..
255
},
validates
:path
,
uniqueness:
{
case_sensitive:
false
},
presence:
true
,
length:
{
within:
1
..
255
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
format:
{
with:
Gitlab
::
Regex
.
path_regex
,
format:
{
with:
Gitlab
::
Regex
.
path_regex
,
message:
Gitlab
::
Regex
.
path_regex_message
}
message:
Gitlab
::
Regex
.
path_regex_message
}
...
...
app/models/project.rb
View file @
863f3873
...
@@ -108,10 +108,14 @@ class Project < ActiveRecord::Base
...
@@ -108,10 +108,14 @@ class Project < ActiveRecord::Base
# Validations
# Validations
validates
:creator
,
presence:
true
,
on: :create
validates
:creator
,
presence:
true
,
on: :create
validates
:description
,
length:
{
maximum:
2000
},
allow_blank:
true
validates
:description
,
length:
{
maximum:
2000
},
allow_blank:
true
validates
:name
,
presence:
true
,
length:
{
within:
0
..
255
},
validates
:name
,
presence:
true
,
length:
{
within:
0
..
255
},
format:
{
with:
Gitlab
::
Regex
.
project_name_regex
,
format:
{
with:
Gitlab
::
Regex
.
project_name_regex
,
message:
Gitlab
::
Regex
.
project_regex_message
}
message:
Gitlab
::
Regex
.
project_regex_message
}
validates
:path
,
presence:
true
,
length:
{
within:
0
..
255
},
validates
:path
,
presence:
true
,
length:
{
within:
0
..
255
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
format:
{
with:
Gitlab
::
Regex
.
path_regex
,
format:
{
with:
Gitlab
::
Regex
.
path_regex
,
message:
Gitlab
::
Regex
.
path_regex_message
}
message:
Gitlab
::
Regex
.
path_regex_message
}
...
...
app/models/project_services/bamboo_service.rb
View file @
863f3873
...
@@ -17,13 +17,19 @@ class BambooService < CiService
...
@@ -17,13 +17,19 @@ class BambooService < CiService
prop_accessor
:bamboo_url
,
:build_key
,
:username
,
:password
prop_accessor
:bamboo_url
,
:build_key
,
:username
,
:password
validates
:bamboo_url
,
presence:
true
,
validates
:bamboo_url
,
format:
{
with:
URI
::
regexp
},
if: :activated?
presence:
true
,
format:
{
with:
URI
::
regexp
},
if: :activated?
validates
:build_key
,
presence:
true
,
if: :activated?
validates
:build_key
,
presence:
true
,
if: :activated?
validates
:username
,
presence:
true
,
validates
:username
,
if:
->
(
service
)
{
service
.
password?
},
if: :activated?
presence:
true
,
validates
:password
,
presence:
true
,
if:
->
(
service
)
{
service
.
password?
},
if:
->
(
service
)
{
service
.
username?
},
if: :activated?
if: :activated?
validates
:password
,
presence:
true
,
if:
->
(
service
)
{
service
.
username?
},
if: :activated?
attr_accessor
:response
attr_accessor
:response
...
...
app/models/project_services/teamcity_service.rb
View file @
863f3873
...
@@ -17,12 +17,15 @@ class TeamcityService < CiService
...
@@ -17,12 +17,15 @@ class TeamcityService < CiService
prop_accessor
:teamcity_url
,
:build_type
,
:username
,
:password
prop_accessor
:teamcity_url
,
:build_type
,
:username
,
:password
validates
:teamcity_url
,
presence:
true
,
validates
:teamcity_url
,
presence:
true
,
format:
{
with:
URI
::
regexp
},
if: :activated?
format:
{
with:
URI
::
regexp
},
if: :activated?
validates
:build_type
,
presence:
true
,
if: :activated?
validates
:build_type
,
presence:
true
,
if: :activated?
validates
:username
,
presence:
true
,
validates
:username
,
presence:
true
,
if:
->
(
service
)
{
service
.
password?
},
if: :activated?
if:
->
(
service
)
{
service
.
password?
},
if: :activated?
validates
:password
,
presence:
true
,
validates
:password
,
presence:
true
,
if:
->
(
service
)
{
service
.
username?
},
if: :activated?
if:
->
(
service
)
{
service
.
username?
},
if: :activated?
attr_accessor
:response
attr_accessor
:response
...
...
app/models/snippet.rb
View file @
863f3873
...
@@ -29,7 +29,9 @@ class Snippet < ActiveRecord::Base
...
@@ -29,7 +29,9 @@ class Snippet < ActiveRecord::Base
validates
:author
,
presence:
true
validates
:author
,
presence:
true
validates
:title
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:title
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:file_name
,
presence:
true
,
length:
{
within:
0
..
255
},
validates
:file_name
,
presence:
true
,
length:
{
within:
0
..
255
},
format:
{
with:
Gitlab
::
Regex
.
path_regex
,
format:
{
with:
Gitlab
::
Regex
.
path_regex
,
message:
Gitlab
::
Regex
.
path_regex_message
}
message:
Gitlab
::
Regex
.
path_regex_message
}
validates
:content
,
presence:
true
validates
:content
,
presence:
true
...
...
app/models/user.rb
View file @
863f3873
...
@@ -116,7 +116,9 @@ class User < ActiveRecord::Base
...
@@ -116,7 +116,9 @@ class User < ActiveRecord::Base
validates
:email
,
presence:
true
,
email:
{
strict_mode:
true
},
uniqueness:
true
validates
:email
,
presence:
true
,
email:
{
strict_mode:
true
},
uniqueness:
true
validates
:bio
,
length:
{
maximum:
255
},
allow_blank:
true
validates
:bio
,
length:
{
maximum:
255
},
allow_blank:
true
validates
:projects_limit
,
presence:
true
,
numericality:
{
greater_than_or_equal_to:
0
}
validates
:projects_limit
,
presence:
true
,
numericality:
{
greater_than_or_equal_to:
0
}
validates
:username
,
presence:
true
,
uniqueness:
{
case_sensitive:
false
},
validates
:username
,
presence:
true
,
uniqueness:
{
case_sensitive:
false
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
format:
{
with:
Gitlab
::
Regex
.
username_regex
,
format:
{
with:
Gitlab
::
Regex
.
username_regex
,
message:
Gitlab
::
Regex
.
username_regex_message
}
message:
Gitlab
::
Regex
.
username_regex_message
}
...
...
app/models/wiki_page.rb
View file @
863f3873
...
@@ -43,7 +43,7 @@ class WikiPage
...
@@ -43,7 +43,7 @@ class WikiPage
@attributes
[
:slug
]
@attributes
[
:slug
]
end
end
alias
:to_param
:slug
alias
_method
:to_param
,
:slug
# The formatted title of this page.
# The formatted title of this page.
def
title
def
title
...
...
app/services/oauth2/access_token_validation_service.rb
View file @
863f3873
app/services/projects/image_service.rb
View file @
863f3873
app/services/projects/participants_service.rb
View file @
863f3873
...
@@ -5,7 +5,8 @@ module Projects
...
@@ -5,7 +5,8 @@ module Projects
end
end
def
execute
(
note_type
,
note_id
)
def
execute
(
note_type
,
note_id
)
participating
=
if
note_type
&&
note_id
participating
=
if
note_type
&&
note_id
participants_in
(
note_type
,
note_id
)
participants_in
(
note_type
,
note_id
)
else
else
[]
[]
...
...
config/initializers/7_omniauth.rb
View file @
863f3873
config/initializers/acts_as_taggable_on_patch.rb
View file @
863f3873
...
@@ -42,7 +42,8 @@ module ActsAsTaggableOn::Taggable
...
@@ -42,7 +42,8 @@ module ActsAsTaggableOn::Taggable
elsif
options
.
delete
(
:any
)
elsif
options
.
delete
(
:any
)
# get tags, drop out if nothing returned (we need at least one)
# get tags, drop out if nothing returned (we need at least one)
tags
=
if
options
.
delete
(
:wild
)
tags
=
if
options
.
delete
(
:wild
)
ActsAsTaggableOn
::
Tag
.
named_like_any
(
tag_list
)
ActsAsTaggableOn
::
Tag
.
named_like_any
(
tag_list
)
else
else
ActsAsTaggableOn
::
Tag
.
named_any
(
tag_list
)
ActsAsTaggableOn
::
Tag
.
named_any
(
tag_list
)
...
...
config/initializers/carrierwave.rb
View file @
863f3873
...
@@ -12,11 +12,19 @@ if File.exists?(aws_file)
...
@@ -12,11 +12,19 @@ if File.exists?(aws_file)
aws_secret_access_key:
AWS_CONFIG
[
'secret_access_key'
],
# required
aws_secret_access_key:
AWS_CONFIG
[
'secret_access_key'
],
# required
region:
AWS_CONFIG
[
'region'
],
# optional, defaults to 'us-east-1'
region:
AWS_CONFIG
[
'region'
],
# optional, defaults to 'us-east-1'
}
}
config
.
fog_directory
=
AWS_CONFIG
[
'bucket'
]
# required
config
.
fog_public
=
false
# optional, defaults to true
# required
config
.
fog_attributes
=
{
'Cache-Control'
=>
'max-age=315576000'
}
# optional, defaults to {}
config
.
fog_directory
=
AWS_CONFIG
[
'bucket'
]
config
.
fog_authenticated_url_expiration
=
1
<<
29
# optional time (in seconds) that authenticated urls will be valid.
# optional, defaults to true
config
.
fog_public
=
false
# optional, defaults to {}
config
.
fog_attributes
=
{
'Cache-Control'
=>
'max-age=315576000'
}
# optional time (in seconds) that authenticated urls will be valid.
# when fog_public is false and provider is AWS or Google, defaults to 600
# when fog_public is false and provider is AWS or Google, defaults to 600
config
.
fog_authenticated_url_expiration
=
1
<<
29
end
end
# Mocking Fog requests, based on: https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Test-Fog-based-uploaders
# Mocking Fog requests, based on: https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Test-Fog-based-uploaders
...
...
config/initializers/gitlab_shell_secret_token.rb
View file @
863f3873
config/routes.rb
View file @
863f3873
...
@@ -294,9 +294,7 @@ Gitlab::Application.routes.draw do
...
@@ -294,9 +294,7 @@ Gitlab::Application.routes.draw do
member
do
member
do
# tree viewer logs
# tree viewer logs
get
'logs_tree'
,
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
get
'logs_tree'
,
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
}
get
'logs_tree/:path'
=>
'refs#logs_tree'
,
get
'logs_tree/:path'
=>
'refs#logs_tree'
,
as: :logs_file
,
constraints:
{
as: :logs_file
,
constraints:
{
id:
Gitlab
::
Regex
.
git_reference_regex
,
id:
Gitlab
::
Regex
.
git_reference_regex
,
path:
/.*/
path:
/.*/
}
}
...
...
lib/api/api_guard.rb
View file @
863f3873
...
@@ -47,16 +47,12 @@ module APIGuard
...
@@ -47,16 +47,12 @@ module APIGuard
case
validate_access_token
(
access_token
,
scopes
)
case
validate_access_token
(
access_token
,
scopes
)
when
Oauth2
::
AccessTokenValidationService
::
INSUFFICIENT_SCOPE
when
Oauth2
::
AccessTokenValidationService
::
INSUFFICIENT_SCOPE
raise
InsufficientScopeError
.
new
(
scopes
)
raise
InsufficientScopeError
.
new
(
scopes
)
when
Oauth2
::
AccessTokenValidationService
::
EXPIRED
when
Oauth2
::
AccessTokenValidationService
::
EXPIRED
raise
ExpiredError
raise
ExpiredError
when
Oauth2
::
AccessTokenValidationService
::
REVOKED
when
Oauth2
::
AccessTokenValidationService
::
REVOKED
raise
RevokedError
raise
RevokedError
when
Oauth2
::
AccessTokenValidationService
::
VALID
when
Oauth2
::
AccessTokenValidationService
::
VALID
@current_user
=
User
.
find
(
access_token
.
resource_owner_id
)
@current_user
=
User
.
find
(
access_token
.
resource_owner_id
)
end
end
end
end
end
end
...
@@ -120,8 +116,9 @@ module APIGuard
...
@@ -120,8 +116,9 @@ module APIGuard
end
end
def
oauth2_bearer_token_error_handler
def
oauth2_bearer_token_error_handler
Proc
.
new
{
|
e
|
Proc
.
new
do
|
e
|
response
=
case
e
response
=
case
e
when
MissingTokenError
when
MissingTokenError
Rack
::
OAuth2
::
Server
::
Resource
::
Bearer
::
Unauthorized
.
new
Rack
::
OAuth2
::
Server
::
Resource
::
Bearer
::
Unauthorized
.
new
...
@@ -150,7 +147,7 @@ module APIGuard
...
@@ -150,7 +147,7 @@ module APIGuard
end
end
response
.
finish
response
.
finish
}
end
end
end
end
end
...
...
lib/api/internal.rb
View file @
863f3873
module
API
module
API
# Internal access API
# Internal access API
class
Internal
<
Grape
::
API
class
Internal
<
Grape
::
API
before
{
before
{
authenticate_by_gitlab_shell_token!
}
authenticate_by_gitlab_shell_token!
}
namespace
'internal'
do
namespace
'internal'
do
# Check if git command is allowed to project
# Check if git command is allowed to project
...
...
lib/api/namespaces.rb
View file @
863f3873
module
API
module
API
# namespaces API
# namespaces API
class
Namespaces
<
Grape
::
API
class
Namespaces
<
Grape
::
API
before
{
before
do
authenticate!
authenticate!
authenticated_as_admin!
authenticated_as_admin!
}
end
resource
:namespaces
do
resource
:namespaces
do
# Get a namespaces list
# Get a namespaces list
...
...
lib/api/system_hooks.rb
View file @
863f3873
module
API
module
API
# Hooks API
# Hooks API
class
SystemHooks
<
Grape
::
API
class
SystemHooks
<
Grape
::
API
before
{
before
do
authenticate!
authenticate!
authenticated_as_admin!
authenticated_as_admin!
}
end
resource
:hooks
do
resource
:hooks
do
# Get the list of system hooks
# Get the list of system hooks
...
...
lib/email_validator.rb
View file @
863f3873
lib/gitlab/backend/shell_adapter.rb
View file @
863f3873
...
@@ -9,4 +9,3 @@ module Gitlab
...
@@ -9,4 +9,3 @@ module Gitlab
end
end
end
end
end
end
lib/gitlab/diff/parser.rb
View file @
863f3873
...
@@ -4,7 +4,7 @@ module Gitlab
...
@@ -4,7 +4,7 @@ module Gitlab
include
Enumerable
include
Enumerable
def
parse
(
lines
)
def
parse
(
lines
)
@lines
=
lines
,
@lines
=
lines
lines_obj
=
[]
lines_obj
=
[]
line_obj_index
=
0
line_obj_index
=
0
line_old
=
1
line_old
=
1
...
...
lib/gitlab/force_push_check.rb
View file @
863f3873
...
@@ -12,4 +12,3 @@ module Gitlab
...
@@ -12,4 +12,3 @@ module Gitlab
end
end
end
end
end
end
lib/gitlab/git_access.rb
View file @
863f3873
...
@@ -113,8 +113,8 @@ module Gitlab
...
@@ -113,8 +113,8 @@ module Gitlab
# we dont allow force push to protected branch
# we dont allow force push to protected branch
if
forced_push?
(
project
,
oldrev
,
newrev
)
if
forced_push?
(
project
,
oldrev
,
newrev
)
:force_push_code_to_protected_branches
:force_push_code_to_protected_branches
# and we dont allow remove of protected branch
elsif
newrev
==
Gitlab
::
Git
::
BLANK_SHA
elsif
newrev
==
Gitlab
::
Git
::
BLANK_SHA
# and we dont allow remove of protected branch
:remove_protected_branches
:remove_protected_branches
elsif
project
.
developers_can_push_to_protected_branch?
(
branch_name
)
elsif
project
.
developers_can_push_to_protected_branch?
(
branch_name
)
:push_code
:push_code
...
...
lib/gitlab/ldap/adapter.rb
View file @
863f3873
...
@@ -63,8 +63,10 @@ module Gitlab
...
@@ -63,8 +63,10 @@ module Gitlab
end
end
def
dn_matches_filter?
(
dn
,
filter
)
def
dn_matches_filter?
(
dn
,
filter
)
ldap_search
(
base:
dn
,
filter:
filter
,
ldap_search
(
base:
dn
,
scope:
Net
::
LDAP
::
SearchScope_BaseObject
,
attributes:
%w{dn}
).
any?
filter:
filter
,
scope:
Net
::
LDAP
::
SearchScope_BaseObject
,
attributes:
%w{dn}
).
any?
end
end
def
ldap_search
(
*
args
)
def
ldap_search
(
*
args
)
...
...
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