Browse Source

[checkstyle] optimize java code checkstyle for LeftCurly rule (#1375)

pull/2/head
lamber-ken 5 years ago committed by qiaozhanwei
parent
commit
769b0537f1
  1. 3
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ServiceModelToSwagger2MapperImpl.java
  2. 3
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java
  3. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/FourLetterWordMain.java
  4. 4
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java
  5. 8
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/AbstractZKClient.java
  6. 3
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/TaskQueueImplTest.java
  7. 3
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java
  8. 21
      style/checkstyle.xml

3
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ServiceModelToSwagger2MapperImpl.java

@ -156,8 +156,7 @@ public class ServiceModelToSwagger2MapperImpl extends ServiceModelToSwagger2Mapp
List<String> list = new ArrayList<String>(tagsSet.size()); List<String> list = new ArrayList<String>(tagsSet.size());
Iterator<String> it = from.getTags().iterator(); Iterator<String> it = from.getTags().iterator();
while(it.hasNext()) while(it.hasNext()){
{
String tag = it.next(); String tag = it.next();
list.add(StringUtils.isNotBlank(tag) ? messageSource.getMessage(tag, null, tag, locale) : " "); list.add(StringUtils.isNotBlank(tag) ? messageSource.getMessage(tag, null, tag, locale) : " ");
} }

3
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java

@ -451,8 +451,7 @@ public class ResourcesController extends BaseController{
@GetMapping(value = "/udf-func/update-ui") @GetMapping(value = "/udf-func/update-ui")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
public Result viewUIUdfFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result viewUIUdfFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) @RequestParam("id") int id) {
{
logger.info("login user {}, query udf{}", logger.info("login user {}, query udf{}",
loginUser.getUserName(), id); loginUser.getUserName(), id);
try { try {

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/FourLetterWordMain.java

@ -45,8 +45,7 @@ public class FourLetterWordMain {
* @throws java.io.IOException io exceptions * @throws java.io.IOException io exceptions
*/ */
public static String send4LetterWord(String host, int port, String cmd) public static String send4LetterWord(String host, int port, String cmd)
throws IOException throws IOException {
{
return send4LetterWord(host, port, cmd, DEFAULT_SOCKET_TIMEOUT); return send4LetterWord(host, port, cmd, DEFAULT_SOCKET_TIMEOUT);
} }
/** /**
@ -59,8 +58,7 @@ public class FourLetterWordMain {
* @throws java.io.IOException io exceptions * @throws java.io.IOException io exceptions
*/ */
public static String send4LetterWord(String host, int port, String cmd, int timeout) public static String send4LetterWord(String host, int port, String cmd, int timeout)
throws IOException throws IOException {
{
LOG.info("connecting to " + host + " " + port); LOG.info("connecting to " + host + " " + port);
Socket sock = new Socket(); Socket sock = new Socket();
InetSocketAddress hostaddress= host != null ? new InetSocketAddress(host, port) : InetSocketAddress hostaddress= host != null ? new InetSocketAddress(host, port) :

4
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/ExecutionStatus.java

@ -119,7 +119,9 @@ public enum ExecutionStatus {
* status is cancel * status is cancel
* @return status * @return status
*/ */
public boolean typeIsCancel(){ return this == KILL || this == STOP ;} public boolean typeIsCancel(){
return this == KILL || this == STOP ;
}
} }

8
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/zk/AbstractZKClient.java

@ -419,13 +419,17 @@ public abstract class AbstractZKClient {
* *
* @return get worker node parent path * @return get worker node parent path
*/ */
protected String getWorkerZNodeParentPath(){return conf.getString(Constants.ZOOKEEPER_DOLPHINSCHEDULER_WORKERS);}; protected String getWorkerZNodeParentPath(){
return conf.getString(Constants.ZOOKEEPER_DOLPHINSCHEDULER_WORKERS);
}
/** /**
* *
* @return get master node parent path * @return get master node parent path
*/ */
protected String getMasterZNodeParentPath(){return conf.getString(Constants.ZOOKEEPER_DOLPHINSCHEDULER_MASTERS);} protected String getMasterZNodeParentPath(){
return conf.getString(Constants.ZOOKEEPER_DOLPHINSCHEDULER_MASTERS);
}
/** /**
* *

3
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/queue/TaskQueueImplTest.java

@ -94,8 +94,7 @@ public class TaskQueueImplTest extends StandaloneZKServerForTest {
public void extremeTest(){ public void extremeTest(){
int total = 30 * 10000; int total = 30 * 10000;
for(int i = 0; i < total; i++) for(int i = 0; i < total; i++) {
{
for(int j = 0; j < total; j++) { for(int j = 0; j < total; j++) {
//${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskId} //${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskId}
//format ${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskId} //format ${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskId}

3
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/TaskRecordDao.java

@ -93,8 +93,7 @@ public class TaskRecordDao {
* @param filterMap filterMap * @param filterMap filterMap
* @return sql string * @return sql string
*/ */
private static String getWhereString(Map<String, String> filterMap) private static String getWhereString(Map<String, String> filterMap) {
{
if(filterMap.size() ==0){ if(filterMap.size() ==0){
return ""; return "";
} }

21
style/checkstyle.xml

@ -37,16 +37,25 @@
</module> </module>
<module name="TreeWalker"> <module name="TreeWalker">
<module name="OuterTypeFilename">
<property name="severity" value="error"/>
</module>
<module name="OuterTypeFilename"/> <module name="OneTopLevelClass">
<property name="severity" value="error"/>
<module name="OneTopLevelClass"/> </module>
<module name="NoLineWrap"/> <module name="NoLineWrap">
<property name="severity" value="error"/>
</module>
<module name="NeedBraces"/> <module name="NeedBraces">
<property name="severity" value="error"/>
</module>
<module name="LeftCurly"/> <module name="LeftCurly">
<property name="severity" value="error"/>
</module>
<module name="AvoidNestedBlocks"> <module name="AvoidNestedBlocks">
<property name="allowInSwitchCase" value="true"/> <property name="allowInSwitchCase" value="true"/>

Loading…
Cancel
Save