Skip to content

Commit

Permalink
Add parenthesis to function def with arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
cirosantilli committed Oct 1, 2014
1 parent 88d3e97 commit db36645
Show file tree
Hide file tree
Showing 33 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Expand Up @@ -62,7 +62,7 @@ def reject_blocked!
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."
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/registrations_controller.rb
Expand Up @@ -15,11 +15,11 @@ def build_resource(hash=nil)
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

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/events_helper.rb
Expand Up @@ -19,7 +19,7 @@ def event_action_name(event)
[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
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/issues_helper.rb
@@ -1,5 +1,5 @@
module IssuesHelper
def issue_css_classes issue
def issue_css_classes(issue)
classes = "issue"
classes << " closed" if issue.closed?
classes << " today" if issue.today?
Expand Down Expand Up @@ -84,7 +84,7 @@ def assignee_options(object, project = @project)
'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
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/merge_requests_helper.rb
Expand Up @@ -24,14 +24,14 @@ def new_mr_from_push_event(event, target_project)
}
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

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/profile_helper.rb
@@ -1,5 +1,5 @@
module ProfileHelper
def oauth_active_class provider
def oauth_active_class(provider)
if current_user.provider == provider.to_s
'active'
end
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/projects_helper.rb
Expand Up @@ -3,7 +3,7 @@ def remove_from_project_team_message(project, user)
"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')

Expand Down Expand Up @@ -39,7 +39,7 @@ def link_to_member(project, author, opts = {})
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
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/tab_helper.rb
Expand Up @@ -89,7 +89,7 @@ def branches_tab_class
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] = ""

Expand Down
4 changes: 2 additions & 2 deletions app/helpers/tags_helper.rb
@@ -1,9 +1,9 @@
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)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/tree_helper.rb
Expand Up @@ -80,7 +80,7 @@ def tree_breadcrumbs(tree, max_links = 2)
end
end

def up_dir_path tree
def up_dir_path(tree)
file = File.join(@path, "..")
tree_join(@ref, file)
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/ability.rb
Expand Up @@ -184,7 +184,7 @@ def project_admin_rules
]
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?
Expand All @@ -209,7 +209,7 @@ def group_abilities user, group
rules.flatten
end

def namespace_abilities user, namespace
def namespace_abilities(user, namespace)
rules = []

# Only namespace owner and administrators can manage it
Expand Down
2 changes: 1 addition & 1 deletion app/models/commit.rb
Expand Up @@ -90,7 +90,7 @@ def description?

# 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

Expand Down
10 changes: 5 additions & 5 deletions app/models/concerns/mentionable.rb
Expand Up @@ -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

Expand Down Expand Up @@ -38,7 +38,7 @@ def local_reference

# 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

Expand All @@ -64,15 +64,15 @@ def mentioned_users
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)
(ext.issues_for(p) + ext.merge_requests_for(p) + ext.commits_for(p)).uniq - [local_reference]
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)
Expand All @@ -81,7 +81,7 @@ def create_cross_references! p = project, a = author, without = []

# 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|
Expand Down
2 changes: 1 addition & 1 deletion app/models/members/project_member.rb
Expand Up @@ -77,7 +77,7 @@ def truncate_teams(project_ids)
false
end

def truncate_team project
def truncate_team(project)
truncate_teams [project.id]
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/namespace.rb
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion app/models/network/graph.rb
Expand Up @@ -6,7 +6,7 @@ def self.max_count
@max_count ||= 650
end

def initialize project, ref, commit, filter_ref
def initialize(project, ref, commit, filter_ref)
@project = project
@ref = ref
@commit = commit
Expand Down
4 changes: 2 additions & 2 deletions app/models/project.rb
Expand Up @@ -331,7 +331,7 @@ def code
path
end

def items_for entity
def items_for(entity)
case entity
when 'issue' then
issues
Expand Down Expand Up @@ -504,7 +504,7 @@ def http_url_to_repo
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

