Skip to content

Commit

Permalink
Auto-correct Rubocop offenses
Browse files Browse the repository at this point in the history
The excluded files were not possible to be fixed with auto-correct since
Rubocop raised an "Infinite loop" error.
  • Loading branch information
saraycp committed Jul 6, 2021
1 parent 37bffed commit d650bb8
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 26 deletions.
13 changes: 2 additions & 11 deletions src/api/.rubocop_todo.yml
@@ -1,33 +1,24 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 100`
# on 2021-07-05 15:45:43 UTC using RuboCop version 1.18.1.
# on 2021-07-06 08:33:56 UTC using RuboCop version 1.18.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 321
# Offense count: 307
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: aligned, indented
Layout/LineEndStringConcatenationIndentation:
Exclude:
- 'app/controllers/statistics_controller.rb'
- 'app/controllers/webui/architectures_controller.rb'
- 'app/controllers/webui/patchinfo_controller.rb'
- 'app/jobs/project_create_auto_cleanup_requests_job.rb'
- 'app/models/buildresult.rb'
- 'app/models/kiwi/image.rb'
- 'app/models/owner_search/missing.rb'
- 'config/initializers/nokogiri_builder.rb'
- 'spec/controllers/distributions_controller_spec.rb'
- 'spec/controllers/webui/package_controller_spec.rb'
- 'spec/controllers/webui/packages/branches_controller_spec.rb'
- 'spec/controllers/webui/packages/build_reason_controller_spec.rb'
- 'spec/controllers/webui/patchinfo_controller_spec.rb'
- 'spec/controllers/webui/project_controller_spec.rb'
- 'spec/controllers/webui/repositories_controller_spec.rb'
- 'spec/controllers/webui/session_controller_spec.rb'
- 'spec/factories/packages.rb'
- 'spec/mixins/build_log_support_spec.rb'
- 'spec/mixins/parse_package_diff_spec.rb'
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/controllers/statistics_controller.rb
Expand Up @@ -21,7 +21,7 @@ def highest_rated
# response.time_to_live = 10.minutes

ratings = Rating.select('db_object_id, db_object_type, count(score) as count,' \
'sum(score)/count(score) as score_calculated').group('db_object_id, db_object_type').order('score_calculated DESC')
'sum(score)/count(score) as score_calculated').group('db_object_id, db_object_type').order('score_calculated DESC')
ratings = ratings.to_a.delete_if { |r| r.count.to_i < min_votes_for_rating }
@ratings = if @limit
ratings[0..@limit - 1]
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/architectures_controller.rb
Expand Up @@ -15,7 +15,7 @@ def update
status = :ok
else
flash.now[:error] = "Updating architecture '#{architecture.name}' failed: " \
"#{architecture.errors.full_messages.to_sentence}"
"#{architecture.errors.full_messages.to_sentence}"
status = :unprocessable_entity
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/patchinfo_controller.rb
Expand Up @@ -124,7 +124,7 @@ def new_tracker

def print_invalid_format(invalid_format)
"#{invalid_format.strip} has no valid format. (Correct formats are e.g. " \
'boo#123456, CVE-1234-5678 and the string has to be a comma-separated list)'
'boo#123456, CVE-1234-5678 and the string has to be a comma-separated list)'
end

def get_binaries
Expand Down
10 changes: 5 additions & 5 deletions src/api/app/models/buildresult.rb
Expand Up @@ -20,21 +20,21 @@ class Buildresult
STATUS_DESCRIPTION = {
succeeded: 'Package has built successfully and can be used to build further packages.',
failed: 'The package does not build successfully. No packages have been created. Packages ' \
'that depend on this package will be built using any previously created packages, if they exist.',
'that depend on this package will be built using any previously created packages, if they exist.',
unresolvable: 'The build can not begin, because required packages are either missing or not explicitly defined.',
broken: 'The sources either contain no build description (e.g. specfile), automatic source processing failed or a ' \
'merge conflict does exist.',
'merge conflict does exist.',
blocked: 'This package waits for other packages to be built. These can be in the same or other projects.',
scheduled: 'A package has been marked for building, but the build has not started yet.',
dispatching: 'A package is being copied to a build host. This is an intermediate state before building.',
building: 'The package is currently being built.',
signing: 'The package has been built successfully and is assigned to get signed.',
finished: 'The package has been built and signed, but has not yet been picked up by the scheduler. This is an ' \
"intermediate state prior to 'succeeded' or 'failed'.",
"intermediate state prior to 'succeeded' or 'failed'.",
disabled: 'The package has been disabled from building in project or package metadata. ' \
'Packages that depend on this package will be built using any previously created packages, if they still exist.',
'Packages that depend on this package will be built using any previously created packages, if they still exist.',
excluded: 'The package build has been disabled in package build description (for example in the .spec file) or ' \
'does not provide a matching build description for the target.',
'does not provide a matching build description for the target.',
locked: 'The package is frozen',
unknown: 'The scheduler has not yet evaluated this package. Should be a short intermediate state for new packages.'
}.with_indifferent_access.freeze
Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/controllers/webui/package_controller_spec.rb
Expand Up @@ -762,7 +762,7 @@ def do_request(params)
</resultlist>))

path = "#{CONFIG['source_url']}/build/#{source_project}/#{repo_leap_42_2}/i586/_builddepinfo" \
"?package=#{source_package}:multibuild-package&view=revpkgnames"
"?package=#{source_package}:multibuild-package&view=revpkgnames"
stub_request(:get, path).and_return(body: %(<builddepinfo>
<package name="#{source_package}:multibuild-package">
<source>apache2</source>
Expand Down
Expand Up @@ -51,7 +51,7 @@
context 'for packages without a build reason' do
before do
path = "#{CONFIG['source_url']}/build/#{source_project.name}/#{repo_for_source_project.name}/" \
"#{repo_for_source_project.architectures.first.name}/#{package.name}/_reason"
"#{repo_for_source_project.architectures.first.name}/#{package.name}/_reason"
stub_request(:get, path).and_return(body:
%(<reason>\n <explain/> <time/> <oldsource/> </reason>))

Expand All @@ -69,7 +69,7 @@
context 'for valid requests' do
before do
path = "#{CONFIG['source_url']}/build/#{source_project.name}/#{repo_for_source_project.name}/" \
"#{repo_for_source_project.architectures.first.name}/#{package.name}/_reason"
"#{repo_for_source_project.architectures.first.name}/#{package.name}/_reason"
stub_request(:get, path).and_return(body:
%(<reason>\n <explain>source change</explain> <time>1496387771</time> <oldsource>1de56fdc419ea4282e35bd388285d370</oldsource></reason>))

Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/controllers/webui/project_controller_spec.rb
Expand Up @@ -590,7 +590,7 @@

it do
expect(flash[:error]).to eq("Project can't be unlocked: Unlock of maintenance incident #{user.home_project.name} is not possible," \
" because there is a running release request: #{bs_request.id}")
" because there is a running release request: #{bs_request.id}")
end
end
end
Expand Down
Expand Up @@ -164,8 +164,8 @@

it {
expect(flash[:error]).to eq('Can not add repository: ' \
'Name is too short (minimum is 1 character) and ' \
"Name must not start with '_' or contain any of these characters ':/'")
'Name is too short (minimum is 1 character) and ' \
"Name must not start with '_' or contain any of these characters ':/'")
}

it { is_expected.to redirect_to(root_url) }
Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/controllers/webui/session_controller_spec.rb
Expand Up @@ -78,7 +78,7 @@
it 'informs users about failed kerberos authentication and possible cause' do
expect(response.body).to have_text('Kerberos authentication required')
expect(response.body).to have_text('You are seeing this page, because you are ' \
"not authenticated in the kerberos realm ('test_realm.com').")
"not authenticated in the kerberos realm ('test_realm.com').")
end
end
end
Expand Down

0 comments on commit d650bb8

Please sign in to comment.