Skip to content

Commit

Permalink
1.add maven-site-plugin,p3c-pmd 生成代码PMD结果
Browse files Browse the repository at this point in the history
2.fixed 参数类型 RouteDest作为map的key,没有重写hashCode和equals
  • Loading branch information
hongdaDu authored and zilongTong committed Mar 26, 2022
1 parent 5002908 commit 3b5bf8f
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,82 @@ public String getExpression() {
public void setExpression(String expression) {
this.expression = expression;
}

@Override
public boolean equals(Object o) {
if (o == this) {
return true;
} else if (!(o instanceof TagRule)) {
return false;
} else {
TagRule other = (TagRule)o;
if (!other.canEqual(this)) {
return false;
} else {
label59: {
Object this$id = this.getId();
Object other$id = other.getId();
if (this$id == null) {
if (other$id == null) {
break label59;
}
} else if (this$id.equals(other$id)) {
break label59;
}

return false;
}

Object this$name = this.getName();
Object other$name = other.getName();
if (this$name == null) {
if (other$name != null) {
return false;
}
} else if (!this$name.equals(other$name)) {
return false;
}

Object this$tags = this.getTags();
Object other$tags = other.getTags();
if (this$tags == null) {
if (other$tags != null) {
return false;
}
} else if (!this$tags.equals(other$tags)) {
return false;
}

Object this$expression = this.getExpression();
Object other$expression = other.getExpression();
if (this$expression == null) {
if (other$expression != null) {
return false;
}
} else if (!this$expression.equals(other$expression)) {
return false;
}

return true;
}
}
}

protected boolean canEqual(Object other) {
return other instanceof TagRule;
}

@Override
public int hashCode() {
int result = 1;
Object $id = this.getId();
result = result * 59 + ($id == null ? 43 : $id.hashCode());
Object $name = this.getName();
result = result * 59 + ($name == null ? 43 : $name.hashCode());
Object $tags = this.getTags();
result = result * 59 + ($tags == null ? 43 : $tags.hashCode());
Object $expression = this.getExpression();
result = result * 59 + ($expression == null ? 43 : $expression.hashCode());
return result;
}
}
10 changes: 10 additions & 0 deletions femas-dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -734,4 +734,14 @@

</dependencies>
</dependencyManagement>

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</reporting>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.tencent.tsf.femas.governance.route.entity;

import com.tencent.tsf.femas.common.tag.TagRule;

import java.io.Serializable;

/**
Expand Down Expand Up @@ -51,4 +52,54 @@ public String toString() {
sb.append('}');
return sb.toString();
}

// @Override
// public boolean equals(Object o) {
// if (o == this) {
// return true;
// } else if (!(o instanceof RouteDest)) {
// return false;
// } else {
// RouteDest other = (RouteDest)o;
// if (!other.canEqual(this)) {
// return false;
// } else {
// Object this$destWeight = this.getDestWeight();
// Object other$destWeight = other.getDestWeight();
// if (this$destWeight == null) {
// if (other$destWeight != null) {
// return false;
// }
// } else if (!this$destWeight.equals(other$destWeight)) {
// return false;
// }
//
// Object this$destItemList = this.getDestItemList();
// Object other$destItemList = other.getDestItemList();
// if (this$destItemList == null) {
// if (other$destItemList != null) {
// return false;
// }
// } else if (!this$destItemList.equals(other$destItemList)) {
// return false;
// }
//
// return true;
// }
// }
// }
//
// protected boolean canEqual(Object other) {
// return other instanceof RouteDest;
// }
//
// @Override
// public int hashCode() {
// int result = 1;
// Object destWeight = this.getDestWeight();
// result = result * 59 + (destWeight == null ? 43 : destWeight.hashCode());
// Object destItemList = this.getDestItemList();
// result = result * 59 + (destItemList == null ? 43 : destItemList.hashCode());
// return result;
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ List<ServiceInstance> convert(Service service, List<Instance> ls) {
instance.setHost(i.getIp());
instance.setPort(i.getPort());
instance.setService(service);
instance.setStatus(i.isEnabled() & i.isHealthy() ? EndpointStatus.UP : EndpointStatus.INITIALIZING);
instance.setStatus(i.isEnabled() && i.isHealthy() ? EndpointStatus.UP : EndpointStatus.INITIALIZING);
instances.add(instance);
});
return instances;
Expand Down
60 changes: 58 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
<maven.gpg.version>1.6</maven.gpg.version>
<maven.jacoco.version>0.8.3</maven.jacoco.version>
<maven.jar.version>3.1.0</maven.jar.version>
<maven.pmd-plugin.version>3.8</maven.pmd-plugin.version>
<spring-boot-maven.verson>2.1.16.RELEASE</spring-boot-maven.verson>
<p3c-pmd.version>1.3.0</p3c-pmd.version>
</properties>

<modules>
Expand Down Expand Up @@ -171,6 +173,62 @@
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- 添加该插件后,上述问题解决 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${maven.pmd-plugin.version}</version>
<configuration>
<rulesets>
<ruleset>rulesets/java/ali-comment.xml</ruleset>
<ruleset>rulesets/java/ali-concurrent.xml</ruleset>
<ruleset>rulesets/java/ali-constant.xml</ruleset>
<ruleset>rulesets/java/ali-exception.xml</ruleset>
<ruleset>rulesets/java/ali-flowcontrol.xml</ruleset>
<ruleset>rulesets/java/ali-naming.xml</ruleset>
<ruleset>rulesets/java/ali-oop.xml</ruleset>
<ruleset>rulesets/java/ali-orm.xml</ruleset>
<ruleset>rulesets/java/ali-other.xml</ruleset>
<ruleset>rulesets/java/ali-set.xml</ruleset>
</rulesets>
<printFailingErrors>true</printFailingErrors>
<includes>
<!-- <include>**/*/*/*.java</include>-->
</includes>
<excludes>
<exclude>**/**/*.jar</exclude>
</excludes>
</configuration>
<executions>
<execution>
<phase>site</phase>
<goals>
<goal>pmd</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.alibaba.p3c</groupId>
<artifactId>p3c-pmd</artifactId>
<version>${p3c-pmd.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<!--源代码中的站点国际化-->
<locales>zh_CN</locales>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand All @@ -197,7 +255,6 @@
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<id>oss</id>
Expand Down Expand Up @@ -265,7 +322,6 @@
</distributionManagement>
</profile>
</profiles>

<!-- 添加相关仓库依赖 -->
<repositories>
<repository>
Expand Down

0 comments on commit 3b5bf8f

Please sign in to comment.