Expand Down
6 changes: 3 additions & 3 deletions app/models/project_services/gitlab_ci_service.rb
Expand Up @@ -27,11 +27,11 @@ def compose_service_hook
hook.save
end

def commit_status_path sha
def commit_status_path(sha)
project_url + "/builds/#{sha}/status.json?token=#{token}"
end

def commit_status sha
def commit_status(sha)
response = HTTParty.get(commit_status_path(sha), verify: false)

if response.code == 200 and response["status"]
Expand All @@ -41,7 +41,7 @@ def commit_status sha
end
end

def build_page sha
def build_page(sha)
project_url + "/builds/#{sha}"
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/project_team.rb
Expand Up @@ -11,7 +11,7 @@ def initialize(project)
# @team << [@user, :master]
# @team << [@users, :master]
#
def << args
def <<(args)
users = args.first

if users.respond_to?(:each)
Expand Down
14 changes: 7 additions & 7 deletions app/models/user.rb
Expand Up @@ -203,7 +203,7 @@ def find_for_commit(email, name)
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
Expand All @@ -213,7 +213,7 @@ def filter filter_name
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

Expand Down Expand Up @@ -332,7 +332,7 @@ def can_select_namespace?
several_namespaces? || admin
end

def can? action, subject
def can?(action, subject)
abilities.allowed?(self, action, subject)
end

Expand All @@ -353,7 +353,7 @@ def projects_limit_percent
(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
Expand Down Expand Up @@ -382,11 +382,11 @@ def tm_of(project)
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?
Expand Down Expand Up @@ -512,7 +512,7 @@ def notification_service
NotificationService.new
end

def log_info message
def log_info(message)
Gitlab::AppLogger.info message
end

Expand Down
2 changes: 1 addition & 1 deletion app/services/base_service.rb
Expand Up @@ -25,7 +25,7 @@ def event_service
EventCreateService.new
end

def log_info message
def log_info(message)
Gitlab::AppLogger.info message
end

Expand Down
14 changes: 7 additions & 7 deletions app/services/git_push_service.rb
Expand Up @@ -75,7 +75,7 @@ def create_push_event(push_data)

# Extract any GFM references from the pushed commit messages. If the configured issue-closing regex is matched,
# close the referenced Issue. Create cross-reference Notes corresponding to any other referenced Mentionables.
def process_commit_messages ref
def process_commit_messages(ref)
is_default_branch = is_default_branch?(ref)

@push_commits.each do |commit|
Expand Down Expand Up @@ -165,34 +165,34 @@ def post_receive_data(oldrev, newrev, ref)
data
end

def push_to_existing_branch? ref, oldrev
def push_to_existing_branch?(ref, oldrev)
ref_parts = ref.split('/')

# Return if this is not a push to a branch (e.g. new commits)
ref_parts[1] =~ /heads/ && oldrev != "0000000000000000000000000000000000000000"
end

def push_to_new_branch? ref, oldrev
def push_to_new_branch?(ref, oldrev)
ref_parts = ref.split('/')

ref_parts[1] =~ /heads/ && oldrev == "0000000000000000000000000000000000000000"
end

def push_remove_branch? ref, newrev
def push_remove_branch?(ref, newrev)
ref_parts = ref.split('/')

ref_parts[1] =~ /heads/ && newrev == "0000000000000000000000000000000000000000"
end

def push_to_branch? ref
def push_to_branch?(ref)
ref =~ /refs\/heads/
end

def is_default_branch? ref
def is_default_branch?(ref)
ref == "refs/heads/#{project.default_branch}"
end

def commit_user commit
def commit_user(commit)
User.find_for_commit(commit.author_email, commit.author_name) || user
end
end
2 changes: 1 addition & 1 deletion app/workers/repository_import_worker.rb
Expand Up @@ -19,4 +19,4 @@ def perform(project_id)
project.import_fail
end
end
end
end

0 comments on commit db36645

Please sign in to comment.