Skip to content

Commit

Permalink
[ci] Enable the Style/ExtraSpacing Rubocop cop
Browse files Browse the repository at this point in the history
This cop checks for extra/unnecessary whitespace.
  • Loading branch information
Ana06 committed Dec 5, 2016
1 parent 1d306d0 commit 2631253
Show file tree
Hide file tree
Showing 56 changed files with 91 additions and 93 deletions.
4 changes: 4 additions & 0 deletions src/api/.rubocop.yml
Expand Up @@ -57,6 +57,10 @@ Style/EachWithObject:
# Avoid empty else statements.
Style/EmptyElse:
EnforcedStyle: both

# Checks for extra/unnecessary whitespace
Style/ExtraSpacing:
Enabled: true

# Checks hash literal syntax
Style/HashSyntax:
Expand Down
6 changes: 0 additions & 6 deletions src/api/.rubocop_todo.yml
Expand Up @@ -432,12 +432,6 @@ Style/DotPosition:
Style/EmptyLiteral:
Enabled: false

# Offense count: 85
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
Style/ExtraSpacing:
Enabled: false

# Offense count: 22
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/controllers/search_controller.rb
Expand Up @@ -92,7 +92,7 @@ def owner

def predicate_from_match_parameter(p)
pred = case p
when /^\(\[(.*)\]\)$/
when /^\(\[(.*)\]\)$/
$1
when /^\[(.*)\]$/
$1
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/controllers/source_controller.rb
Expand Up @@ -767,7 +767,7 @@ def check_permissions_for_file
if @package_name == '_project' || @package_name == '_pattern'
@allowed = permissions.project_change? @prj

if @file == '_attribute' && @package_name == '_project'
if @file == '_attribute' && @package_name == '_project'
raise WrongRouteForAttribute.new "Attributes need to be changed through #{change_attribute_path(project: params[:project])}"
end
else
Expand Down
12 changes: 6 additions & 6 deletions src/api/app/controllers/tag_controller.rb
Expand Up @@ -22,7 +22,7 @@ def get_tagged_projects_by_user
project = Project.find(tagging.taggable_id)
tag = Tag.find(tagging.tag_id)
@projects_tags[project] = [] if @projects_tags[project].nil?
@projects_tags[project] << tag
@projects_tags[project] << tag
end
@projects_tags.keys.each do |key|
@projects_tags[key].sort!{ |a, b| a.name.downcase <=> b.name.downcase }
Expand All @@ -39,7 +39,7 @@ def get_tagged_packages_by_user
package = Package.find(tagging.taggable_id)
tag = Tag.find(tagging.tag_id)
@packages_tags[package] = [] if @packages_tags[package].nil?
@packages_tags[package] << tag
@packages_tags[package] << tag
end
@packages_tags.keys.each do |key|
@packages_tags[key].sort!{ |a, b| a.name.downcase <=> b.name.downcase }
Expand Down Expand Up @@ -137,7 +137,7 @@ def get_tags_by_user_and_project( do_render = true )
end
end

def get_tags_by_user_and_package( do_render = true )
def get_tags_by_user_and_package( do_render = true )
user = User.find_by_login!(params[:user])
@type = "package"

Expand Down Expand Up @@ -197,7 +197,7 @@ def project_tags

# update_tags_by_project_and_user(request_data)

@tags = taglistXML_to_tags(request_data)
@tags = taglistXML_to_tags(request_data)

save_tags(@project, @tagCreator, @tags)

Expand Down Expand Up @@ -238,7 +238,7 @@ def package_tags
# taglistXML = "<the whole xml/>"
@taglistXML = request_data

@tags = taglistXML_to_tags(request_data)
@tags = taglistXML_to_tags(request_data)

save_tags(@package, @tagCreator, @tags)

Expand Down Expand Up @@ -303,7 +303,7 @@ def taglistXML_to_tags(taglistXML)

xml = Xmlhash.parse(taglistXML)

xml.elements("tag") do |tag|
xml.elements("tag") do |tag|
taglist << tag["name"]
end

Expand Down
6 changes: 3 additions & 3 deletions src/api/app/controllers/webui/package_controller.rb
Expand Up @@ -49,7 +49,7 @@ def show
params.delete(:srcmd5)
end

@srcmd5 = params[:srcmd5]
@srcmd5 = params[:srcmd5]
@revision_parameter = params[:rev]

