diff --git a/.rubocop.yml b/.rubocop.yml index 7188b0ecefe4a7697ed24cdb4702623d7f73196f..7290d627d2434a2cd10a81fce5fdbbf48ddb2114 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -480,7 +480,7 @@ Style/RedundantException: Style/RedundantReturn: Description: "Don't use return where it's not required." StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-return' - Enabled: false + Enabled: true Style/RedundantSelf: Description: "Don't use self where it's not needed." diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index 985def4ad6650dfcafd701bf74fd76068e7d11dd..08221aaa2f852c7d95535701ff34b183e0a00c57 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -182,7 +182,7 @@ def path_with_ref(path) def file_exists?(path) return false if path.nil? - return @repository.blob_at(current_sha, path).present? || @repository.tree(current_sha, path).entries.any? + @repository.blob_at(current_sha, path).present? || @repository.tree(current_sha, path).entries.any? end # Check if the path is pointing to a directory(tree) or a file(blob) @@ -190,7 +190,7 @@ def file_exists?(path) def local_path(path) return "tree" if @repository.tree(current_sha, path).entries.any? return "raw" if @repository.blob_at(current_sha, path).image? - return "blob" + "blob" end def current_sha diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index 51b60770e0bb4e45c6e7c3374f9b605b8c202dd9..54462fd00e3c81687b01226183af68fd5a6acd64 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -17,7 +17,7 @@ def new_mr_path_for_fork_from_push_event(event) end def new_mr_from_push_event(event, target_project) - return { + { merge_request: { source_project_id: event.project.id, target_project_id: target_project.id, diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index 525266fb3b512e0e4bd1f5dd226cf8b10867c5c3..241462e5e4c2ba5abd2789767c5aee4153c0d4a9 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -49,7 +49,7 @@ def relative_self_url?(url) def standard_links(host, namespace, project, commit) base = [ 'https://', host, '/', namespace, '/', project ].join('') - return base, [ base, '/tree/', commit ].join('') + [base, [ base, '/tree/', commit ].join('')] end def relative_self_links(url, commit) @@ -58,7 +58,10 @@ def relative_self_links(url, commit) else base = [ @project.group.path, '/', url[/([^\/]*)\.git/, 1] ].join('') end - return namespace_project_path(base.namespace, base), + + [ + namespace_project_path(base.namespace, base), namespace_project_tree_path(base.namespace, base, commit) + ] end end diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index cb69e4b13d3d3811b1ef8f5cc10ecf84a54fdfe0..573415baec1f79b075b849d97f47d9cfe6437c4d 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -7,7 +7,7 @@ class GitAccess def self.can_push_to_branch?(user, project, ref) return false unless user - + if project.protected_branch?(ref) && !(project.developers_can_push_to_protected_branch?(ref) && project.team.developer?(user)) user.can?(:push_code_to_protected_branches, project) @@ -83,7 +83,7 @@ def push_access_check(user, project, changes) end end - return build_status_object(true) + build_status_object(true) end def change_access_check(user, project, change) diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb index fea4d2d55d22b92dcaba7ee94d8500ca05100f4d..43e07e0916045d84d4587cfa35b7ec34aa9ba9db 100644 --- a/lib/gitlab/popen.rb +++ b/lib/gitlab/popen.rb @@ -29,7 +29,7 @@ def popen(cmd, path=nil) @cmd_status = wait_thr.value.exitstatus end - return @cmd_output, @cmd_status + [@cmd_output, @cmd_status] end end end diff --git a/lib/gitlab/theme.rb b/lib/gitlab/theme.rb index 9799e54de5dbff285450dbf0061646b6542106cc..43093c7d27ebbf804adef24176611b0a31ed6075 100644 --- a/lib/gitlab/theme.rb +++ b/lib/gitlab/theme.rb @@ -19,7 +19,7 @@ def self.css_class_by_id(id) id ||= Gitlab.config.gitlab.default_theme - return themes[id] + themes[id] end def self.type_css_class_by_id(id)