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

[Improve code readability] Replace the two boolean variables that control the visibility of security warnings with a single boolean variable (#537) #549

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ private boolean isFileExtension(File pluginFile, String... extensions) {
* @return true if user selected CLI Option to see warnings for specified plugins
*/
private boolean isShowWarnings() {
return showWarnings;
return !hideWarnings;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void setupDefaultsTest() throws Exception {
assertThat(cfg.getPluginDir()).hasToString(Settings.DEFAULT_PLUGIN_DIR_LOCATION);
assertThat(cfg.getJenkinsWar()).isEqualTo(Settings.DEFAULT_WAR);
assertThat(cfg.isShowAllWarnings()).isFalse();
assertThat(cfg.isShowWarnings()).isFalse();
assertThat(cfg.isShowWarnings()).isTrue();
assertThat(cfg.isHideWarnings()).isFalse();
assertThat(cfg.getJenkinsUc()).hasToString(Settings.DEFAULT_UPDATE_CENTER_LOCATION);
assertThat(cfg.getJenkinsUcExperimental()).hasToString(Settings.DEFAULT_EXPERIMENTAL_UPDATE_CENTER_LOCATION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
public class Config {
private final File pluginDir;
private final boolean cleanPluginDir;
private final boolean showWarnings;
private final boolean hideWarnings;
private final boolean showAllWarnings;
private final boolean showAvailableUpdates;
Expand Down Expand Up @@ -60,7 +59,6 @@ public class Config {
private Config(
File pluginDir,
boolean cleanPluginDir,
boolean showWarnings,
boolean showAllWarnings,
boolean showAvailableUpdates,
boolean showPluginsToBeDownloaded,
Expand All @@ -83,7 +81,6 @@ private Config(
boolean hideWarnings) {
this.pluginDir = pluginDir;
this.cleanPluginDir = cleanPluginDir;
this.showWarnings = showWarnings;
this.showAllWarnings = showAllWarnings;
this.showAvailableUpdates = showAvailableUpdates;
this.showPluginsToBeDownloaded = showPluginsToBeDownloaded;
Expand Down Expand Up @@ -116,7 +113,7 @@ public boolean isCleanPluginDir() {
}

public boolean isShowWarnings() {
return showWarnings;
return !hideWarnings;
}

public boolean isHideWarnings() {
Expand Down Expand Up @@ -216,7 +213,6 @@ public LogOutput getLogOutput() {
public static class Builder {
private File pluginDir;
private boolean cleanPluginDir;
private boolean showWarnings;
private boolean hideWarnings;
private boolean showAllWarnings;
private boolean showAvailableUpdates;
Expand Down Expand Up @@ -252,7 +248,7 @@ public Builder withCleanPluginsDir(boolean cleanPluginDir) {
}

public Builder withShowWarnings(boolean showWarnings) {
this.showWarnings = showWarnings;
this.hideWarnings = !showWarnings;
return this;
}

Expand Down Expand Up @@ -372,7 +368,6 @@ public Config build() {
return new Config(
pluginDir,
cleanPluginDir,
showWarnings,
showAllWarnings,
showAvailableUpdates,
showPluginsToBeDownloaded,
Expand Down