Xiaoven / codegex

A light-weight tools like spotbugs
GNU Lesser General Public License v2.1
1 stars 0 forks source link

尽量使用 get_exact_lineno 方法 #135

Closed Xiaoven closed 3 years ago

Xiaoven commented 3 years ago

ES_COMPARING_STRINGS_WITH_EQ

遇到一个不知道什么版本的 Java 项目,我们的 parser 不能准确地划分它的 statements,但是如果用 get_exact_lineno 还是可以得到准确的行数的

#else
     public #class($command.name)(#class($command.getProperty("Requires").getValue()) subsystem) {
     public #class($command.name)(#if($command.getProperty("DoubleSupplier 1").getValue() != "None")DoubleSupplier doublesupplier1, #end#if($command.getProperty("DoubleSupplier 2").getValue() != "None")DoubleSupplier doublesupplier2, #end#class($command.getProperty("Requires").getValue()) subsystem) {

 #end
#set($params = $command.getProperty("Parameters").getValue())
#macro( klass $cmd )#if( "#type($cmd)" == "" )CommandBase#else#type($cmd)#end#end
 import edu.wpi.first.wpilibj2.command.CommandBase;
Xiaoven commented 3 years ago
https://github.com/silaev/mongodb-replica-set/pull/6/files/fab77ca9fba77d2691db86761930fc24141bb0be#diff-5c42bb0d839e6da6b1e962b16247b3fad82eec9e7f9171c432b32a6b3ce250bbR1296

@@ -1279,7 +1293,7 @@ private String getReplicaSetReConfigUnsetSlaveDelay() {
             ).collect(Collectors.joining(
                 ";\n",
                "cfg = rs.conf();\n",
-                 ";\nrs.reconfig(cfg, {force : true, maxTimeMS: 5000})")
+                 String.format(";\nrs.reconfig(cfg, {force : true, maxTimeMS: %d})", RECONFIG_MAX_TIME_MS))
             );
Xiaoven commented 3 years ago

Closed by #142