1
1
package org .nqm .command ;
2
2
3
- import static java .lang .System .out ;
3
+ import static java .lang .System .out ; // NOSONAR
4
4
import static org .nqm .command .Wrapper .deployVertx ;
5
5
import static org .nqm .command .Wrapper .forEachModuleDo ;
6
6
import static org .nqm .command .Wrapper .forEachModuleWith ;
@@ -66,12 +66,12 @@ void checkoutNewBranch(@Parameters(index = "0", paramLabel = "<new_branch_name>"
66
66
System .exit (0 ); // TODO: should centralize system exit to 1 place?
67
67
}
68
68
Consumer <Path > deployCommand = path -> deployVertx (path , "checkout" , "-b" , newBranch );
69
- if (streamOf (input ).filter (ALL_MODULES ::equals ). findFirst (). isPresent ( )) {
69
+ if (streamOf (input ).anyMatch (ALL_MODULES ::equals )) {
70
70
forEachModuleDo (deployCommand );
71
71
return ;
72
72
}
73
73
74
- if (streamOf (input ).filter (ALL_SUBMODULES ::equals ). findFirst (). isPresent ( )) {
74
+ if (streamOf (input ).anyMatch (ALL_SUBMODULES ::equals )) {
75
75
forEachSubmoduleDo (deployCommand );
76
76
return ;
77
77
}
@@ -88,7 +88,7 @@ void checkoutNewBranch(@Parameters(index = "0", paramLabel = "<new_branch_name>"
88
88
}
89
89
}
90
90
91
- private static Stream <String > streamOf (String [] input ) throws IOException {
91
+ private static Stream <String > streamOf (String [] input ) {
92
92
return Stream .of (input ).map (String ::trim ).distinct ();
93
93
}
94
94
@@ -114,7 +114,7 @@ void push(@Parameters(index = "0", paramLabel = "<branch name>") String branch,
114
114
115
115
private boolean isSameBranchUnderPath (String branch , Path path ) {
116
116
try {
117
- var proc = new ProcessBuilder ("git" , "branch" , "--show-current" )
117
+ var proc = new ProcessBuilder (GisConfig . GIT_HOME_DIR , "branch" , "--show-current" )
118
118
.directory (path .toFile ())
119
119
.start ();
120
120
var currentBranch = new BufferedReader (new InputStreamReader (proc .getInputStream ())).readLine ();
@@ -130,10 +130,7 @@ private boolean isConfirmed(String question) {
130
130
out .print (question + " " );
131
131
try (var reader = new BufferedReader (new InputStreamReader (System .in ))) {
132
132
var input = reader .readLine ();
133
- return Stream .of (new String [] { "y" , "ye" , "yes" })
134
- .filter (s -> s .equalsIgnoreCase (input ))
135
- .findFirst ()
136
- .isPresent ();
133
+ return Stream .of ("y" , "ye" , "yes" ).anyMatch (s -> s .equalsIgnoreCase (input ));
137
134
}
138
135
catch (IOException e ) {
139
136
GisLog .debug (e );
0 commit comments