Commit d9d6fd41 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'redundant-sort-cop' into 'master'

Fix Style/RedundantSort cop

See merge request gitlab-org/gitlab!41108
parents c6249a9e d96c73ca
...@@ -638,13 +638,6 @@ Style/RedundantInterpolation: ...@@ -638,13 +638,6 @@ Style/RedundantInterpolation:
Style/RedundantSelf: Style/RedundantSelf:
Enabled: false Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/RedundantSort:
Exclude:
- 'app/presenters/packages/nuget/search_results_presenter.rb'
- 'spec/presenters/packages/nuget/search_results_presenter_spec.rb'
# Offense count: 120 # Offense count: 120
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowInnerSlashes. # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
......
...@@ -49,7 +49,7 @@ module Packages ...@@ -49,7 +49,7 @@ module Packages
def latest_version(packages) def latest_version(packages)
versions = packages.map(&:version).compact versions = packages.map(&:version).compact
VersionSorter.sort(versions).last # rubocop: disable Style/UnneededSort VersionSorter.sort(versions).last # rubocop: disable Style/RedundantSort
end end
end end
end end
......
---
title: Fix Style/RedundantSort cop
merge_request: 41108
author: Rajendra Kadam
type: fixed
...@@ -37,7 +37,7 @@ RSpec.describe Packages::Nuget::SearchResultsPresenter do ...@@ -37,7 +37,7 @@ RSpec.describe Packages::Nuget::SearchResultsPresenter do
expect(package_json[:summary]).to be_blank expect(package_json[:summary]).to be_blank
expect(package_json[:total_downloads]).to eq 0 expect(package_json[:total_downloads]).to eq 0
expect(package_json[:verified]).to be expect(package_json[:verified]).to be
expect(package_json[:version]).to eq VersionSorter.sort(versions).last # rubocop: disable Style/UnneededSort expect(package_json[:version]).to eq VersionSorter.sort(versions).last # rubocop: disable Style/RedundantSort
versions.zip(package_json[:versions]).each do |version, version_json| versions.zip(package_json[:versions]).each do |version, version_json|
expect(version_json[:json_url]).to end_with("#{version}.json") expect(version_json[:json_url]).to end_with("#{version}.json")
expect(version_json[:downloads]).to eq 0 expect(version_json[:downloads]).to eq 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment