Skip to content
Snippets Groups Projects
Commit 2e9f5de8 authored by Ciro Santilli's avatar Ciro Santilli
Browse files

Add parenthesis to function def with arguments.

parent a3d90c50
No related branches found
No related tags found
1 merge request!7858Add parenthesis to function def with arguments.
Showing
with 38 additions and 38 deletions
Loading
Loading
@@ -62,7 +62,7 @@ class ApplicationController < ActionController::Base
end
end
 
def after_sign_in_path_for resource
def after_sign_in_path_for(resource)
if resource.is_a?(User) && resource.respond_to?(:blocked?) && resource.blocked?
sign_out resource
flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it."
Loading
Loading
Loading
Loading
@@ -15,11 +15,11 @@ class RegistrationsController < Devise::RegistrationsController
super
end
 
def after_sign_up_path_for resource
def after_sign_up_path_for(resource)
new_user_session_path
end
 
def after_inactive_sign_up_path_for resource
def after_inactive_sign_up_path_for(resource)
new_user_session_path
end
 
Loading
Loading
Loading
Loading
@@ -19,7 +19,7 @@ module EventsHelper
[event.action_name, target].join(" ")
end
 
def event_filter_link key, tooltip
def event_filter_link(key, tooltip)
key = key.to_s
inactive = if @event_filter.active? key
nil
Loading
Loading
module IssuesHelper
def issue_css_classes issue
def issue_css_classes(issue)
classes = "issue"
classes << " closed" if issue.closed?
classes << " today" if issue.today?
Loading
Loading
@@ -84,7 +84,7 @@ module IssuesHelper
'id', 'name', object.assignee_id)
end
 
def milestone_options object
def milestone_options(object)
options_from_collection_for_select(object.project.milestones.active,
'id', 'title', object.milestone_id)
end
Loading
Loading
Loading
Loading
@@ -24,14 +24,14 @@ module MergeRequestsHelper
}
end
 
def mr_css_classes mr
def mr_css_classes(mr)
classes = "merge-request"
classes << " closed" if mr.closed?
classes << " merged" if mr.merged?
classes
end
 
def ci_build_details_path merge_request
def ci_build_details_path(merge_request)
merge_request.source_project.ci_service.build_page(merge_request.last_commit.sha)
end
 
Loading
Loading
module ProfileHelper
def oauth_active_class provider
def oauth_active_class(provider)
if current_user.provider == provider.to_s
'active'
end
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@ module ProjectsHelper
"You are going to remove #{user.name} from #{project.name} project team. Are you sure?"
end
 
def link_to_project project
def link_to_project(project)
link_to project do
title = content_tag(:span, project.name, class: 'project-name')
 
Loading
Loading
@@ -39,7 +39,7 @@ module ProjectsHelper
end
end
 
def project_title project
def project_title(project)
if project.group
content_tag :span do
link_to(simple_sanitize(project.group.name), group_path(project.group)) + " / " + project.name
Loading
Loading
Loading
Loading
@@ -89,7 +89,7 @@ module TabHelper
end
 
# Use nav_tab for save controller/action but different params
def nav_tab key, value, &block
def nav_tab(key, value, &block)
o = {}
o[:class] = ""
 
Loading
Loading
module TagsHelper
def tag_path tag
def tag_path(tag)
"/tags/#{tag}"
end
 
def tag_list project
def tag_list(project)
html = ''
project.tag_list.each do |tag|
html += link_to tag, tag_path(tag)
Loading
Loading
Loading
Loading
@@ -80,7 +80,7 @@ module TreeHelper
end
end
 
def up_dir_path tree
def up_dir_path(tree)
file = File.join(@path, "..")
tree_join(@ref, file)
end
Loading
Loading
Loading
Loading
@@ -184,7 +184,7 @@ class Ability
]
end
 
def group_abilities user, group
def group_abilities(user, group)
rules = []
 
if user.admin? || group.users.include?(user) || ProjectsFinder.new.execute(user, group: group).any?
Loading
Loading
@@ -209,7 +209,7 @@ class Ability
rules.flatten
end
 
def namespace_abilities user, namespace
def namespace_abilities(user, namespace)
rules = []
 
# Only namespace owner and administrators can manage it
Loading
Loading
Loading
Loading
@@ -90,7 +90,7 @@ class Commit
 
# Discover issues should be closed when this commit is pushed to a project's
# default branch.
def closes_issues project
def closes_issues(project)
Gitlab::ClosingIssueExtractor.closed_by_message_in_project(safe_message, project)
end
 
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@ module Mentionable
 
module ClassMethods
# Indicate which attributes of the Mentionable to search for GFM references.
def attr_mentionable *attrs
def attr_mentionable(*attrs)
mentionable_attrs.concat(attrs.map(&:to_s))
end
 
Loading
Loading
@@ -38,7 +38,7 @@ module Mentionable
 
