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
1
Merge Requests
1
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-ce
Commits
9d5c2099
Commit
9d5c2099
authored
Sep 02, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
74393f8a
291232eb
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
85 additions
and
54 deletions
+85
-54
.rubocop_todo.yml
.rubocop_todo.yml
+0
-23
app/models/blob_viewer/dependency_manager.rb
app/models/blob_viewer/dependency_manager.rb
+2
-2
app/models/project.rb
app/models/project.rb
+2
-2
app/services/prometheus/proxy_service.rb
app/services/prometheus/proxy_service.rb
+2
-2
app/workers/delete_stored_files_worker.rb
app/workers/delete_stored_files_worker.rb
+2
-2
changelogs/unreleased/raise-exceptio-cop.yml
changelogs/unreleased/raise-exceptio-cop.yml
+5
-0
changelogs/unreleased/rescue-alignment.yml
changelogs/unreleased/rescue-alignment.yml
+5
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+2
-2
config/initializers/trusted_proxies.rb
config/initializers/trusted_proxies.rb
+1
-1
config/routes/group.rb
config/routes/group.rb
+5
-9
db/migrate/20190402150158_backport_enterprise_schema.rb
db/migrate/20190402150158_backport_enterprise_schema.rb
+1
-1
ee/spec/requests/api/helpers_spec.rb
ee/spec/requests/api/helpers_spec.rb
+1
-1
lib/gitlab/highlight.rb
lib/gitlab/highlight.rb
+2
-2
lib/tasks/gitlab/lfs/migrate.rake
lib/tasks/gitlab/lfs/migrate.rake
+5
-5
rubocop/routes_under_scope.rb
rubocop/routes_under_scope.rb
+9
-0
scripts/lint-doc.sh
scripts/lint-doc.sh
+12
-1
spec/requests/api/helpers_spec.rb
spec/requests/api/helpers_spec.rb
+1
-1
spec/rubocop/cop/put_group_routes_under_scope_spec.rb
spec/rubocop/cop/put_group_routes_under_scope_spec.rb
+14
-0
spec/rubocop/cop/put_project_routes_under_scope_spec.rb
spec/rubocop/cop/put_project_routes_under_scope_spec.rb
+14
-0
No files found.
.rubocop_todo.yml
View file @
9d5c2099
...
...
@@ -69,20 +69,6 @@ Layout/LineLength:
Layout/MultilineOperationIndentation
:
Enabled
:
false
# Offense count: 9
# Cop supports --auto-correct.
Layout/RescueEnsureAlignment
:
Exclude
:
-
'
app/models/blob_viewer/dependency_manager.rb'
-
'
app/models/project.rb'
-
'
app/services/prometheus/proxy_service.rb'
-
'
app/workers/delete_stored_files_worker.rb'
-
'
config/initializers/1_settings.rb'
-
'
config/initializers/trusted_proxies.rb'
-
'
lib/gitlab/background_migration/archive_legacy_traces.rb'
-
'
lib/gitlab/highlight.rb'
-
'
lib/tasks/gitlab/lfs/migrate.rake'
# Offense count: 36
# Cop supports --auto-correct.
Layout/SpaceAroundMethodCallOperator
:
...
...
@@ -123,15 +109,6 @@ Lint/NonDeterministicRequireOrder:
-
'
qa/spec/spec_helper.rb'
-
'
spec/spec_helper.rb'
# Offense count: 3
# Configuration parameters: AllowedImplicitNamespaces.
# AllowedImplicitNamespaces: Gem
Lint/RaiseException
:
Exclude
:
-
'
db/migrate/20190402150158_backport_enterprise_schema.rb'
-
'
ee/spec/requests/api/helpers_spec.rb'
-
'
spec/requests/api/helpers_spec.rb'
# Offense count: 27
# Cop supports --auto-correct.
Lint/RedundantCopDisableDirective
:
...
...
app/models/blob_viewer/dependency_manager.rb
View file @
9d5c2099
...
...
@@ -33,8 +33,8 @@ module BlobViewer
@json_data
||=
begin
prepare!
Gitlab
::
Json
.
parse
(
blob
.
data
)
rescue
{}
rescue
{}
end
end
...
...
app/models/project.rb
View file @
9d5c2099
...
...
@@ -2152,8 +2152,8 @@ class Project < ApplicationRecord
data
=
repository
.
route_map_for
(
sha
)
Gitlab
::
RouteMap
.
new
(
data
)
if
data
rescue
Gitlab
::
RouteMap
::
FormatError
nil
rescue
Gitlab
::
RouteMap
::
FormatError
nil
end
end
...
...
app/services/prometheus/proxy_service.rb
View file @
9d5c2099
...
...
@@ -44,8 +44,8 @@ module Prometheus
def
self
.
from_cache
(
proxyable_class_name
,
proxyable_id
,
method
,
path
,
params
)
proxyable_class
=
begin
proxyable_class_name
.
constantize
rescue
NameError
nil
rescue
NameError
nil
end
return
unless
proxyable_class
...
...
app/workers/delete_stored_files_worker.rb
View file @
9d5c2099
...
...
@@ -9,8 +9,8 @@ class DeleteStoredFilesWorker # rubocop:disable Scalability/IdempotentWorker
def
perform
(
class_name
,
keys
)
klass
=
begin
class_name
.
constantize
rescue
NameError
nil
rescue
NameError
nil
end
unless
klass
...
...
changelogs/unreleased/raise-exceptio-cop.yml
0 → 100644
View file @
9d5c2099
---
title
:
Fix Lint/RaiseException cop
merge_request
:
41099
author
:
Rajendra Kadam
type
:
fixed
changelogs/unreleased/rescue-alignment.yml
0 → 100644
View file @
9d5c2099
---
title
:
Fix Layout/RescueEnsureAlignment cop
merge_request
:
41093
author
:
Rajendra Kadam
type
:
fixed
config/initializers/1_settings.rb
View file @
9d5c2099
...
...
@@ -176,8 +176,8 @@ Settings.gitlab['user'] ||= 'git'
Settings
.
gitlab
[
'ssh_user'
]
||=
Settings
.
gitlab
.
user
Settings
.
gitlab
[
'user_home'
]
||=
begin
Etc
.
getpwnam
(
Settings
.
gitlab
[
'user'
]).
dir
rescue
ArgumentError
# no user configured
'/home/'
+
Settings
.
gitlab
[
'user'
]
rescue
ArgumentError
# no user configured
'/home/'
+
Settings
.
gitlab
[
'user'
]
end
Settings
.
gitlab
[
'time_zone'
]
||=
nil
Settings
.
gitlab
[
'signup_enabled'
]
||=
true
if
Settings
.
gitlab
[
'signup_enabled'
].
nil?
...
...
config/initializers/trusted_proxies.rb
View file @
9d5c2099
...
...
@@ -15,7 +15,7 @@ end
gitlab_trusted_proxies
=
Array
(
Gitlab
.
config
.
gitlab
.
trusted_proxies
).
map
do
|
proxy
|
IPAddr
.
new
(
proxy
)
rescue
IPAddr
::
InvalidAddressError
rescue
IPAddr
::
InvalidAddressError
end
.
compact
Rails
.
application
.
config
.
action_dispatch
.
trusted_proxies
=
(
...
...
config/routes/group.rb
View file @
9d5c2099
...
...
@@ -23,9 +23,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
get
'archived'
,
action: :show
,
as: :group_archived
# rubocop:disable Cop/PutGroupRoutesUnderScope
end
# These routes are legit and the cop rule will be improved in
# https://gitlab.com/gitlab-org/gitlab/-/issues/230703
get
'/'
,
action: :show
,
as: :group_canonical
# rubocop:disable Cop/PutGroupRoutesUnderScope
get
'/'
,
action: :show
,
as: :group_canonical
end
scope
(
path:
'groups/*group_id/-'
,
...
...
@@ -112,11 +110,9 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
as: :group
,
constraints:
{
id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
,
format:
/(html|json|atom)/
},
controller: :groups
)
do
# These routes are legit and the cop rule will be improved in
# https://gitlab.com/gitlab-org/gitlab/-/issues/230703
get
'/'
,
action: :show
# rubocop:disable Cop/PutGroupRoutesUnderScope
patch
'/'
,
action: :update
# rubocop:disable Cop/PutGroupRoutesUnderScope
put
'/'
,
action: :update
# rubocop:disable Cop/PutGroupRoutesUnderScope
delete
'/'
,
action: :destroy
# rubocop:disable Cop/PutGroupRoutesUnderScope
get
'/'
,
action: :show
patch
'/'
,
action: :update
put
'/'
,
action: :update
delete
'/'
,
action: :destroy
end
end
db/migrate/20190402150158_backport_enterprise_schema.rb
View file @
9d5c2099
...
...
@@ -914,7 +914,7 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
MSG
end
raise
Exception
.
new
(
message
)
raise
StandardError
.
new
(
message
)
end
def
create_missing_tables
...
...
ee/spec/requests/api/helpers_spec.rb
View file @
9d5c2099
...
...
@@ -25,7 +25,7 @@ RSpec.describe API::Helpers do
let
(
:params
)
{
request
.
params
}
def
error!
(
message
,
status
,
header
)
raise
Exception
.
new
(
"
#{
status
}
-
#{
message
}
"
)
raise
StandardError
.
new
(
"
#{
status
}
-
#{
message
}
"
)
end
before
do
...
...
lib/gitlab/highlight.rb
View file @
9d5c2099
...
...
@@ -31,8 +31,8 @@ module Gitlab
def
lexer
@lexer
||=
custom_language
||
begin
Rouge
::
Lexer
.
guess
(
filename:
@blob_name
,
source:
@blob_content
).
new
rescue
Rouge
::
Guesser
::
Ambiguous
=>
e
e
.
alternatives
.
min_by
(
&
:tag
)
rescue
Rouge
::
Guesser
::
Ambiguous
=>
e
e
.
alternatives
.
min_by
(
&
:tag
)
end
end
...
...
lib/tasks/gitlab/lfs/migrate.rake
View file @
9d5c2099
...
...
@@ -9,12 +9,12 @@ namespace :gitlab do
LfsObject
.
with_files_stored_locally
.
find_each
(
batch_size:
10
)
do
|
lfs_object
|
lfs_object
.
file
.
migrate!
(
LfsObjectUploader
::
Store
::
REMOTE
)
lfs_object
.
file
.
migrate!
(
LfsObjectUploader
::
Store
::
REMOTE
)
logger
.
info
(
"Transferred LFS object
#{
lfs_object
.
oid
}
of size
#{
lfs_object
.
size
.
to_i
.
bytes
}
to object storage"
)
rescue
=>
e
logger
.
error
(
"Failed to transfer LFS object
#{
lfs_object
.
oid
}
with error:
#{
e
.
message
}
"
)
end
logger
.
info
(
"Transferred LFS object
#{
lfs_object
.
oid
}
of size
#{
lfs_object
.
size
.
to_i
.
bytes
}
to object storage"
)
rescue
=>
e
logger
.
error
(
"Failed to transfer LFS object
#{
lfs_object
.
oid
}
with error:
#{
e
.
message
}
"
)
end
end
task
migrate_to_local: :environment
do
...
...
rubocop/routes_under_scope.rb
View file @
9d5c2099
...
...
@@ -12,6 +12,7 @@ module RuboCop
def
on_send
(
node
)
return
unless
route_method?
(
node
)
return
unless
outside_scope?
(
node
)
return
if
root_route?
(
node
)
add_offense
(
node
)
end
...
...
@@ -25,5 +26,13 @@ module RuboCop
def
route_method?
(
node
)
ROUTE_METHODS
.
include?
(
node
.
method_name
)
end
def
root_route?
(
node
)
first_argument
=
node
.
arguments
.
first
if
first_argument
.
respond_to?
(
:value
)
first_argument
.
value
==
'/'
end
end
end
end
scripts/lint-doc.sh
View file @
9d5c2099
...
...
@@ -55,7 +55,18 @@ then
((
ERRORCODE++
))
fi
MD_DOC_PATH
=
${
MD_DOC_PATH
:-
doc
}
# Run Vale and Markdownlint only on changed files. Only works on merged results
# pipelines, so first checks if a merged results CI variable is present. If not present,
# runs test on all files.
if
[
-z
"
${
CI_MERGE_REQUEST_TARGET_BRANCH_SHA
}
"
]
then
MD_DOC_PATH
=
${
MD_DOC_PATH
:-
doc
}
echo
"Merge request pipeline (detached) detected. Testing all files."
else
MERGE_BASE
=
$(
git merge-base
${
CI_MERGE_REQUEST_TARGET_BRANCH_SHA
}
${
CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
}
)
MD_DOC_PATH
=
$(
git diff
--name-only
"
${
MERGE_BASE
}
..
${
CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
}
"
'*.md'
)
echo
-e
"Merged results pipeline detected. Testing only the following files:
\n
${
MD_DOC_PATH
}
"
fi
function
run_locally_or_in_docker
()
{
local
cmd
=
$1
...
...
spec/requests/api/helpers_spec.rb
View file @
9d5c2099
...
...
@@ -39,7 +39,7 @@ RSpec.describe API::Helpers do
end
def
error!
(
message
,
status
,
header
)
raise
Exception
.
new
(
"
#{
status
}
-
#{
message
}
"
)
raise
StandardError
.
new
(
"
#{
status
}
-
#{
message
}
"
)
end
def
set_param
(
key
,
value
)
...
...
spec/rubocop/cop/put_group_routes_under_scope_spec.rb
View file @
9d5c2099
...
...
@@ -46,4 +46,18 @@ RSpec.describe RuboCop::Cop::PutGroupRoutesUnderScope, type: :rubocop do
end
PATTERN
end
it
'does not register an offense for the root route'
do
expect_no_offenses
(
<<~
PATTERN
)
get '/'
PATTERN
end
it
'does not register an offense for the root route within scope'
do
expect_no_offenses
(
<<~
PATTERN
)
scope(path: 'groups/*group_id/-', module: :groups) do
get '/'
end
PATTERN
end
end
spec/rubocop/cop/put_project_routes_under_scope_spec.rb
View file @
9d5c2099
...
...
@@ -46,4 +46,18 @@ RSpec.describe RuboCop::Cop::PutProjectRoutesUnderScope, type: :rubocop do
end
PATTERN
end
it
'does not register an offense for the root route'
do
expect_no_offenses
(
<<~
PATTERN
)
get '/'
PATTERN
end
it
'does not register an offense for the root route within scope'
do
expect_no_offenses
(
<<~
PATTERN
)
scope '-' do
get '/'
end
PATTERN
end
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