Skip to content

Commit

Permalink
Merge pull request #4000 from bgeuken/add_some_rubocop_rules
Browse files Browse the repository at this point in the history
Enable some more rubocop rules
  • Loading branch information
bgeuken committed Oct 12, 2017
2 parents a63a93f + d3c072e commit 17d3aff
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 98 deletions.
57 changes: 0 additions & 57 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ Layout/AlignParameters:
Exclude:
- 'src/api/app/views/statistics/rating.xml.builder'

# Offense count: 1
# Cop supports --auto-correct.
Layout/BlockEndNewline:
Exclude:
- 'src/api/app/views/source/productlist.xml.builder'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentOneStep, IndentationWidth.
Expand Down Expand Up @@ -254,64 +248,13 @@ Layout/MultilineMethodCallIndentation:
Layout/MultilineOperationIndentation:
Enabled: false

# Offense count: 39
# Cop supports --auto-correct.
Layout/SpaceAfterColon:
Exclude:
- 'src/api/app/models/incident_updateinfo_counter_value.rb'
- 'src/api/test/functional/maintenance_test.rb'
- 'src/api/test/functional/product_test.rb'
- 'src/api/test/functional/source_controller_test.rb'

# Offense count: 3
# Cop supports --auto-correct.
Layout/SpaceAfterComma:
Exclude:
- 'src/api/app/views/public/binary_packages.xml.builder'
- 'src/api/app/views/status/project.xml.builder'
- 'src/api/app/views/webui/feeds/commits.atom.builder'

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleInsidePipes, SupportedStylesInsidePipes.
# SupportedStylesInsidePipes: space, no_space
Layout/SpaceAroundBlockParameters:
Exclude:
- 'src/api/app/views/result/packageresult.xml.builder'
- 'src/api/app/views/result/projectresult.xml.builder'

# Offense count: 1
# Cop supports --auto-correct.
Layout/SpaceAroundKeyword:
Exclude:
- 'src/api/app/views/person/userinfo.xml.builder'

# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Layout/SpaceAroundOperators:
Exclude:
- 'src/api/app/views/attribute/attribute_definition.xml.builder'
- 'src/api/app/views/attribute/namespace_definition.xml.builder'
- 'src/api/app/views/models/_project.xml.builder'
- 'src/api/app/views/person/tokenlist.xml.builder'
- 'src/api/app/views/search/missing_owner.xml.builder'
- 'src/api/app/views/search/owner.xml.builder'
- 'src/api/app/views/webui/feeds/commits.atom.builder'

# Offense count: 68
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: space, no_space
Layout/SpaceBeforeBlockBraces:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Layout/SpaceBeforeComma:
Exclude:
- 'src/api/app/views/tag/_tagged_objects_with_tags.xml.builder'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/incident_updateinfo_counter_value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def self.find_or_create(time, updateinfo_counter, project)

# not yet released, get an uniq counter value for this incident and scheme
IncidentUpdateinfoCounterValue.create(released_at: time,
updateinfo_counter:updateinfo_counter,
updateinfo_counter: updateinfo_counter,
project: project,
value: updateinfo_counter.increase)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ xml.definition(p) do |attr|
abies = @at.attrib_type_modifiable_bies.includes(:user, :group, :role)
if abies.length > 0
abies.each do |mod_rule|
p={}
p = {}
p[:user] = mod_rule.user.login if mod_rule.user
p[:group] = mod_rule.group.title if mod_rule.group
p[:role] = mod_rule.role.title if mod_rule.role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ abies = @an.attrib_namespace_modifiable_bies.includes([:user, :group])
if abies.length > 0
xml.namespace(:name => @an.name) do |an|
abies.each do |mod_rule|
p={}
p = {}
p[:user] = mod_rule.user.login if mod_rule.user
p[:group] = mod_rule.group.title if mod_rule.group
an.modifiable_by(p)
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/models/_project.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ xml.project(project_attributes) do
end
repo.path_elements.includes(:link).each do |pe|
if pe.link.remote_project_name.present?
project_name = pe.link.project.name+":"+pe.link.remote_project_name
project_name = pe.link.project.name + ":" + pe.link.remote_project_name
else
project_name = pe.link.project.name
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/person/tokenlist.xml.builder
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
xml.directory(count: @list.length) do |dir|
@list.each do |token|
p={ :id => token.id, :string => token.string }
p = { :id => token.id, :string => token.string }
if token.package
p[:project] = token.package.project.name
p[:package] = token.package.name
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/person/userinfo.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ xml.person do
xml.email @render_user.email
xml.realname @render_user.realname

if( @render_user.watched_projects.count > 0 )
if @render_user.watched_projects.count > 0
xml.watchlist do
@render_user.watched_projects.each do |wp|
xml.project :name => wp.name
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/public/binary_packages.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ xml.package :project => @pkg.project.name, :package => @pkg.name do
xml.title @pkg.title
xml.description @pkg.description
xml.binaries do
@binary_links.each do |repo,arr|
@binary_links.each do |repo, arr|
xml.list(:distribution => repo) do
xml.ymp arr[:ymp] if arr[:ymp]
xml.repository arr[:repository] if arr[:repository]
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/result/packageresult.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ xml.packageresult( "project" => @project, "repository" => @repository,
xml.packagecount( @succeeded, "state" => "succeeded" )
xml.packagecount( @failed, "state" => "failed" )
end
@arch_status.each do | a, s |
@arch_status.each do |a, s|
xml.archresult( "arch" => a ) do
xml.status( "code" => s["code"] ) do
if ( s["summary"] )
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/views/result/projectresult.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ xml.projectresult( "project" => @project ) do
xml.packagecount( @building, "state" => "building" )
xml.packagecount( @delayed, "state" => "delayed" )
end
@repository_status.each do | r, arch_status |
@repository_status.each do |r, arch_status|
xml.repositoryresult( "name" => r ) do
arch_status.each do | a, s |
arch_status.each do |a, s|
xml.archresult( "arch" => a ) do
xml.status( "code" => s )
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/search/missing_owner.xml.builder
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
xml.collection do
@owners.each do |o|

attribs={}
attribs = {}
attribs[:rootproject] = o[:rootproject]
attribs[:project] = o[:project]
attribs[:package] = o[:package] if o[:package]
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/search/owner.xml.builder
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
xml.collection do
@owners.each do |o|

attribs={}
attribs = {}
attribs[:rootproject] = o[:rootproject]
attribs[:project] = o[:project]
attribs[:package] = o[:package] if o[:package]
Expand Down
3 changes: 2 additions & 1 deletion src/api/app/views/source/productlist.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ xml.productlist( count: @products.count ) do
@products.map { |p| xml.product(name: p.name, cpe: p.cpe,
originproject: p.package.project.name,
originpackage: p.package.name,
mtime: p.package.updated_at.to_i) }
mtime: p.package.updated_at.to_i)
}
end

4 changes: 2 additions & 2 deletions src/api/app/views/webui/feeds/commits.atom.builder
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ xml.feed(feed_opts) do |feed|
div.dl do |dl|
dl.dt "Package"
dl.dd do |dd|
url = url_for(:only_path => false, :controller => 'package', :action => 'rdiff', :project => @project.name,
url = url_for(:only_path => false, :controller => 'package', :action => 'rdiff', :project => @project.name,
:package => package, :rev => commit.additional_info['rev'], :linkrev => 'base')
dd.a package, href: url
end
Expand All @@ -48,7 +48,7 @@ xml.feed(feed_opts) do |feed|
end
div.p "Additional information:"
div.dl do |dl|
commit.additional_info.each do |k,v|
commit.additional_info.each do |k, v|
dl.dt k
dl.dd v
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/functional/maintenance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ def test_create_maintenance_project_and_release_packages
assert_match(/DUMMY bnc#1042/, @response.body)
get "/source/#{incident_project}/pack2.BaseDistro2.0_LinkedUpdateProject?view=issues"
assert_response :success
assert_xml_tag parent: { tag: 'issue', attributes: {change:"added"} },
assert_xml_tag parent: { tag: 'issue', attributes: {change: "added"} },
tag: 'name', content: '1042'

# add a new package with defined link target
Expand Down
12 changes: 6 additions & 6 deletions src/api/test/functional/product_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ def test_simple_product_file
run_scheduler('local')
get "/build/home:Iggy/_result"
assert_response :success
assert_xml_tag parent: {tag: "result", attributes: {project:"home:Iggy", repository:"10.2", arch:"i586"} },
assert_xml_tag parent: {tag: "result", attributes: {project: "home:Iggy", repository: "10.2", arch: "i586"} },
tag: "status", attributes: { package: 'TestPack', code: 'scheduled' }
get "/build/home:tom:temporary/_result"
assert_response :success
assert_xml_tag parent: {tag: "result", attributes: {project:"home:tom:temporary", repository:"images", arch:"local"} },
assert_xml_tag parent: {tag: "result", attributes: {project: "home:tom:temporary", repository: "images", arch: "local"} },
tag: "status", attributes: { package: '_product:simple-cd-cd-i586_x86_64', code: 'blocked' }

login_king
Expand All @@ -180,20 +180,20 @@ def test_simple_product_file
run_scheduler('local') # run first, so the waiting_for are still there
get "/build/home:tom:temporary/_result"
assert_response :success
assert_xml_tag parent: {tag: "result", attributes: {project:"home:tom:temporary", repository:"images", arch:"local"} },
assert_xml_tag parent: {tag: "result", attributes: {project: "home:tom:temporary", repository: "images", arch: "local"} },
tag: "status", attributes: { package: '_product:simple-cd-cd-i586_x86_64', code: 'blocked' }
run_scheduler('i586') # but they get removed now ...
run_scheduler('x86_64')
run_scheduler('local') # check that i586 & x86_64 schedulers removed waiting_for
get "/build/home:Iggy/_result"
assert_response :success
assert_xml_tag parent: {tag: "result", attributes: {project:"home:Iggy", repository:"10.2", arch:"i586"} },
assert_xml_tag parent: {tag: "result", attributes: {project: "home:Iggy", repository: "10.2", arch: "i586"} },
tag: "status", attributes: { package: 'TestPack', code: 'succeeded' }
assert_xml_tag parent: {tag: "result", attributes: {project:"home:Iggy", repository:"10.2", arch:"x86_64"} },
assert_xml_tag parent: {tag: "result", attributes: {project: "home:Iggy", repository: "10.2", arch: "x86_64"} },
tag: "status", attributes: { package: 'TestPack', code: 'succeeded' }
get "/build/home:tom:temporary/_result"
assert_response :success
assert_xml_tag parent: {tag: "result", attributes: {project:"home:tom:temporary", repository:"images", arch:"local"} },
assert_xml_tag parent: {tag: "result", attributes: {project: "home:tom:temporary", repository: "images", arch: "local"} },
tag: "status", attributes: { package: '_product:simple-cd-cd-i586_x86_64', code: 'scheduled' }

delete "/source/home:Iggy/TestPack/DUMMY_CHANGE"
Expand Down
38 changes: 19 additions & 19 deletions src/api/test/functional/source_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2445,9 +2445,9 @@ def test_branch_repository_with_extra_policy
assert_response :success
get '/source/home:adrian:branches:home:adrian:TEMP/_meta'
assert_response :success
assert_xml_tag(tag: 'repository', attributes: {name:"repo1", rebuild: "local", block: "never"})
assert_xml_tag(tag: 'repository', attributes: {name:"repo2", rebuild: "local", block: "never"})
assert_xml_tag(tag: 'repository', attributes: {name:"repo3", rebuild: "local", block: "never"})
assert_xml_tag(tag: 'repository', attributes: {name: "repo1", rebuild: "local", block: "never"})
assert_xml_tag(tag: 'repository', attributes: {name: "repo2", rebuild: "local", block: "never"})
assert_xml_tag(tag: 'repository', attributes: {name: "repo3", rebuild: "local", block: "never"})
delete '/source/home:adrian:branches:home:adrian:TEMP'
assert_response :success

Expand All @@ -2456,9 +2456,9 @@ def test_branch_repository_with_extra_policy
assert_response :success
get '/source/home:adrian:branches:home:adrian:TEMP/_meta'
assert_response :success
assert_xml_tag(tag: 'repository', attributes: {name:"repo1", rebuild: "local"})
assert_xml_tag(tag: 'repository', attributes: {name:"repo2", rebuild: "transitive"})
assert_xml_tag(tag: 'repository', attributes: {name:"repo3"})
assert_xml_tag(tag: 'repository', attributes: {name: "repo1", rebuild: "local"})
assert_xml_tag(tag: 'repository', attributes: {name: "repo2", rebuild: "transitive"})
assert_xml_tag(tag: 'repository', attributes: {name: "repo3"})
delete '/source/home:adrian:branches:home:adrian:TEMP'
assert_response :success

Expand Down Expand Up @@ -2495,9 +2495,9 @@ def test_branch_repository_attribute_tests
assert_response :success
get '/source/home:adrian:branches:home:adrian:TEMP/_meta'
assert_response :success
assert_xml_tag(tag: 'repository', attributes: {name:"repo1"})
assert_xml_tag(tag: 'repository', attributes: {name:"repo2"})
assert_xml_tag(tag: 'repository', attributes: {name:"repo3"})
assert_xml_tag(tag: 'repository', attributes: {name: "repo1"})
assert_xml_tag(tag: 'repository', attributes: {name: "repo2"})
assert_xml_tag(tag: 'repository', attributes: {name: "repo3"})
delete '/source/home:adrian:branches:home:adrian:TEMP'
assert_response :success

Expand All @@ -2513,10 +2513,10 @@ def test_branch_repository_attribute_tests
assert_response :success
get '/source/home:adrian:branches:home:adrian:TEMP/_meta'
assert_response :success
assert_xml_tag(tag: 'repository', attributes: {name:"BaseDistro_repo"})
assert_no_xml_tag(tag: 'repository', attributes: {name:"repo1"})
assert_no_xml_tag(tag: 'repository', attributes: {name:"repo2"})
assert_no_xml_tag(tag: 'repository', attributes: {name:"repo3"})
assert_xml_tag(tag: 'repository', attributes: {name: "BaseDistro_repo"})
assert_no_xml_tag(tag: 'repository', attributes: {name: "repo1"})
assert_no_xml_tag(tag: 'repository', attributes: {name: "repo2"})
assert_no_xml_tag(tag: 'repository', attributes: {name: "repo3"})
delete '/source/home:adrian:branches:home:adrian:TEMP'
assert_response :success
delete "/source/home:adrian:TEMP/_attribute/OBS:BranchRepositoriesFromProject"
Expand All @@ -2534,19 +2534,19 @@ def test_branch_repository_attribute_tests
assert_response :success
get '/source/home:adrian:branches:home:adrian:TEMP/_meta'
assert_response :success
assert_no_xml_tag(tag: 'repository', attributes: {name:"repo1"})
assert_xml_tag(tag: 'repository', attributes: {name:"repo2"})
assert_no_xml_tag(tag: 'repository', attributes: {name:"repo3"})
assert_no_xml_tag(tag: 'repository', attributes: {name: "repo1"})
assert_xml_tag(tag: 'repository', attributes: {name: "repo2"})
assert_no_xml_tag(tag: 'repository', attributes: {name: "repo3"})
delete '/source/home:adrian:branches:home:adrian:TEMP'
assert_response :success
# again as maintenance branch
post '/source/home:adrian:TEMP/dummy', params: { cmd: 'branch', maintenance: 1 }
assert_response :success
get '/source/home:adrian:branches:home:adrian:TEMP/_meta'
assert_response :success
assert_no_xml_tag(tag: 'repository', attributes: {name:"home_adrian_TEMP_repo1"})
assert_xml_tag(tag: 'repository', attributes: {name:"home_adrian_TEMP_repo2"})
assert_no_xml_tag(tag: 'repository', attributes: {name:"home_adrian_TEMP_repo3"})
assert_no_xml_tag(tag: 'repository', attributes: {name: "home_adrian_TEMP_repo1"})
assert_xml_tag(tag: 'repository', attributes: {name: "home_adrian_TEMP_repo2"})
assert_no_xml_tag(tag: 'repository', attributes: {name: "home_adrian_TEMP_repo3"})
delete '/source/home:adrian:branches:home:adrian:TEMP'
assert_response :success

Expand Down

0 comments on commit 17d3aff

Please sign in to comment.