Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
nexedi
gitlab-shell
Commits
8f9046aa
Commit
8f9046aa
authored
Feb 22, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update rubocop and code to pass it
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
9850a74b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
48 deletions
+38
-48
.rubocop.yml
.rubocop.yml
+8
-20
Gemfile
Gemfile
+4
-4
hooks/post-receive
hooks/post-receive
+1
-1
lib/gitlab_keys.rb
lib/gitlab_keys.rb
+2
-2
lib/gitlab_net.rb
lib/gitlab_net.rb
+8
-8
lib/gitlab_post_receive.rb
lib/gitlab_post_receive.rb
+9
-7
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+2
-2
lib/httpunix.rb
lib/httpunix.rb
+1
-1
support/go_build.rb
support/go_build.rb
+3
-3
No files found.
.rubocop.yml
View file @
8f9046aa
...
...
@@ -76,14 +76,6 @@ Style/BlockEndNewline:
Description
:
'
Put
end
statement
of
multiline
block
on
its
own
line.'
Enabled
:
true
Style/Blocks
:
Description
:
>-
Avoid using {...} for multi-line blocks (multiline chaining is
always ugly).
Prefer {...} over do...end for single-line blocks.
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
Enabled
:
true
Style/BracesAroundHashParameters
:
Description
:
'
Enforce
braces
style
around
hash
parameters.'
Enabled
:
false
...
...
@@ -152,7 +144,7 @@ Style/DefWithParentheses:
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#method-parens'
Enabled
:
false
Style/
Deprecat
edHashMethods
:
Style/
Preferr
edHashMethods
:
Description
:
'
Checks
for
use
of
deprecated
Hash
methods.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#hash-key'
Enabled
:
false
...
...
@@ -326,7 +318,7 @@ Style/LineEndConcatenation:
line end.
Enabled
:
false
Style/MethodCallParentheses
:
Style/MethodCall
WithoutArgs
Parentheses
:
Description
:
'
Do
not
use
parentheses
for
method
calls
with
no
arguments.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
Enabled
:
false
...
...
@@ -528,7 +520,7 @@ Style/SingleLineMethods:
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
Enabled
:
false
Style/Single
SpaceBeforeFirstArg
:
Layout/
SpaceBeforeFirstArg
:
Description
:
>-
Checks that exactly one space is used between a method name
and the first argument for method calls without parentheses.
...
...
@@ -544,7 +536,7 @@ Style/SpaceAfterComma:
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#spaces-operators'
Enabled
:
false
Style/SpaceAfterControl
Keyword
:
Layout/SpaceAround
Keyword
:
Description
:
'
Use
spaces
after
if/elsif/unless/while/until/case/when.'
Enabled
:
false
...
...
@@ -605,7 +597,7 @@ Style/SpaceAroundOperators:
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#spaces-operators'
Enabled
:
false
Style/SpaceBeforeModifier
Keyword
:
Layout/SpaceAround
Keyword
:
Description
:
'
Put
a
space
before
the
modifier
keyword.'
Enabled
:
false
...
...
@@ -659,7 +651,7 @@ Style/TrailingBlankLines:
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#newline-eof'
Enabled
:
true
Style/TrailingComma
:
Style/TrailingComma
InLiteral
:
Description
:
'
Checks
for
trailing
comma
in
parameter
lists
and
literals.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
Enabled
:
false
...
...
@@ -690,11 +682,6 @@ Style/UnneededPercentQ:
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#percent-q'
Enabled
:
false
Style/UnneededPercentX
:
Description
:
'
Checks
for
%x
when
``
would
do.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#percent-x'
Enabled
:
false
Style/VariableInterpolation
:
Description
:
>-
Don't interpolate global, instance and class variables
...
...
@@ -896,7 +883,7 @@ Lint/ShadowingOuterLocalVariable:
for block arguments or block local variables.
Enabled
:
false
L
in
t/SpaceBeforeFirstArg
:
L
ayou
t/SpaceBeforeFirstArg
:
Description
:
>-
Put a space between a method name and the first argument
in a method call without parentheses.
...
...
@@ -968,3 +955,4 @@ AllCops:
-
'
lib/gitlab/upgrader.rb'
-
'
lib/gitlab/seeder.rb'
-
'
lib/vendor/**/*'
-
'
Guardfile'
Gemfile
View file @
8f9046aa
source
"
http://rubygems.org
"
group
:development
,
:test
do
gem
'
simplecov
'
,
require:
false
gem
'
rspec
'
,
'~> 2.14.0'
gem
'
webmock
'
gem
'
guard
'
gem
'
guard-rspec
'
gem
'
vcr
'
gem
'
rspec
'
,
'~> 2.14.0
'
gem
'
rubocop
'
,
'0.49.1'
,
require:
false
gem
'
simplecov
'
,
require:
false
gem
'
vcr
'
gem
'
webmock
'
end
hooks/post-receive
View file @
8f9046aa
...
...
@@ -4,7 +4,7 @@
# will be processed properly.
refs
=
$stdin
.
read
key_id
=
ENV
.
delete
(
'GL_ID'
)
key_id
=
ENV
.
delete
(
'GL_ID'
)
gl_repository
=
ENV
.
delete
(
'GL_REPOSITORY'
)
repo_path
=
Dir
.
pwd
...
...
lib/gitlab_keys.rb
View file @
8f9046aa
...
...
@@ -157,8 +157,8 @@ class GitlabKeys
end
def
open_auth_file
(
mode
)
open
(
auth_file
,
mode
,
0600
)
do
|
file
|
file
.
chmod
(
0600
)
open
(
auth_file
,
mode
,
0
o
600
)
do
|
file
|
file
.
chmod
(
0
o
600
)
yield
file
end
end
...
...
lib/gitlab_net.rb
View file @
8f9046aa
...
...
@@ -28,9 +28,9 @@ class GitlabNet
}
if
actor
=~
/\Akey\-\d+\Z/
params
.
merge!
(
key_id:
actor
.
gsub
(
"key-"
,
""
)
)
params
[
:key_id
]
=
actor
.
gsub
(
"key-"
,
""
)
elsif
actor
=~
/\Auser\-\d+\Z/
params
.
merge!
(
user_id:
actor
.
gsub
(
"user-"
,
""
)
)
params
[
:user_id
]
=
actor
.
gsub
(
"user-"
,
""
)
end
url
=
"
#{
host
}
/allowed"
...
...
@@ -141,7 +141,7 @@ class GitlabNet
protected
def
sanitize_path
(
repo
)
repo
.
gsub
(
"'"
,
"
"
)
repo
.
delete
(
"'
"
)
end
def
config
...
...
@@ -153,11 +153,11 @@ class GitlabNet
end
def
http_client_for
(
uri
,
options
=
{})
if
uri
.
is_a?
(
URI
::
HTTPUNIX
)
http
=
Net
::
HTTPUNIX
.
new
(
uri
.
hostname
)
else
http
=
Net
::
HTTP
.
new
(
uri
.
host
,
uri
.
port
)
end
http
=
if
uri
.
is_a?
(
URI
::
HTTPUNIX
)
Net
::
HTTPUNIX
.
new
(
uri
.
hostname
)
else
Net
::
HTTP
.
new
(
uri
.
host
,
uri
.
port
)
end
http
.
read_timeout
=
options
[
:read_timeout
]
||
read_timeout
...
...
lib/gitlab_post_receive.rb
View file @
8f9046aa
...
...
@@ -13,7 +13,8 @@ class GitlabPostReceive
def
initialize
(
gl_repository
,
repo_path
,
actor
,
changes
)
@config
=
GitlabConfig
.
new
@gl_repository
=
gl_repository
@repo_path
,
@actor
=
repo_path
.
strip
,
actor
@repo_path
=
repo_path
.
strip
@actor
=
actor
@changes
=
changes
@jid
=
SecureRandom
.
hex
(
12
)
end
...
...
@@ -47,11 +48,12 @@ class GitlabPostReceive
end
def
print_merge_request_link
(
merge_request
)
if
merge_request
[
"new_merge_request"
]
message
=
"To create a merge request for
#{
merge_request
[
"branch_name"
]
}
, visit:"
else
message
=
"View merge request for
#{
merge_request
[
"branch_name"
]
}
:"
end
message
=
if
merge_request
[
"new_merge_request"
]
"To create a merge request for
#{
merge_request
[
"branch_name"
]
}
, visit:"
else
"View merge request for
#{
merge_request
[
"branch_name"
]
}
:"
end
puts
message
puts
((
" "
*
2
)
+
merge_request
[
"url"
])
...
...
@@ -64,7 +66,7 @@ class GitlabPostReceive
# Git prefixes remote messages with "remote: ", so this width is subtracted
# from the width available to us.
total_width
-=
"remote: "
.
length
total_width
-=
"remote: "
.
length
# rubocop:disable Performance/FixedSize
# Our centered text shouldn't start or end right at the edge of the window,
# so we add some horizontal padding: 2 chars on either side.
...
...
lib/gitlab_shell.rb
View file @
8f9046aa
...
...
@@ -13,8 +13,8 @@ class GitlabShell
GITALY_MIGRATED_COMMANDS
=
{
'git-upload-pack'
=>
File
.
join
(
ROOT_PATH
,
'bin'
,
'gitaly-upload-pack'
),
'git-receive-pack'
=>
File
.
join
(
ROOT_PATH
,
'bin'
,
'gitaly-receive-pack'
),
}
API_COMMANDS
=
%w(2fa_recovery_codes)
}
.
freeze
API_COMMANDS
=
%w(2fa_recovery_codes)
.
freeze
GL_PROTOCOL
=
'ssh'
.
freeze
attr_accessor
:key_id
,
:gl_repository
,
:repo_name
,
:command
,
:git_access
,
:username
...
...
lib/httpunix.rb
View file @
8f9046aa
...
...
@@ -32,7 +32,7 @@ module Net
class
HTTPUNIX
<
HTTP
def
initialize
(
socketpath
,
port
=
nil
)
super
(
socketpath
,
port
)
@port
=
nil
# HTTP will set it to default - override back -> set DEFAULT_PORT
@port
=
nil
# HTTP will set it to default - override back -> set DEFAULT_PORT
end
# override to prevent ":<port>" being appended to HTTP_HOST
...
...
support/go_build.rb
View file @
8f9046aa
...
...
@@ -6,14 +6,14 @@ require 'fileutils'
require_relative
'../lib/gitlab_init'
module
GoBuild
GO_DIR
=
'go'
GO_DIR
=
'go'
.
freeze
BUILD_DIR
=
File
.
join
(
ROOT_PATH
,
'go_build'
)
GO_PACKAGE
=
File
.
join
(
'gitlab.com/gitlab-org/gitlab-shell'
,
GO_DIR
)
GO_ENV
=
{
'GOPATH'
=>
BUILD_DIR
,
'GO15VENDOREXPERIMENT'
=>
'1'
,
}
}
.
freeze
def
create_fresh_build_dir
FileUtils
.
rm_rf
(
BUILD_DIR
)
...
...
@@ -25,7 +25,7 @@ module GoBuild
def
run!
(
env
,
cmd
)
raise
"env must be a hash"
unless
env
.
is_a?
(
Hash
)
raise
"cmd must be an array"
unless
cmd
.
is_a?
(
Array
)
if
!
system
(
env
,
*
cmd
)
abort
"command failed:
#{
env
.
inspect
}
#{
cmd
.
join
(
' '
)
}
"
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