# Determine whether or not a cross-reference Note has already been created between this Mentionable and
# the specified target.
def has_mentioned? target
def has_mentioned?(target)
Note.cross_reference_exists?(target, local_reference)
end
 
Loading
Loading
@@ -64,7 +64,7 @@ module Mentionable
end
 
# Extract GFM references to other Mentionables from this Mentionable. Always excludes its #local_reference.
def references p = project, text = mentionable_text
def references(p = project, text = mentionable_text)
return [] if text.blank?
ext = Gitlab::ReferenceExtractor.new
ext.analyze(text)
Loading
Loading
@@ -72,7 +72,7 @@ module Mentionable
end
 
# Create a cross-reference Note for each GFM reference to another Mentionable found in +mentionable_text+.
def create_cross_references! p = project, a = author, without = []
def create_cross_references!(p = project, a = author, without = [])
refs = references(p) - without
refs.each do |ref|
Note.create_cross_reference_note(ref, local_reference, a, p)
Loading
Loading
@@ -81,7 +81,7 @@ module Mentionable
 
# If the mentionable_text field is about to change, locate any *added* references and create cross references for
# them. Invoke from an observer's #before_save implementation.
def notice_added_references p = project, a = author
def notice_added_references(p = project, a = author)
ch = changed_attributes
original, mentionable_changed = "", false
self.class.mentionable_attrs.each do |attr|
Loading
Loading
Loading
Loading
@@ -77,7 +77,7 @@ class ProjectMember < Member
false
end
 
def truncate_team project
def truncate_team(project)
truncate_teams [project.id]
end
 
Loading
Loading
Loading
Loading
@@ -38,7 +38,7 @@ class Namespace < ActiveRecord::Base
 
scope :root, -> { where('type IS NULL') }
 
def self.search query
def self.search(query)
where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
end
 
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@ module Network
@max_count ||= 650
end
 
def initialize project, ref, commit, filter_ref
def initialize(project, ref, commit, filter_ref)
@project = project
@ref = ref
@commit = commit
Loading
Loading
Loading
Loading
@@ -331,7 +331,7 @@ class Project < ActiveRecord::Base
path
end
 
def items_for entity
def items_for(entity)
case entity
when 'issue' then
issues
Loading
Loading
@@ -504,7 +504,7 @@ class Project < ActiveRecord::Base
end
 
# Check if current branch name is marked as protected in the system
def protected_branch? branch_name
def protected_branch?(branch_name)
protected_branches_names.include?(branch_name)
end
 
Loading
Loading
Loading
Loading
@@ -27,7 +27,7 @@ class GitlabCiService < CiService
hook.save
end
 
def commit_status_path sha
def commit_status_path(sha)
project_url + "/builds/#{sha}/status.json?token=#{token}"
end
 
Loading
Loading
@@ -54,7 +54,7 @@ class GitlabCiService < CiService
end
end
 
def build_page sha
def build_page(sha)
project_url + "/builds/#{sha}"
end
 
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@ class ProjectTeam
# @team << [@user, :master]
# @team << [@users, :master]
#
def << args
def <<(args)
users = args.first
 
if users.respond_to?(:each)
Loading
Loading
Loading
Loading
@@ -203,7 +203,7 @@ class User < ActiveRecord::Base
User.where(name: name).first
end
 
def filter filter_name
def filter(filter_name)
case filter_name
when "admins"; self.admins
when "blocked"; self.blocked
Loading
Loading
@@ -213,7 +213,7 @@ class User < ActiveRecord::Base
end
end
 
def search query
def search(query)
where("lower(name) LIKE :query OR lower(email) LIKE :query OR lower(username) LIKE :query", query: "%#{query.downcase}%")
end
 
Loading
Loading
@@ -332,7 +332,7 @@ class User < ActiveRecord::Base
several_namespaces? || admin
end
 
def can? action, subject
def can?(action, subject)
abilities.allowed?(self, action, subject)
end
 
Loading
Loading
@@ -353,7 +353,7 @@ class User < ActiveRecord::Base
(personal_projects.count.to_f / projects_limit) * 100
end
 
def recent_push project_id = nil
def recent_push(project_id = nil)
# Get push events not earlier than 2 hours ago
events = recent_events.code_push.where("created_at > ?", Time.now - 2.hours)
events = events.where(project_id: project_id) if project_id
Loading
Loading
@@ -382,11 +382,11 @@ class User < ActiveRecord::Base
project.team_member_by_id(self.id)
end
 
def already_forked? project
def already_forked?(project)
!!fork_of(project)
end
 
def fork_of project
def fork_of(project)
links = ForkedProjectLink.where(forked_from_project_id: project, forked_to_project_id: personal_projects)
 
if links.any?
Loading
Loading
@@ -512,7 +512,7 @@ class User < ActiveRecord::Base
NotificationService.new
end
 
def log_info message
def log_info(message)
Gitlab::AppLogger.info message
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment