Skip to content

Commit

Permalink
Merge pull request #2809 from mschnitzer/enable_rubocop_style_colon_m…
Browse files Browse the repository at this point in the history
…ethod_call

Enable Style/ColonMethodCall Rubocop cop
  • Loading branch information
Ana06 committed Mar 13, 2017
2 parents b2fa0c8 + 5f9c5f8 commit fd8ea5a
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 27 deletions.
4 changes: 4 additions & 0 deletions src/api/.rubocop.yml
Expand Up @@ -32,6 +32,10 @@ Style/AndOr:
Style/AsciiComments:
Enabled: true

# Checks for methods invoked via the :: operator
Style/ColonMethodCall:
Enabled: true

# Use ` or %x around command literals.
Style/CommandLiteral:
EnforcedStyle: percent_x
Expand Down
13 changes: 0 additions & 13 deletions src/api/.rubocop_todo.yml
Expand Up @@ -338,19 +338,6 @@ Style/ClosingParenthesisIndentation:
Exclude:
- 'test/unit/project_test.rb'

# Offense count: 14
# Cop supports --auto-correct.
Style/ColonMethodCall:
Exclude:
- 'app/controllers/configurations_controller.rb'
- 'app/controllers/webui/package_controller.rb'
- 'app/helpers/webui/project_helper.rb'
- 'app/mixins/build_log_support.rb'
- 'app/models/issue_tracker.rb'
- 'config/application.rb'
- 'config/initializers/activexml.rb'
- 'config/unicorn/development.rb'

# Offense count: 18
# Cop supports --auto-correct.
# Configuration parameters: Keywords.
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/controllers/configurations_controller.rb
Expand Up @@ -49,8 +49,8 @@ def update

# is it defined in options.yml
if value && !value.blank?
v = ::Configuration::map_value( key, value )
ov = ::Configuration::map_value( key, ::Configuration::OPTIONS_YML[key] )
v = ::Configuration.map_value( key, value )
ov = ::Configuration.map_value( key, ::Configuration::OPTIONS_YML[key] )
if ov != v && ov.present?
render_error status: 403, errorcode: 'no_permission_to_change',
message: "The api has a different value for #{key} configured in options.yml file. Remove it there first."
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/controllers/webui/package_controller.rb
Expand Up @@ -849,7 +849,7 @@ def update_build_log
@finished = true
else
@log_chunk = chunk
@offset += ActiveXML::backend.last_body_length
@offset += ActiveXML.backend.last_body_length
end

rescue Timeout::Error, IOError
Expand Down Expand Up @@ -973,7 +973,7 @@ def rpmlint_result

def get_rpmlint_log(project, package, repository, architecture)
path = "/build/#{pesc project}/#{pesc repository}/#{pesc architecture}/#{pesc package}/rpmlint.log"
ActiveXML::backend.direct_http(URI(path), timeout: 500)
ActiveXML.backend.direct_http(URI(path), timeout: 500)
end

