[3.0] Code reformat (#8019)

* convert files, add checker

* rename id

* tab to space

* change git attributes auto convert

* fix end new line

* fix end new line

* fix end new line

* ignore generated files

* override tomcat-embed-core version

* add ignore for codestyle/checkstyle.xml

* add ignore for codestyle/checkstyle.xml

* add rat ignore

* add suppression

* force update

* disable zk dynamic configurator
This commit is contained in:
Albumen Kevin 2021-06-10 20:13:39 +08:00 committed by GitHub
parent 724ec8b554
commit 0e66de1c61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
728 changed files with 42286 additions and 42213 deletions

24
.gitattributes vendored
View File

@ -1,4 +1,20 @@
# Git will understand that all files specified are not text,
# and it should not try to change them.
# This will prevent file formatting (such as `crlf` endings to `lf` endings) while commit.
* -text
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Auto detect text files and perform LF normalization
* text=auto
*.java text eol=lf

View File

@ -39,7 +39,25 @@ jobs:
- name: "Build Dubbo with Maven"
run: |
cd ./dubbo
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress clean source:jar install -Pjacoco,rat,checkstyle -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
./mvnw --batch-mode -U -e --no-transfer-progress clean source:jar install -Pjacoco,rat,checkstyle -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
- name: "Pack rat file if failure"
if: failure()
run: 7z a ${{ github.workspace }}/rat.zip *rat.txt -r
- name: "Upload rat file if failure"
if: failure()
uses: actions/upload-artifact@v2
with:
name: "rat-file"
path: ${{ github.workspace }}/rat.zip
- name: "Pack checkstyle file if failure"
if: failure()
run: 7z a ${{ github.workspace }}/checkstyle.zip *checkstyle* -r
- name: "Upload checkstyle file if failure"
if: failure()
uses: actions/upload-artifact@v2
with:
name: "checkstyle-file"
path: ${{ github.workspace }}/checkstyle.zip
- name: "Calculate Dubbo Version"
id: dubbo-version
run: |
@ -72,22 +90,13 @@ jobs:
- name: "Test with Maven with Integration Tests"
timeout-minutes: 40
if: ${{ startsWith( matrix.os, 'ubuntu') }}
run: ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress clean test verify -Pjacoco -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false -DskipIntegrationTests=false -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
run: ./mvnw --batch-mode -U -e --no-transfer-progress clean test verify -Pjacoco -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false -DskipIntegrationTests=false -Dcheckstyle.skip=false -Dcheckstyle_unix.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
- name: "Test with Maven without Integration Tests"
env:
DISABLE_FILE_SYSTEM_TEST: true
timeout-minutes: 50
if: ${{ startsWith( matrix.os, 'windows') }}
run: ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress clean test verify -Pjacoco -D"http.keepAlive=false" -D"maven.wagon.http.pool=false" -D"maven.wagon.httpconnectionManager.ttlSeconds=120" -D"maven.wagon.http.retryHandler.count=5" -DskipTests=false -DskipIntegrationTests=true -D"checkstyle.skip=false" -D"rat.skip=false" -D"maven.javadoc.skip=true"
- name: "Pack rat file if failure"
if: failure()
run: 7z a ${{ github.workspace }}/rat.zip *rat.txt -r
- name: "Upload rat file if failure"
if: failure()
uses: actions/upload-artifact@v2
with:
name: "rat-file-${{ matrix.os }}-JDK${{ matrix.jdk }}"
path: ${{ github.workspace }}/rat.zip
run: ./mvnw --batch-mode -U -e --no-transfer-progress clean test verify -Pjacoco -D"http.keepAlive=false" -D"maven.wagon.http.pool=false" -D"maven.wagon.httpconnectionManager.ttlSeconds=120" -D"maven.wagon.http.retryHandler.count=5" -DskipTests=false -DskipIntegrationTests=true -D"checkstyle.skip=false" -D"checkstyle_unix.skip=true" -D"rat.skip=false" -D"maven.javadoc.skip=true"
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v1

View File

@ -4,5 +4,6 @@
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]com[\\/]alibaba[\\/]com[\\/]caucho[\\/]hessian" checks=".*"/>
<suppress files="[\\/]build[\\/]generated[\\/]source[\\/]proto" checks=".*"/>
<suppress files="Yylex\.java" checks="AvoidEscapedUnicodeCharacters"/>
</suppressions>

View File

@ -12,6 +12,10 @@
<property name="fileExtensions" value="java"/>
</module>
<module name="FileTabCharacter">
<property name="fileExtensions" value="java,xml"/>
</module>
<!-- TreeWalker Checks -->
<module name="TreeWalker">
<module name="SuppressWarningsHolder"/>