@bugowners_mail = (@package.bugowner_emails + @project.api_obj.bugowner_emails).uniq
Expand Down Expand Up @@ -373,7 +373,7 @@ def package_files( rev = nil, expand = nil )
@serviceinfo = dir.find_first(:serviceinfo)
dir.each(:entry) do |entry|
file = Hash[*[:name, :size, :mtime, :md5].map {|x| [x, entry.value(x.to_s)]}.flatten]
file[:viewable] = !Package.is_binary_file?(file[:name]) && file[:size].to_i < 2**20 # max. 1 MB
file[:viewable] = !Package.is_binary_file?(file[:name]) && file[:size].to_i < 2**20 # max. 1 MB
file[:editable] = file[:viewable] && !file[:name].match(/^_service[_:]/)
file[:srcmd5] = dir.value(:srcmd5)
files << file
Expand Down Expand Up @@ -1079,7 +1079,7 @@ def file_available? url, max_redirects = 5
http = Net::HTTP.new(uri.host, uri.port)
http.open_timeout = 15
http.read_timeout = 15
response = http.head uri.path
response = http.head uri.path
if response.code.to_i == 302 && response['location'] && max_redirects > 0
return file_available? response['location'], (max_redirects - 1)
end
Expand Down
8 changes: 4 additions & 4 deletions src/api/app/controllers/webui/project_controller.rb
Expand Up @@ -568,9 +568,9 @@ def save_meta
end
end

rescue Suse::ValidationError => exception
rescue Suse::ValidationError => exception
errors << exception.message
rescue Project::UnknownObjectError => exception
rescue Project::UnknownObjectError => exception
errors << "Project with name '#{exception.message}' not found"
end

Expand All @@ -589,7 +589,7 @@ def prjconf

@content = @project.config.to_s(sliced_params.to_h)
unless @content
flash[:error] = @project.config.errors.full_messages.to_sentence
flash[:error] = @project.config.errors.full_messages.to_sentence
redirect_to controller: 'project', nextstatus: 404
return
end
Expand Down Expand Up @@ -856,7 +856,7 @@ def call_diststats(bdep, jobs)
f=File.open(outdir + '/longest.xml')
longest = Xmlhash.parse(f.read)
longest['timings'].elements('package') do |p|
@timings[p['name']] = [p['buildtime'], p['finished'] ]
@timings[p['name']] = [p['buildtime'], p['finished'] ]
end
@rebuildtime = Integer(longest['rebuildtime'])
f.close
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/helpers/webui/patchinfo_helper.rb
Expand Up @@ -15,7 +15,7 @@ def issue_link( issue )
if issue[0] == "CVE"
content_tag(:li, link_to("#{issue[1]}", issue[2]) + ": #{issue[3]}")
else
content_tag(:li, link_to("#{issue[0]}##{issue[1]}", issue[2]) + ": #{issue[3]}")
content_tag(:li, link_to("#{issue[0]}##{issue[1]}", issue[2]) + ": #{issue[3]}")
end
end
end
10 changes: 5 additions & 5 deletions src/api/app/models/attrib.rb
Expand Up @@ -65,14 +65,14 @@ def project
end

def values_editable?
!attrib_type.value_count || # If unlimited values
(attrib_type.value_count && attrib_type.value_count > 0) || # If value_count > 0
attrib_type.issue_list # If issue_list true
!attrib_type.value_count || # If unlimited values
(attrib_type.value_count && attrib_type.value_count > 0) || # If value_count > 0
attrib_type.issue_list # If issue_list true
end

def values_removeable?
!attrib_type.value_count || # If unlimited values
(attrib_type.value_count && (attrib_type.value_count != values.length)) # If value_count != values.length
!attrib_type.value_count || # If unlimited values
(attrib_type.value_count && (attrib_type.value_count != values.length)) # If value_count != values.length
end

def cachekey
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/bs_request.rb
Expand Up @@ -417,7 +417,7 @@ def permission_check_change_state!(opts)

def changestate_accepted(opts)
# all maintenance_incident actions go into the same incident project
incident_project = nil # .where(type: 'maintenance_incident')
incident_project = nil # .where(type: 'maintenance_incident')
bs_request_actions.each do |action|
source_project = Project.find_by_name(action.source_project)
if action.source_project && action.is_maintenance_release?
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/bs_request_action.rb
Expand Up @@ -8,7 +8,7 @@ class BsRequestAction < ApplicationRecord
VALID_SOURCEUPDATE_OPTIONS = ['update', 'noupdate', 'cleanup']