def rpmlint_log
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/helpers/webui/project_helper.rb
Expand Up @@ -7,7 +7,7 @@ def show_status_comment(comment, package, firstfail, comments_to_clear)
status_comment_html = ''.html_safe
if comment
# TODO: Port _to_remote helpers to jQuery
status_comment_html = ERB::Util::h(comment)
status_comment_html = ERB::Util.h(comment)
if !firstfail
if User.current.can_modify_project?(@project.api_obj)
status_comment_html += ' '.html_safe + link_to(image_tag('comment_delete.png', size: '16x16', alt: 'Clear'),
Expand Down
8 changes: 4 additions & 4 deletions src/api/app/mixins/build_log_support.rb
Expand Up @@ -4,7 +4,7 @@ module BuildLogSupport
def raw_log_chunk( project, package, repo, arch, start, theend )
logger.debug "get log chunk #{start}-#{theend}"
path = "/build/#{pesc project}/#{pesc repo}/#{pesc arch}/#{pesc package}/_log?nostream=1&start=#{start}&end=#{theend}"
ActiveXML::backend.direct_http URI("#{path}"), timeout: 500
ActiveXML.backend.direct_http URI("#{path}"), timeout: 500
end

def get_log_chunk( project, package, repo, arch, start, theend )
Expand All @@ -30,7 +30,7 @@ def get_log_chunk( project, package, repo, arch, start, theend )
def get_size_of_log( project, package, repo, arch)
logger.debug 'get log entry'
path = "/build/#{pesc project}/#{pesc repo}/#{pesc arch}/#{pesc package}/_log?view=entry"
data = ActiveXML::backend.direct_http URI("#{path}"), timeout: 500
data = ActiveXML.backend.direct_http URI("#{path}"), timeout: 500
return 0 unless data
doc = Xmlhash.parse(data)
doc.elements('entry') do |e|
Expand All @@ -41,13 +41,13 @@ def get_size_of_log( project, package, repo, arch)

def get_job_status( project, package, repo, arch)
path = "/build/#{pesc project}/#{pesc repo}/#{pesc arch}/#{pesc package}/_jobstatus"
ActiveXML::backend.direct_http URI("#{path}"), timeout: 500
ActiveXML.backend.direct_http URI("#{path}"), timeout: 500
end

def get_status(project, package, repo, arch)
path = "/build/#{pesc project}/_result?view=status&package=#{pesc package}&arch=#{pesc arch}&repository=#{pesc repo}"
code = ""
data = ActiveXML::backend.direct_http URI("#{path}"), timeout: 500
data = ActiveXML.backend.direct_http URI("#{path}"), timeout: 500
return code unless data
doc = Xmlhash.parse(data)
if doc['result'] && doc['result']['status'] && doc['result']['status']['code']
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/issue_tracker.rb
Expand Up @@ -50,7 +50,7 @@ def valid_issue_name?(name)
def show_url_for(issue, html = nil)
return unless issue
url = show_url.gsub('@@@', issue)
return "<a href=\"#{url}\">#{CGI::escapeHTML(show_label_for(issue))}</a>" if html
return "<a href=\"#{url}\">#{CGI.escapeHTML(show_label_for(issue))}</a>" if html
url
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/config/application.rb
Expand Up @@ -5,7 +5,7 @@
# Assets should be precompiled for production (so we don't need the gems loaded then)
Bundler.require(*Rails.groups(assets: %w(development test)))
require_relative '../lib/engines/base.rb'
OBSEngine::load_engines
OBSEngine.load_engines

module OBSApi
class Application < Rails::Application
Expand Down
4 changes: 2 additions & 2 deletions src/api/config/initializers/activexml.rb
Expand Up @@ -3,7 +3,7 @@
CONFIG['source_protocol'] ||= 'http'
CONFIG['api_relative_url_root'] ||= ''

map = ActiveXML::setup_transport_backend(CONFIG['source_protocol'], CONFIG['source_host'], CONFIG['source_port'])
map = ActiveXML.setup_transport_backend(CONFIG['source_protocol'], CONFIG['source_host'], CONFIG['source_port'])

map.connect :directory, 'rest:///source/:project/:package?:expand&:rev&:meta&:linkrev&:emptylink&:view&:extension&:lastworking&:withlinked&:deleted'
map.connect :jobhistory, 'rest:///build/:project/:repository/:arch/_jobhistory?:package&:limit&:code'
Expand Down Expand Up @@ -33,7 +33,7 @@
end
end

map = ActiveXML::setup_transport_api(CONFIG['frontend_protocol'], CONFIG['frontend_host'], CONFIG['frontend_port'], CONFIG['api_relative_url_root'])
map = ActiveXML.setup_transport_api(CONFIG['frontend_protocol'], CONFIG['frontend_host'], CONFIG['frontend_port'], CONFIG['api_relative_url_root'])

map.connect :webuiproject, 'rest:///source/:name/_meta?:view',
delete: 'rest:///source/:name?:force',
Expand Down
2 changes: 1 addition & 1 deletion src/api/config/unicorn/development.rb
Expand Up @@ -4,6 +4,6 @@
after_fork do |server, _|
listener = server.listener_opts.first[0]
port = Integer(listener.split(':')[1])
ActiveXML::api.port = port
ActiveXML.api.port = port
CONFIG['frontend_port'] = port
end

0 comments on commit fd8ea5a

Please sign in to comment.