View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf" />
</module>
</module>

View File

@ -64,6 +64,7 @@
<exclude>**/.classpath</exclude>
<exclude>**/.project</exclude>
<exclude>**/target/**</exclude>
<exclude>**/generated/**</exclude>
<exclude>**/*.log</exclude>
<exclude>CONTRIBUTING.md</exclude>
<exclude>README.md</exclude>

View File

@ -16,14 +16,14 @@
*/
package org.apache.dubbo.rpc.cluster.router.state;
import java.util.List;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.cluster.Directory;
import java.util.List;
/**
* State Router. (SPI, Prototype, ThreadSafe)
* <p>

View File

@ -18,16 +18,15 @@
package org.apache.dubbo.config;
import com.alibaba.dubbo.config.ArgumentConfig;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class ArgumentConfigTest {
@Test

View File

@ -18,12 +18,11 @@
package org.apache.dubbo.config;
import com.alibaba.dubbo.config.ConsumerConfig;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class ConsumerConfigTest {
@Test

View File

@ -18,17 +18,16 @@
package org.apache.dubbo.config;
import com.alibaba.dubbo.config.ProtocolConfig;
import org.junit.jupiter.api.Test;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class ProtocolConfigTest {

View File

@ -18,18 +18,17 @@
package org.apache.dubbo.config;
import com.alibaba.dubbo.config.ProviderConfig;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
public class ProviderConfigTest {
@Test

View File

@ -31,8 +31,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.mock;
public class SerializationTest {

View File

@ -18,6 +18,7 @@ package org.apache.dubbo.config.spring.propertyconfigurer.provider;
import org.apache.dubbo.config.spring.api.HelloService;
import org.apache.dubbo.rpc.RpcContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -32,6 +32,7 @@ import org.apache.curator.test.TestingServer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
@ -48,6 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* TODO refactor using mockito
*/
@Disabled("Disabled Due to Zookeeper in Github Actions")
public class ZookeeperDynamicConfigurationTest {
private static CuratorFramework client;

View File

@ -22,6 +22,7 @@ import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.RpcInvocation;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;

View File

@ -19,6 +19,7 @@ package org.apache.dubbo.auth;
import org.apache.dubbo.auth.model.AccessKeyPair;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invocation;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

View File

@ -21,6 +21,7 @@ import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.junit.jupiter.api.Test;
import static org.mockito.ArgumentMatchers.anyString;

View File

@ -37,6 +37,12 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>

View File

@ -20,8 +20,8 @@ import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.common.status.StatusChecker;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.ProviderConfig;
import org.apache.dubbo.config.context.ConfigManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;

View File

@ -21,6 +21,7 @@ import org.apache.dubbo.common.Version;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.boot.logging.LoggingApplicationListener;
import org.springframework.context.ApplicationListener;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;

View File

@ -24,7 +24,6 @@ import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.ProviderConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.junit.After;
import org.junit.Assert;

View File

@ -24,7 +24,6 @@ import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.ProviderConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.junit.After;
import org.junit.Assert;

25
pom.xml
View File

@ -125,6 +125,7 @@
<apache-rat-plugin.version>0.13</apache-rat-plugin.version>
<arguments />
<checkstyle.skip>true</checkstyle.skip>
<checkstyle_unix.skip>true</checkstyle_unix.skip>
<rat.skip>true</rat.skip>
<jacoco.skip>true</jacoco.skip>
<revision>3.0.0-SNAPSHOT</revision>
@ -257,6 +258,7 @@
<id>checkstyle</id>
<properties>
<checkstyle.skip>false</checkstyle.skip>
<checkstyle_unix.skip>false</checkstyle_unix.skip>
</properties>
</profile>
<profile>
@ -308,12 +310,34 @@
**/org/apache/dubbo/triple/TripleWrapper.java,
**/istio/v1/auth/Ca.java,
**/istio/v1/auth/IstioCertificateServiceGrpc.java,
**/generated/**/*,
**/target/**/*,
</excludes>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
<execution>
<id>checkstyle-unix-validation</id>
<phase>validate</phase>
<configuration>
<configLocation>codestyle/checkstyle_unix.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failOnViolation>true</failOnViolation>
<skip>${checkstyle_unix.skip}</skip>
<resourceExcludes>
**/target/**/*
</resourceExcludes>
<resourceExcludes>
**/generated/**/*
</resourceExcludes>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
@ -610,6 +634,7 @@
</exclude>
<exclude>.github/**</exclude>
<exclude>compiler/**</exclude>
<exclude>**/generated/**</exclude>
<!-- exclude mockito extensions spi files -->
<exclude>**/mockito-extensions/*</exclude>
</excludes>