Skip to content

Commit

Permalink
Make the linter pass
Browse files Browse the repository at this point in the history
  • Loading branch information
hellcp committed Mar 19, 2022
1 parent 951df68 commit ff565a2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
ruby-version: [2.7, 3.0, 3.1]
ruby-version: ['2.7', '3.0', '3.1']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Expand Up @@ -27,7 +27,7 @@ Metrics/BlockLength:
# Offense count: 3
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 208
Max: 218

# Offense count: 16
# Configuration parameters: IgnoredMethods.
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/download_controller.rb
Expand Up @@ -151,9 +151,7 @@ def get_project(distro, baseproject)
project = baseproject
unless @distributions.nil?
distribution = @distributions.find { |d| d[:reponame] == distro }
unless distribution.nil?
project = distribution[:project]
end
project = distribution[:project] unless distribution.nil?
end
project
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/package_controller.rb
Expand Up @@ -41,7 +41,7 @@ def show
@official_projects = @distributions.map { |d| d[:project] }
# get extra distributions that are not in the default distribution list
@extra_packages = @packages.reject { |p| @distributions.map { |d| d[:project] }.include? p.baseproject }
@extra_dists = @extra_packages.map(&:baseproject).reject(&:nil?).uniq.map { |d| { project: d } }
@extra_dists = @extra_packages.map(&:baseproject).compact.uniq.map { |d| { project: d } }
rescue OBSError
@hide_search_box = true
flash.now[:error] = _('Connection to OBS is unavailable. Functionality of this site is limited.')
Expand Down
10 changes: 5 additions & 5 deletions test/helper/search_helper_test.rb
Expand Up @@ -5,10 +5,10 @@

class SearchHelperTest < ActionView::TestCase
test 'trust level should be accurate' do
assert_equal 3, trust_level(OpenStruct.new(name: 'foo', project: 'openSUSE:Factory'), 'openSUSE:Factory')
assert_equal 3, trust_level(OpenStruct.new(name: 'foo', project: 'openSUSE:Factory:Update'), 'openSUSE:Factory')
assert_equal 3, trust_level(OpenStruct.new(name: 'foo', project: 'openSUSE:Factory:NonFree'), 'openSUSE:Factory')
assert_equal 1, trust_level(OpenStruct.new(name: 'foo', project: 'some:project'), 'openSUSE:Factory')
assert_equal 0, trust_level(OpenStruct.new(name: 'foo', project: 'home:bob'), 'openSUSE:Factory')
assert_equal 3, trust_level(Struct.new(name: 'foo', project: 'openSUSE:Factory'), 'openSUSE:Factory')
assert_equal 3, trust_level(Struct.new(name: 'foo', project: 'openSUSE:Factory:Update'), 'openSUSE:Factory')
assert_equal 3, trust_level(Struct.new(name: 'foo', project: 'openSUSE:Factory:NonFree'), 'openSUSE:Factory')
assert_equal 1, trust_level(Struct.new(name: 'foo', project: 'some:project'), 'openSUSE:Factory')
assert_equal 0, trust_level(Struct.new(name: 'foo', project: 'home:bob'), 'openSUSE:Factory')
end
end

0 comments on commit ff565a2

Please sign in to comment.