-
Notifications
You must be signed in to change notification settings - Fork 202
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
Added plugin information while using verbose #611
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -269,11 +269,14 @@ private String getJenkinsWar() { | |||||
* | ||||||
* @return list of plugins representing user-specified input | ||||||
*/ | ||||||
|
||||||
@SuppressFBWarnings(value = {"PATH_TRAVERSAL_IN", "URLCONNECTION_SSRF_FD"}, justification = "User provided values for running the program.") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to suppress a warning that does not exist in this context.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @MarkEWaite |
||||||
private List<Plugin> getPlugins() { | ||||||
PluginListParser pluginParser = new PluginListParser(verbose); | ||||||
List<Plugin> requestedPlugins = new ArrayList<>(pluginParser.parsePluginsFromCliOption(plugins)); | ||||||
|
||||||
File pluginFile = getPluginFile(); | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the benefit of adding this empty line. It makes more work for reviewers. I think it should be removed.
Suggested change
|
||||||
if (pluginFile != null) { | ||||||
if (isFileExtension(pluginFile, "yaml", "yml")) { | ||||||
requestedPlugins.addAll(pluginParser.parsePluginYamlFile(pluginFile)); | ||||||
|
@@ -283,7 +286,27 @@ private List<Plugin> getPlugins() { | |||||
throw new PluginInputException("Unknown file type, file must have .yaml/.yml or .txt extension"); | ||||||
} | ||||||
} | ||||||
return requestedPlugins; | ||||||
List<String> pluginNames = new ArrayList<>(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like it is generating a list of plugin file names rather than plugin names. Would it be better to rename the variable
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @MarkEWaite |
||||||
|
||||||
File dr = new File(String.valueOf(pluginDir)); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That seems like a very complicated technique to get a File ( Note that this suggestion won't compile. You should rework the change to use pluginDir instead of
Suggested change
|
||||||
|
||||||
File[] directoryListing = dr.listFiles(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to use
Suggested change
|
||||||
if (directoryListing != null) { | ||||||
for (File child : directoryListing) { | ||||||
pluginNames.add(child.getName()); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will add many unnecessary items to the list when run in a Jenkins plugins folder that is used by a running Jenkins controller. I think it would be better to only add the child if it is a plain file (not a directory) and does not have one of the suffixes (".bak", ".pinned", or ".version_from_image").
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @MarkEWaite |
||||||
} | ||||||
} | ||||||
|
||||||
for(Plugin plugin: requestedPlugins){ | ||||||
for(String names:pluginNames) { | ||||||
if ( names.indexOf( plugin.getName() )!= -1) { | ||||||
logVerbose("Plugin " + plugin.getName() + " is already present in the dir"); | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
return requestedPlugins; | ||||||
|
||||||
} | ||||||
|
||||||
/** | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,7 +216,6 @@ public void setupUpdateCenterCliTest() throws Exception { | |
assertThat(cfg.getJenkinsIncrementalsRepoMirror()).hasToString(incrementalsCli); | ||
assertThat(cfg.getJenkinsPluginInfo()).hasToString(pluginInfoCli); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer that you not remove the empty line between tests. I makes it more difficult for me to read. In this case, it seems that is the only change in this file in this pull request, so it should be removed from the pull request. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done @MarkEWaite |
||
@Test | ||
public void setupSecurityWarningsTest() throws CmdLineException { | ||
parser.parseArgument("--view-all-security-warnings", "--view-security-warnings"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other suppress entry in this file does not insert a blank line before the suppression. I think it would be best to not insert this blank line. Let's keep the formatting consistent when we can.