#### Self config
class DiffError < APIException; setup 404; end # a diff error can have many reasons, but most likely something within us
class DiffError < APIException; setup 404; end # a diff error can have many reasons, but most likely something within us
class RemoteSource < APIException; end
class RemoteTarget < APIException; end
class InvalidReleaseTarget < APIException; end
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/models/flag.rb
Expand Up @@ -62,7 +62,7 @@ def compute_status(variant)
arch_flag = main_object.project.flags.find_by("flag = ? AND repo IS NULL AND architecture_id = ?", flag, architecture_id) unless
all_flag || arch_flag
all_flag = main_object.project.flags.find_by("flag = ? AND repo IS NULL AND architecture_id IS NULL", flag) unless all_flag
elsif variant == 'default'
elsif variant == 'default'
same_flag = main_object.project.flags.find_by("flag = ? AND repo = ? AND architecture_id = ?", flag, repo, architecture_id) unless same_flag
repo_flag = main_object.project.flags.find_by("flag = ? AND repo = ? AND architecture_id IS NULL", flag, repo) unless repo_flag
arch_flag = main_object.project.flags.find_by("flag = ? AND repo IS NULL AND architecture_id = ?", flag, architecture_id) unless arch_flag
Expand All @@ -75,7 +75,7 @@ def compute_status(variant)
return repo_flag.status if repo_flag
return arch_flag.status if arch_flag
return all_flag.status if all_flag
elsif variant == 'default'
elsif variant == 'default'
if same_flag
return repo_flag.status if repo_flag
return arch_flag.status if arch_flag
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/models/issue.rb
Expand Up @@ -99,12 +99,12 @@ def render_body(node, change = nil)
p[:change] = change if change
node.issue(p) do |issue|
issue.created_at(created_at)
issue.updated_at(updated_at) if updated_at
issue.updated_at(updated_at) if updated_at
issue.name(name)
issue.tracker(issue_tracker.name)
issue.label(label)
issue.url(url)
issue.state(state) if state
issue.state(state) if state
issue.summary(summary) if summary

if owner_id
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/owner.rb
Expand Up @@ -29,7 +29,7 @@ def self.search(params, obj)
params[:attribute] ||= "OBS:OwnerRootProject"
at = AttribType.find_by_name!(params[:attribute])

limit = params[:limit] || 1
limit = params[:limit] || 1

projects = []
if obj.is_a? Project
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/package.rb
Expand Up @@ -602,7 +602,7 @@ def update_product_list
end

def self.detect_package_kinds(directory)
raise ArgumentError.new 'neh!' if directory.has_key? 'time'
raise ArgumentError.new 'neh!' if directory.has_key? 'time'
ret = []
directory.elements('entry') do |e|
%w{patchinfo aggregate link channel}.each do |kind|
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/repository.rb
Expand Up @@ -104,7 +104,7 @@ def cleanup_before_destroy
end

def project_name
return project.name if project
return project.name if project
remote_project_name
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/user.rb
Expand Up @@ -609,7 +609,7 @@ def can_create_attribute_definition?(object)
raise ArgumentError, "illegal parameter type to User#can_change?: #{object.class.name}"
end

return true if is_admin?
return true if is_admin?

abies = object.attrib_namespace_modifiable_bies.includes([:user, :group])
abies.each do |mod_rule|
Expand Down
2 changes: 1 addition & 1 deletion src/api/config.ru
@@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', __FILE__)
require ::File.expand_path('../config/environment', __FILE__)
run OBSApi::Application
2 changes: 1 addition & 1 deletion src/api/config/deploy.rb
Expand Up @@ -6,7 +6,7 @@

# git settings
set :scm, :git
set :repository, "git://github.com/openSUSE/open-build-service.git"
set :repository, "git://github.com/openSUSE/open-build-service.git"
set :branch, "2.3"
set :deploy_via, :remote_cache
set :git_enable_submodules, 1
Expand Down
2 changes: 1 addition & 1 deletion src/api/config/environments/stage.rb
Expand Up @@ -10,7 +10,7 @@

# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_controller.perform_caching = true

# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
Expand Down
2 changes: 1 addition & 1 deletion src/api/config/routes.rb
Expand Up @@ -60,7 +60,7 @@ def self.public_or_about_path?(request)
collection do
get ':project(/:package)/new' => :new, constraints: cons, as: 'new'
get ':project(/:package)/:attribute/edit' => :edit, constraints: cons, as: 'edit'
get ':project(/:package)' => :index, constraints: cons, as: 'index'
get ':project(/:package)' => :index, constraints: cons, as: 'index'
end
end

