Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[JENKINS-75341] Sort deprecated plugins in alphabetical order #10358

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions core/src/main/java/hudson/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
Expand All @@ -114,7 +115,6 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
Expand Down Expand Up @@ -2661,7 +2661,10 @@
public Map<PluginWrapper, String> getDeprecatedPlugins() {
return Jenkins.get().getPluginManager().getPlugins().stream()
.filter(PluginWrapper::isDeprecated)
.collect(Collectors.toMap(Function.identity(), it -> it.getDeprecations().get(0).url));
.sorted(Comparator.comparing(PluginWrapper::getDisplayName)) // Sort by plugin name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use String.CASE_INSENSITIVE in the Comparator to deal with mixed lowercase and uppercase plugin names

.collect(LinkedHashMap::new,
(map, plugin) -> map.put(plugin, plugin.getDeprecations().get(0).url),

Check warning on line 2666 in core/src/main/java/hudson/PluginManager.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 2666 is not covered by tests
Map::putAll);
}
}

Expand Down
Loading