Commit 9e211091 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Enable Style/EmptyLines cop, remove redundant ones

parent b2273559
......@@ -193,7 +193,7 @@ Style/EmptyLineBetweenDefs:
# Don't use several empty lines in a row.
Style/EmptyLines:
Enabled: false
Enabled: true
# Keep blank lines around access modifiers.
Style/EmptyLinesAroundAccessModifier:
......
......@@ -22,7 +22,6 @@ def destroy
redirect_to admin_hooks_path
end
def test
@hook = SystemHook.find(params[:hook_id])
data = {
......
class ConfirmationsController < Devise::ConfirmationsController
def almost_there
flash[:notice] = nil
render layout: "devise_empty"
......
class Import::BaseController < ApplicationController
private
def get_or_create_namespace
......
......@@ -5,7 +5,6 @@ class Import::FogbugzController < Import::BaseController
rescue_from Fogbugz::AuthenticationException, with: :fogbugz_unauthorized
def new
end
def callback
......@@ -22,7 +21,6 @@ def callback
end
def new_user_map
end
def create_user_map
......
......@@ -44,5 +44,4 @@ def client
def verify_gitorious_import_enabled
render_404 unless gitorious_import_enabled?
end
end
......@@ -3,7 +3,6 @@ class Import::GoogleCodeController < Import::BaseController
before_action :user_map, only: [:new_user_map, :create_user_map]
def new
end
def callback
......@@ -34,7 +33,6 @@ def callback
end
def new_user_map
end
def create_user_map
......
......@@ -5,7 +5,6 @@ class InvitesController < ApplicationController
respond_to :html
def show
end
def accept
......
......@@ -76,7 +76,6 @@ def show
render json: @issue.to_json(include: [:milestone, :labels])
end
end
end
def create
......
......@@ -7,7 +7,6 @@ class Projects::NetworkController < Projects::ApplicationController
before_action :authorize_download_code!
def show
@url = namespace_project_network_path(@project.namespace, @project, @ref, @options.merge(format: :json))
@commit_url = namespace_project_commit_path(@project.namespace, @project, 'ae45ca32').gsub("ae45ca32", "%s")
......
......@@ -124,5 +124,4 @@ def load_project_wiki
def wiki_params
params[:wiki].slice(:title, :content, :format, :message)
end
end
module EmailsHelper
# Google Actions
# https://developers.google.com/gmail/markup/reference/go-to-action
def email_action(url)
......
module IssuablesHelper
def sidebar_gutter_toggle_icon
sidebar_gutter_collapsed? ? icon('angle-double-left') : icon('angle-double-right')
end
......
module SearchHelper
def search_autocomplete_opts(term)
return unless current_user
......
......@@ -58,7 +58,6 @@ def award_emojis_loaded?
scope :references_project, -> { references(:project) }
scope :non_archived, -> { join_project.where(projects: { archived: false }) }
delegate :name,
:email,
to: :author,
......
......@@ -15,7 +15,6 @@ class ProjectMember < Member
before_destroy :delete_member_todos
class << self
# Add users to project teams with passed access option
#
# access can be an integer representing a access code
......
class BugzillaService < IssueTrackerService
prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url
def title
......@@ -21,5 +20,4 @@ def description
def to_param
'bugzilla'
end
end
class CustomIssueTrackerService < IssueTrackerService
prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url
def title
......@@ -31,5 +30,4 @@ def fields
{ type: 'text', name: 'new_issue_url', placeholder: 'New Issue url' }
]
end
end
class DroneCiService < CiService
prop_accessor :drone_url, :token, :enable_ssl_verification
validates :drone_url, presence: true, url: true, if: :activated?
......
class IssueTrackerService < Service
validates :project_url, :issues_url, :new_issue_url, presence: true, url: true, if: :activated?
default_value_for :category, 'issue_tracker'
......
......@@ -190,7 +190,6 @@ def add_comment(data, issue_name)
end
end
def auth
require 'base64'
Base64.urlsafe_encode64("#{self.username}:#{self.password}")
......
class RedmineService < IssueTrackerService
prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url
def title
......
......@@ -875,7 +875,6 @@ def is_ancestor?(ancestor_id, descendant_id)
merge_base(ancestor_id, descendant_id) == ancestor_id
end
def search_files(query, ref)
offset = 2
args = %W(#{Gitlab.config.git.bin_path} grep -i -I -n --before-context #{offset} --after-context #{offset} -E -e #{Regexp.escape(query)} #{ref || root_ref})
......
......@@ -852,7 +852,6 @@ def projects_union(min_access_level = nil)
projects.select(:id),
groups.joins(:shared_projects).select(:project_id)]
if min_access_level
scope = { access_level: Gitlab::Access.values.select { |access| access >= min_access_level } }
relations = [relations.shift] + relations.map { |relation| relation.where(members: scope) }
......
......@@ -2,7 +2,6 @@
class CreateReleaseService < BaseService
def execute(tag_name, release_description)
repository = project.repository
existing_tag = repository.find_tag(tag_name)
......
module Issues
class BaseService < ::IssuableBaseService
def hook_data(issue, action)
issue_data = issue.to_hook_data(current_user)
issue_url = Gitlab::UrlBuilder.build(issue)
......
module MergeRequests
class BaseService < ::IssuableBaseService
def create_note(merge_request)
SystemNoteService.change_status(merge_request, merge_request.target_project, current_user, merge_request.state, nil)
end
......
......@@ -40,6 +40,5 @@ def cancel(merge_request)
error("Can't cancel the automatic merge", 406)
end
end
end
end
module Milestones
class DestroyService < Milestones::BaseService
def execute(milestone)
Milestone.transaction do
update_params = { milestone: nil }
......
module Projects
class DownloadService < BaseService
WHITELIST = [
/^[^.]+\.fogbugz.com$/
]
......
module Projects
module ImportExport
class ExportService < BaseService
def execute(_options = {})
@shared = Gitlab::ImportExport::Shared.new(relative_path: File.join(project.path_with_namespace, 'work'))
save_all
......
......@@ -293,7 +293,6 @@ def self.cross_reference(noteable, mentioner, author)
end
end
def self.cross_reference?(note_text)
note_text.start_with?(cross_reference_note_prefix)
end
......
......@@ -2,7 +2,6 @@
class UpdateReleaseService < BaseService
def execute(tag_name, release_description)
repository = project.repository
existing_tag = repository.find_tag(tag_name)
......
module WikiPages
class BaseService < ::BaseService
def hook_data(page, action)
hook_data = {
object_kind: page.class.name.underscore,
......
......@@ -96,7 +96,6 @@ def host(url)
end
end
# Default settings
Settings['ldap'] ||= Settingslogic.new({})
Settings.ldap['enabled'] = false if Settings.ldap['enabled'].nil?
......@@ -124,7 +123,6 @@ def host(url)
end
end
Settings['omniauth'] ||= Settingslogic.new({})
Settings.omniauth['enabled'] = false if Settings.omniauth['enabled'].nil?
Settings.omniauth['auto_sign_in_with_provider'] = false if Settings.omniauth['auto_sign_in_with_provider'].nil?
......@@ -218,7 +216,6 @@ def host(url)
Settings.gitlab['import_sources'] ||= %w[github bitbucket gitlab gitorious google_code fogbugz git gitlab_project]
Settings.gitlab['trusted_proxies'] ||= []
#
# CI
#
......@@ -348,7 +345,6 @@ def host(url)
Settings['satellites'] ||= Settingslogic.new({})
Settings.satellites['path'] = File.expand_path(Settings.satellites['path'] || "tmp/repo_satellites/", Rails.root)
#
# Extra customization
#
......
......@@ -133,7 +133,6 @@
#
resources :notification_settings, only: [:create, :update]
#
# Import
#
......@@ -466,7 +465,6 @@
resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: [] do
resources(:projects, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, except:
[:new, :create, :index], path: "/") do
member do
put :transfer
delete :remove_fork
......
......@@ -49,5 +49,4 @@ class Spinach::Features::NewProject < Spinach::FeatureSteps
step 'I redirected to Google Code import page' do
expect(current_path).to eq new_import_google_code_path
end
end
......@@ -69,7 +69,6 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
visit namespace_project_issues_path(public_project.namespace, public_project)
end
step 'I should see list of issues for "Community" project' do
expect(page).to have_content "Bug"
expect(page).to have_content public_project.name
......@@ -88,7 +87,6 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
visit namespace_project_issues_path(internal_project.namespace, internal_project)
end
step 'I should see list of issues for "Internal" project' do
expect(page).to have_content "Internal Bug"
expect(page).to have_content internal_project.name
......@@ -137,7 +135,6 @@ def public_project
@public_project ||= Project.find_by!(name: 'Community')
end
def internal_merge_request
@internal_merge_request ||= MergeRequest.find_by!(title: 'Feature implemented')
end
......
......@@ -33,5 +33,4 @@ class Spinach::Features::ProjectArchived < Spinach::FeatureSteps
When 'I set project unarchived' do
click_link "Unarchive"
end
end
......@@ -124,14 +124,12 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'project "Shop" has milestone "v2.2"' do
milestone = create(:milestone, title: "v2.2", project: project)
3.times { create(:issue, project: project, milestone: milestone) }
end
step 'project "Shop" has milestone "v3.0"' do
milestone = create(:milestone, title: "v3.0", project: project)
3.times { create(:issue, project: project, milestone: milestone) }
......@@ -147,7 +145,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
When 'I select first assignee from "Shop" project' do
first_assignee = project.users.first
select first_assignee.name, from: "assignee_id"
end
......@@ -160,7 +157,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end
step 'project "Shop" have "Release 0.4" open issue' do
create(:issue,
title: "Release 0.4",
project: project,
......@@ -360,5 +356,4 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
def filter_issue(text)
fill_in 'issue_search', with: text
end
end
......@@ -66,7 +66,6 @@ class Spinach::Features::ProjectFindFile < Spinach::FeatureSteps
expect(page).not_to have_content(".gitignore")
end
def find_file(text)
fill_in 'file_find', with: text
end
......
......@@ -189,5 +189,4 @@ def expect_sidebar_content(content)
expect(page).to have_content content
end
end
end
......@@ -52,5 +52,4 @@ class Spinach::Features::SnippetSearch < Spinach::FeatureSteps
step 'I should not see "Personal snippet private" in results' do
expect(page).not_to have_content 'Personal snippet private'
end
end
......@@ -11,7 +11,6 @@ class AwardEmoji < Grape::API
[ ":id/#{awardable_string}/:#{awardable_id_string}/award_emoji",
":id/#{awardable_string}/:#{awardable_id_string}/notes/:note_id/award_emoji"
].each do |endpoint|
# Get a list of project +awardable+ award emoji
#
# Parameters:
......
......@@ -40,7 +40,6 @@ class Branches < Grape::API
# PUT /projects/:id/repository/branches/:branch/protect
put ':id/repository/branches/:branch/protect',
requirements: { branch: /.+/ } do
authorize_admin_project
@branch = user_project.repository.find_branch(params[:branch])
......@@ -60,7 +59,6 @@ class Branches < Grape::API
# PUT /projects/:id/repository/branches/:branch/unprotect
put ':id/repository/branches/:branch/unprotect',
requirements: { branch: /.+/ } do
authorize_admin_project
@branch = user_project.repository.find_branch(params[:branch])
......
......@@ -13,7 +13,6 @@ class Builds < Grape::API
# Example Request:
# GET /projects/:id/builds
get ':id/builds' do
builds = user_project.builds.order('id DESC')
builds = filter_builds(builds, params[:scope])
......
......@@ -115,7 +115,6 @@ def filter_milestones_state(milestones, state)
issues = IssuesFinder.new(current_user, finder_params).execute
present paginate(issues), with: Entities::Issue, current_user: current_user
end
end
end
end
......@@ -28,7 +28,6 @@ class ProjectHooks < Grape::API
present @hook, with: Entities::ProjectHook
end
# Add hook to project
#
# Parameters:
......
......@@ -4,7 +4,6 @@ class ProjectMembers < Grape::API
before { authenticate! }
resource :projects do
# Get a project team members
#
# Parameters:
......
......@@ -341,7 +341,6 @@ def map_public_to_visibility_level(attrs)
else
not_found!("Source Project")
end
end
# Remove a forked_from relationship
......@@ -418,7 +417,6 @@ def map_public_to_visibility_level(attrs)
present paginate(projects), with: Entities::Project
end
# Get a users list
#
# Example Request:
......
......@@ -4,7 +4,6 @@ class Services < Grape::API
before { authenticate! }
before { authorize_admin_project }
resource :projects do
# Set <service_slug> service for project
#
......
......@@ -8,7 +8,6 @@ class ImageLinkFilter < HTML::Pipeline::Filter
# of the anchor, and then replace the img with the link-wrapped version.
def call
doc.xpath('descendant-or-self::img[not(ancestor::a)]').each do |img|
div = doc.document.create_element(
'div',
class: 'image-container'
......
......@@ -8,7 +8,6 @@ module Filter
# Context options:
# :project_wiki
class WikiLinkFilter < HTML::Pipeline::Filter
def call
return doc unless project_wiki?
......
module Banzai
module Pipeline
class FullPipeline < CombinedPipeline.new(PlainMarkdownPipeline, GfmPipeline)
end
end
end
......@@ -13,7 +13,6 @@ def initialize(project)
collect
end
def push(from, to, format)
@labels << from.strftime(format)
@total << project.builds.
......
# Read about interceptors in http://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails
class DisableEmailInterceptor
def self.delivering_email(message)
message.perform_deliveries = false
Rails.logger.info "Emails disabled! Interceptor prevented sending mail #{message.subject}"
......
......@@ -4,7 +4,6 @@ module Gitlab
# Parser/renderer for the AsciiDoc format that uses Asciidoctor and filters
# the resulting HTML through HTML pipeline filters.
module Asciidoc
DEFAULT_ADOC_ATTRS = [
'showtitle', 'idprefix=user-content-', 'idseparator=-', 'env=gitlab',
'env-gitlab', 'source-highlighter=html-pipeline'
......
......@@ -8,7 +8,6 @@ def self.call(env)
end
class Auth < Rack::Auth::Basic
attr_accessor :user, :project, :env