Expand Down
@@ -1,4 +1,4 @@
class AddOwnerRootProjectAttribType < ActiveRecord::Migration
class AddOwnerRootProjectAttribType < ActiveRecord::Migration
def self.up
p={}
p[:role] = Role.find_by_title("Admin")
Expand Down
@@ -1,4 +1,4 @@
class MakeObsRejectrequestsConfigurable < ActiveRecord::Migration
class MakeObsRejectrequestsConfigurable < ActiveRecord::Migration
def self.up
a = AttribType.find_by_id(AttribType.find_by_name("OBS:RejectRequests"))
a.value_count = nil
Expand Down
@@ -1,4 +1,4 @@
class AddReleaseTargetConstraints < ActiveRecord::Migration
class AddReleaseTargetConstraints < ActiveRecord::Migration
def self.up
sql =<<-END_SQL
alter table release_targets add FOREIGN KEY (repository_id) references repositories (id);
Expand Down
4 changes: 2 additions & 2 deletions src/api/db/migrate/20130626160000_attribute_issue_marker.rb
@@ -1,8 +1,8 @@
class AttributeIssueMarker < ActiveRecord::Migration
class AttributeIssueMarker < ActiveRecord::Migration
def self.up
ans = AttribNamespace.find_by_name "OBS"

at=AttribType.create( attrib_namespace: ans, name: "Issues", value_count: 0 )
at=AttribType.create( attrib_namespace: ans, name: "Issues", value_count: 0 )
p={}
p[:bs_role_id] = Role.find_by_title("maintainer").id
at.attrib_type_modifiable_bies.create(p)
Expand Down
@@ -1,4 +1,4 @@
class AddObsBranchRepositoriesAttribute < ActiveRecord::Migration
class AddObsBranchRepositoriesAttribute < ActiveRecord::Migration
class AttribTypeModifiableBy < ActiveRecord::Base; end

def self.up
Expand Down
@@ -1,4 +1,4 @@
class AutoCleanupAttribute < ActiveRecord::Migration
class AutoCleanupAttribute < ActiveRecord::Migration
class AttribTypeModifiableBy < ActiveRecord::Base; end

def self.up
Expand Down
6 changes: 3 additions & 3 deletions src/api/db/migrate/20140624101042_add_package_tracking.rb
@@ -1,13 +1,13 @@
class AddPackageTracking < ActiveRecord::Migration
def up
create_table :binary_releases do |t|
t.references :repository, null: false # this destroys the entry when it gets removed
t.references :repository, null: false # this destroys the entry when it gets removed
t.integer :operation, null: false
t.datetime :obsolete_time # set when binary gets deleted or modified later
t.datetime :obsolete_time # set when binary gets deleted or modified later

t.integer :release_package_id

t.string :binary_name, null: false
t.string :binary_name, null: false
t.string :binary_epoch, limit: 64
t.string :binary_version, null: false, limit: 64
t.string :binary_release, null: false, limit: 64
Expand Down
Expand Up @@ -2,11 +2,11 @@ class AddGenericOperationHistory < ActiveRecord::Migration
def self.up
create_table :history_elements do |t|
t.string :type, null: false
t.integer :op_object_id, null: false # id of request/project/...
t.integer :op_object_id, null: false # id of request/project/...
t.datetime :created_at, null: false
t.references :user, null: false
t.string :description_extension # by code
t.text :comment # by user
t.string :description_extension # by code
t.text :comment # by user
end

add_index :history_elements, :created_at
Expand Down
2 changes: 1 addition & 1 deletion src/api/db/migrate/20140916135426_project_maintains.rb
@@ -1,4 +1,4 @@
class ProjectMaintains < ActiveRecord::Migration
class ProjectMaintains < ActiveRecord::Migration
class OldProject < ActiveRecord::Base
self.table_name = 'projects'
end
Expand Down
@@ -1,4 +1,4 @@
class TrackProductMediaArchs < ActiveRecord::Migration
class TrackProductMediaArchs < ActiveRecord::Migration
def self.up
add_column :product_media, :arch_filter_id, :integer
add_column :product_update_repositories, :arch_filter_id, :integer
Expand Down
2 changes: 1 addition & 1 deletion src/api/db/migrate/20141001135426_group_subscriptions.rb
@@ -1,4 +1,4 @@
class GroupSubscriptions < ActiveRecord::Migration
class GroupSubscriptions < ActiveRecord::Migration
def self.up
add_column :event_subscriptions, :group_id, :integer
add_index :event_subscriptions, :group_id
Expand Down

0 comments on commit 2631253

Please sign in to comment.