Skip to content
New issue

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

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

Already on GitHub? Sign in 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 1 commit
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
6 changes: 5 additions & 1 deletion core/src/main/java/hudson/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -2661,7 +2662,10 @@ public boolean isActivated() {
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),
Map::putAll);
}
}

Expand Down