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
d8f5e12a
Commit
d8f5e12a
authored
Apr 01, 2022
by
Siddharth Asthana
Committed by
Mikołaj Wawrzyniak
Apr 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Style/OpenStructUse offenses
Changelog: other
parent
4a25e415
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
21 deletions
+15
-21
.rubocop_todo/style/open_struct_use.yml
.rubocop_todo/style/open_struct_use.yml
+0
-3
lib/api/entities/wiki_attachment.rb
lib/api/entities/wiki_attachment.rb
+2
-2
lib/api/wikis.rb
lib/api/wikis.rb
+1
-1
lib/gitlab/git/diff_collection.rb
lib/gitlab/git/diff_collection.rb
+7
-10
lib/gitlab/gitaly_client/commit_service.rb
lib/gitlab/gitaly_client/commit_service.rb
+1
-1
lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb
...ort/after_export_strategies/base_after_export_strategy.rb
+4
-4
No files found.
.rubocop_todo/style/open_struct_use.yml
View file @
d8f5e12a
...
...
@@ -7,9 +7,6 @@ Style/OpenStructUse:
-
ee/spec/helpers/ee/blob_helper_spec.rb
-
ee/spec/lib/gitlab/auth/group_saml/failure_handler_spec.rb
-
ee/spec/lib/gitlab/legacy_github_import/project_creator_spec.rb
-
lib/api/wikis.rb
-
lib/gitlab/git/diff_collection.rb
-
lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb
-
lib/gitlab/testing/request_inspector_middleware.rb
-
spec/factories/go_module_versions.rb
-
spec/factories/wiki_pages.rb
...
...
lib/api/entities/wiki_attachment.rb
View file @
d8f5e12a
...
...
@@ -16,11 +16,11 @@ module API
end
def
filename
object
.
file_name
object
[
:file_name
]
end
def
secure_url
object
.
file_path
object
[
:file_path
]
end
end
end
...
...
lib/api/wikis.rb
View file @
d8f5e12a
...
...
@@ -136,7 +136,7 @@ module API
if
result
[
:status
]
==
:success
status
(
201
)
present
OpenStruct
.
new
(
result
[
:result
])
,
with:
Entities
::
WikiAttachment
present
result
[
:result
]
,
with:
Entities
::
WikiAttachment
else
render_api_error!
(
result
[
:message
],
400
)
end
...
...
lib/gitlab/git/diff_collection.rb
View file @
d8f5e12a
...
...
@@ -9,8 +9,6 @@ module Gitlab
attr_reader
:limits
delegate
:max_files
,
:max_lines
,
:max_bytes
,
:safe_max_files
,
:safe_max_lines
,
:safe_max_bytes
,
to: :limits
def
self
.
default_limits
{
max_files:
::
Commit
.
diff_safe_max_files
,
max_lines:
::
Commit
.
diff_safe_max_lines
}
end
...
...
@@ -26,8 +24,7 @@ module Gitlab
limits
[
:safe_max_lines
]
=
[
limits
[
:max_lines
],
defaults
[
:max_lines
]].
min
limits
[
:safe_max_bytes
]
=
limits
[
:safe_max_files
]
*
5
.
kilobytes
# Average 5 KB per file
limits
[
:max_patch_bytes
]
=
Gitlab
::
Git
::
Diff
.
patch_hard_limit_bytes
OpenStruct
.
new
(
limits
)
limits
end
def
initialize
(
iterator
,
options
=
{})
...
...
@@ -140,11 +137,11 @@ module Gitlab
end
def
over_safe_limits?
(
files
)
if
files
>=
safe_max_files
if
files
>=
limits
[
:safe_max_files
]
@collapsed_safe_files
=
true
elsif
@line_count
>
safe_max_lines
elsif
@line_count
>
limits
[
:safe_max_lines
]
@collapsed_safe_lines
=
true
elsif
@byte_count
>=
safe_max_bytes
elsif
@byte_count
>=
limits
[
:safe_max_bytes
]
@collapsed_safe_bytes
=
true
end
...
...
@@ -179,7 +176,7 @@ module Gitlab
@iterator
.
each_with_index
do
|
raw
,
iterator_index
|
@empty
=
false
if
@enforce_limits
&&
i
>=
max_files
if
@enforce_limits
&&
i
>=
limits
[
:max_files
]
@overflow
=
true
@overflow_max_files
=
true
break
...
...
@@ -194,7 +191,7 @@ module Gitlab
@line_count
+=
diff
.
line_count
@byte_count
+=
diff
.
diff
.
bytesize
if
@enforce_limits
&&
@line_count
>=
max_lines
if
@enforce_limits
&&
@line_count
>=
limits
[
:max_lines
]
# This last Diff instance pushes us over the lines limit. We stop and
# discard it.
@overflow
=
true
...
...
@@ -202,7 +199,7 @@ module Gitlab
break
end
if
@enforce_limits
&&
@byte_count
>=
max_bytes
if
@enforce_limits
&&
@byte_count
>=
limits
[
:max_bytes
]
# This last Diff instance pushes us over the lines limit. We stop and
# discard it.
@overflow
=
true
...
...
lib/gitlab/gitaly_client/commit_service.rb
View file @
d8f5e12a
...
...
@@ -466,7 +466,7 @@ module Gitlab
request_params
[
:ignore_whitespace_change
]
=
options
.
fetch
(
:ignore_whitespace_change
,
false
)
request_params
[
:enforce_limits
]
=
options
.
fetch
(
:limits
,
true
)
request_params
[
:collapse_diffs
]
=
!
options
.
fetch
(
:expanded
,
true
)
request_params
.
merge!
(
Gitlab
::
Git
::
DiffCollection
.
limits
(
options
)
.
to_h
)
request_params
.
merge!
(
Gitlab
::
Git
::
DiffCollection
.
limits
(
options
))
request
=
Gitaly
::
CommitDiffRequest
.
new
(
request_params
)
response
=
GitalyClient
.
call
(
@repository
.
storage
,
:diff_service
,
:commit_diff
,
request
,
timeout:
GitalyClient
.
medium_timeout
)
...
...
lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb
View file @
d8f5e12a
...
...
@@ -17,11 +17,11 @@ module Gitlab
public
def
initialize
(
attributes
=
{})
@options
=
OpenStruct
.
new
(
attributes
)
@options
=
attributes
end
self
.
class
.
instance_eval
do
def_delegators
:@options
,
*
attributes
.
keys
end
def
method_missing
(
method
,
*
args
)
@options
[
method
]
end
def
execute
(
current_user
,
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