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
d5e275ec
Commit
d5e275ec
authored
Jan 26, 2022
by
Markus Koller
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue_220040_16' into 'master'
Fix Rails/SaveBang offenses See merge request gitlab-org/gitlab!75984
parents
5bd234e9
b173fe21
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
25 deletions
+17
-25
.rubocop_todo/rails/save_bang.yml
.rubocop_todo/rails/save_bang.yml
+0
-7
spec/lib/gitlab/import_export/importer_spec.rb
spec/lib/gitlab/import_export/importer_spec.rb
+1
-1
spec/lib/gitlab/import_export/lfs_restorer_spec.rb
spec/lib/gitlab/import_export/lfs_restorer_spec.rb
+2
-2
spec/lib/gitlab/import_export/lfs_saver_spec.rb
spec/lib/gitlab/import_export/lfs_saver_spec.rb
+4
-4
spec/lib/gitlab/import_export/members_mapper_spec.rb
spec/lib/gitlab/import_export/members_mapper_spec.rb
+0
-1
spec/lib/gitlab/import_export/project/relation_factory_spec.rb
...lib/gitlab/import_export/project/relation_factory_spec.rb
+1
-1
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
+1
-1
spec/lib/gitlab/import_export/project/tree_saver_spec.rb
spec/lib/gitlab/import_export/project/tree_saver_spec.rb
+8
-8
No files found.
.rubocop_todo/rails/save_bang.yml
View file @
d5e275ec
...
@@ -15,10 +15,3 @@ Rails/SaveBang:
...
@@ -15,10 +15,3 @@ Rails/SaveBang:
-
spec/lib/gitlab/database/custom_structure_spec.rb
-
spec/lib/gitlab/database/custom_structure_spec.rb
-
spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb
-
spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb
-
spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb
-
spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb
-
spec/lib/gitlab/import_export/importer_spec.rb
-
spec/lib/gitlab/import_export/lfs_restorer_spec.rb
-
spec/lib/gitlab/import_export/lfs_saver_spec.rb
-
spec/lib/gitlab/import_export/members_mapper_spec.rb
-
spec/lib/gitlab/import_export/project/relation_factory_spec.rb
-
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
-
spec/lib/gitlab/import_export/project/tree_saver_spec.rb
spec/lib/gitlab/import_export/importer_spec.rb
View file @
d5e275ec
...
@@ -17,7 +17,7 @@ RSpec.describe Gitlab::ImportExport::Importer do
...
@@ -17,7 +17,7 @@ RSpec.describe Gitlab::ImportExport::Importer do
stub_uploads_object_storage
(
FileUploader
)
stub_uploads_object_storage
(
FileUploader
)
FileUtils
.
mkdir_p
(
shared
.
export_path
)
FileUtils
.
mkdir_p
(
shared
.
export_path
)
ImportExportUpload
.
create
(
project:
project
,
import_file:
import_file
)
ImportExportUpload
.
create
!
(
project:
project
,
import_file:
import_file
)
allow
(
FileUtils
).
to
receive
(
:rm_rf
).
and_call_original
allow
(
FileUtils
).
to
receive
(
:rm_rf
).
and_call_original
end
end
...
...
spec/lib/gitlab/import_export/lfs_restorer_spec.rb
View file @
d5e275ec
...
@@ -36,7 +36,7 @@ RSpec.describe Gitlab::ImportExport::LfsRestorer do
...
@@ -36,7 +36,7 @@ RSpec.describe Gitlab::ImportExport::LfsRestorer do
)
)
end
end
saver
.
save
saver
.
save
# rubocop:disable Rails/SaveBang
project
.
lfs_objects
.
delete_all
project
.
lfs_objects
.
delete_all
end
end
...
@@ -81,7 +81,7 @@ RSpec.describe Gitlab::ImportExport::LfsRestorer do
...
@@ -81,7 +81,7 @@ RSpec.describe Gitlab::ImportExport::LfsRestorer do
context
'when there is not an existing `LfsObject`'
do
context
'when there is not an existing `LfsObject`'
do
before
do
before
do
lfs_object
.
destroy
lfs_object
.
destroy
!
end
end
it
'creates a new lfs object'
do
it
'creates a new lfs object'
do
...
...
spec/lib/gitlab/import_export/lfs_saver_spec.rb
View file @
d5e275ec
...
@@ -34,13 +34,13 @@ RSpec.describe Gitlab::ImportExport::LfsSaver do
...
@@ -34,13 +34,13 @@ RSpec.describe Gitlab::ImportExport::LfsSaver do
end
end
it
'does not cause errors'
do
it
'does not cause errors'
do
saver
.
save
saver
.
save
# rubocop:disable Rails/SaveBang
expect
(
shared
.
errors
).
to
be_empty
expect
(
shared
.
errors
).
to
be_empty
end
end
it
'copies the file in the correct location when there is an lfs object'
do
it
'copies the file in the correct location when there is an lfs object'
do
saver
.
save
saver
.
save
# rubocop:disable Rails/SaveBang
expect
(
File
).
to
exist
(
"
#{
shared
.
export_path
}
/lfs-objects/
#{
lfs_object
.
oid
}
"
)
expect
(
File
).
to
exist
(
"
#{
shared
.
export_path
}
/lfs-objects/
#{
lfs_object
.
oid
}
"
)
end
end
...
@@ -61,7 +61,7 @@ RSpec.describe Gitlab::ImportExport::LfsSaver do
...
@@ -61,7 +61,7 @@ RSpec.describe Gitlab::ImportExport::LfsSaver do
end
end
it
'saves a json file correctly'
do
it
'saves a json file correctly'
do
saver
.
save
saver
.
save
# rubocop:disable Rails/SaveBang
expect
(
File
.
exist?
(
lfs_json_file
)).
to
eq
(
true
)
expect
(
File
.
exist?
(
lfs_json_file
)).
to
eq
(
true
)
expect
(
lfs_json
).
to
eq
(
expect
(
lfs_json
).
to
eq
(
...
@@ -96,7 +96,7 @@ RSpec.describe Gitlab::ImportExport::LfsSaver do
...
@@ -96,7 +96,7 @@ RSpec.describe Gitlab::ImportExport::LfsSaver do
expect
(
fake_uri
).
to
receive
(
:open
).
and_return
(
StringIO
.
new
(
'LFS file content'
))
expect
(
fake_uri
).
to
receive
(
:open
).
and_return
(
StringIO
.
new
(
'LFS file content'
))
expect
(
URI
).
to
receive
(
:parse
).
with
(
'http://my-object-storage.local'
).
and_return
(
fake_uri
)
expect
(
URI
).
to
receive
(
:parse
).
with
(
'http://my-object-storage.local'
).
and_return
(
fake_uri
)
saver
.
save
saver
.
save
# rubocop:disable Rails/SaveBang
expect
(
File
.
read
(
exported_file_path
)).
to
eq
(
'LFS file content'
)
expect
(
File
.
read
(
exported_file_path
)).
to
eq
(
'LFS file content'
)
end
end
...
...
spec/lib/gitlab/import_export/members_mapper_spec.rb
View file @
d5e275ec
...
@@ -243,7 +243,6 @@ RSpec.describe Gitlab::ImportExport::MembersMapper do
...
@@ -243,7 +243,6 @@ RSpec.describe Gitlab::ImportExport::MembersMapper do
before
do
before
do
group
.
add_users
([
user
,
user2
],
GroupMember
::
DEVELOPER
)
group
.
add_users
([
user
,
user2
],
GroupMember
::
DEVELOPER
)
user
.
update
(
public_email:
'invite@test.com'
)
end
end
it
'maps the importer'
do
it
'maps the importer'
do
...
...
spec/lib/gitlab/import_export/project/relation_factory_spec.rb
View file @
d5e275ec
...
@@ -10,7 +10,7 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_
...
@@ -10,7 +10,7 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_
let
(
:importer_user
)
{
admin
}
let
(
:importer_user
)
{
admin
}
let
(
:excluded_keys
)
{
[]
}
let
(
:excluded_keys
)
{
[]
}
let
(
:created_object
)
do
let
(
:created_object
)
do
described_class
.
create
(
described_class
.
create
(
# rubocop:disable Rails/SaveBang
relation_sym:
relation_sym
,
relation_sym:
relation_sym
,
relation_hash:
relation_hash
,
relation_hash:
relation_hash
,
relation_index:
1
,
relation_index:
1
,
...
...
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
View file @
d5e275ec
...
@@ -880,7 +880,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do
...
@@ -880,7 +880,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do
before
do
before
do
group
=
create
(
:group
,
visibility_level:
group_visibility
)
group
=
create
(
:group
,
visibility_level:
group_visibility
)
group
.
add_users
([
user
],
GroupMember
::
MAINTAINER
)
group
.
add_users
([
user
],
GroupMember
::
MAINTAINER
)
project
.
update
(
group:
group
)
project
.
update
!
(
group:
group
)
end
end
context
'private group visibility'
do
context
'private group visibility'
do
...
...
spec/lib/gitlab/import_export/project/tree_saver_spec.rb
View file @
d5e275ec
...
@@ -36,7 +36,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
...
@@ -36,7 +36,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
project_tree_saver
=
described_class
.
new
(
project:
project
,
current_user:
user
,
shared:
shared
)
project_tree_saver
=
described_class
.
new
(
project:
project
,
current_user:
user
,
shared:
shared
)
project_tree_saver
.
save
project_tree_saver
.
save
# rubocop:disable Rails/SaveBang
end
end
end
end
...
@@ -305,14 +305,14 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
...
@@ -305,14 +305,14 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
end
end
before
do
before
do
user2
.
update
(
public_email:
user2
.
email
)
user2
.
update
!
(
public_email:
user2
.
email
)
group
.
add_developer
(
user2
)
group
.
add_developer
(
user2
)
end
end
context
'when has no permission'
do
context
'when has no permission'
do
before
do
before
do
group
.
add_developer
(
user
)
group
.
add_developer
(
user
)
project_tree_saver
.
save
project_tree_saver
.
save
# rubocop:disable Rails/SaveBang
end
end
it
'does not export group members'
do
it
'does not export group members'
do
...
@@ -324,7 +324,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
...
@@ -324,7 +324,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
before
do
before
do
group
.
add_maintainer
(
user
)
group
.
add_maintainer
(
user
)
project_tree_saver
.
save
project_tree_saver
.
save
# rubocop:disable Rails/SaveBang
end
end
it
'does not export group members'
do
it
'does not export group members'
do
...
@@ -336,7 +336,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
...
@@ -336,7 +336,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
before
do
before
do
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
project_tree_saver
.
save
project_tree_saver
.
save
# rubocop:disable Rails/SaveBang
end
end
it
'exports group members as group owner'
do
it
'exports group members as group owner'
do
...
@@ -348,7 +348,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
...
@@ -348,7 +348,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
let
(
:user
)
{
create
(
:admin
)
}
let
(
:user
)
{
create
(
:admin
)
}
before
do
before
do
project_tree_saver
.
save
project_tree_saver
.
save
# rubocop:disable Rails/SaveBang
end
end
context
'when admin mode is enabled'
,
:enable_admin_mode
do
context
'when admin mode is enabled'
,
:enable_admin_mode
do
...
@@ -376,7 +376,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
...
@@ -376,7 +376,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
let
(
:relation_name
)
{
:projects
}
let
(
:relation_name
)
{
:projects
}
before
do
before
do
project_tree_saver
.
save
project_tree_saver
.
save
# rubocop:disable Rails/SaveBang
end
end
it
{
is_expected
.
to
include
({
'description'
=>
params
[
:description
]
})
}
it
{
is_expected
.
to
include
({
'description'
=>
params
[
:description
]
})
}
...
@@ -471,7 +471,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
...
@@ -471,7 +471,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeSaver do
merge_request
=
create
(
:merge_request
,
source_project:
project
,
milestone:
milestone
)
merge_request
=
create
(
:merge_request
,
source_project:
project
,
milestone:
milestone
)
ci_build
=
create
(
:ci_build
,
project:
project
,
when:
nil
)
ci_build
=
create
(
:ci_build
,
project:
project
,
when:
nil
)
ci_build
.
pipeline
.
update
(
project:
project
)
ci_build
.
pipeline
.
update
!
(
project:
project
)
create
(
:commit_status
,
project:
project
,
pipeline:
ci_build
.
pipeline
)
create
(
:commit_status
,
project:
project
,
pipeline:
ci_build
.
pipeline
)
create
(
:milestone
,
project:
project
)
create
(
:milestone
,
project:
project
)
...
...
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