From be2c0654a2359de35073e335a3f56ff6991929f5 Mon Sep 17 00:00:00 2001 From: guqing <38999863+guqing@users.noreply.github.com> Date: Tue, 17 May 2022 14:46:11 +0800 Subject: [PATCH] chore: add checkstyle rule (#2091) * feat: add unused imports checkstyle rule * feat: add java doc style rule * fix: check style --- config/checkstyle/checkstyle.xml | 2 ++ .../app/identity/authentication/ProviderSettings.java | 2 +- .../verifier/BearerTokenAuthentication.java | 2 +- .../verifier/BearerTokenAuthenticationEntryPoint.java | 2 +- .../verifier/BearerTokenAuthenticationFilter.java | 4 ++-- .../verifier/BearerTokenAuthenticationToken.java | 4 ++-- .../authentication/verifier/BearerTokenError.java | 4 ++-- .../authentication/verifier/BearerTokenErrors.java | 8 ++++---- .../authentication/verifier/JwtAuthenticationToken.java | 2 +- .../app/identity/authorization/AuthorizingVisitor.java | 2 +- .../app/identity/authorization/RequestInfoFactory.java | 5 +++-- .../java/run/halo/app/identity/authorization/RoleRef.java | 8 ++++---- .../verifyer/BearerTokenAuthenticationTest.java | 2 +- .../verifyer/BearerTokenAuthenticationTokenTest.java | 2 +- .../app/authentication/verifyer/BearerTokenErrorTest.java | 2 +- .../authentication/verifyer/BearerTokenErrorsTest.java | 2 +- .../verifyer/JwtAuthenticationProviderTest.java | 2 +- .../verifyer/JwtGrantedAuthoritiesConverterTest.java | 2 +- 18 files changed, 30 insertions(+), 27 deletions(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 450a33f41..0b01c5950 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -61,6 +61,7 @@ + @@ -325,6 +326,7 @@ + diff --git a/src/main/java/run/halo/app/identity/authentication/ProviderSettings.java b/src/main/java/run/halo/app/identity/authentication/ProviderSettings.java index 312e290bf..7a182f0dc 100644 --- a/src/main/java/run/halo/app/identity/authentication/ProviderSettings.java +++ b/src/main/java/run/halo/app/identity/authentication/ProviderSettings.java @@ -18,7 +18,7 @@ public final class ProviderSettings extends AbstractSettings { } /** - * Returns the URL of the Provider's Issuer Identifier + * Returns the URL of the Provider's Issuer Identifier. * * @return the URL of the Provider's Issuer Identifier */ diff --git a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthentication.java b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthentication.java index e97c3c26b..c5709ff6b 100644 --- a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthentication.java +++ b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthentication.java @@ -23,7 +23,7 @@ public class BearerTokenAuthentication private final Map attributes; /** - * Constructs a {@link BearerTokenAuthentication} with the provided arguments + * Constructs a {@link BearerTokenAuthentication} with the provided arguments. * * @param principal The OAuth 2.0 attributes * @param credentials The verified token diff --git a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationEntryPoint.java b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationEntryPoint.java index a273f5778..6706b3685 100644 --- a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationEntryPoint.java +++ b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationEntryPoint.java @@ -58,7 +58,7 @@ public class BearerTokenAuthenticationEntryPoint implements AuthenticationEntryP } /** - * Set the default realm name to use in the bearer token error response + * Set the default realm name to use in the bearer token error response. * * @param realmName realm name */ diff --git a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationFilter.java b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationFilter.java index bd099921f..4dc681dfd 100644 --- a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationFilter.java +++ b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationFilter.java @@ -60,7 +60,7 @@ public class BearerTokenAuthenticationFilter extends OncePerRequestFilter { new NullSecurityContextRepository(); /** - * Construct a {@code BearerTokenAuthenticationFilter} using the provided parameter(s) + * Construct a {@code BearerTokenAuthenticationFilter} using the provided parameter(s). * * @param authenticationManagerResolver authentication manager resolver */ @@ -72,7 +72,7 @@ public class BearerTokenAuthenticationFilter extends OncePerRequestFilter { } /** - * Construct a {@code BearerTokenAuthenticationFilter} using the provided parameter(s) + * Construct a {@code BearerTokenAuthenticationFilter} using the provided parameter(s). * * @param authenticationManager authentication manager */ diff --git a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationToken.java b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationToken.java index c0606f926..dc15be1b9 100644 --- a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationToken.java +++ b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenAuthenticationToken.java @@ -16,7 +16,7 @@ public class BearerTokenAuthenticationToken extends AbstractAuthenticationToken private final String token; /** - * Create a {@code BearerTokenAuthenticationToken} using the provided parameter(s) + * Create a {@code BearerTokenAuthenticationToken} using the provided parameter(s). * * @param token - the bearer token */ @@ -28,7 +28,7 @@ public class BearerTokenAuthenticationToken extends AbstractAuthenticationToken /** * Get the - * Bearer Token + * Bearer Token. * * @return the token that proves the caller's authority to perform the * {@link jakarta.servlet.http.HttpServletRequest} diff --git a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenError.java b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenError.java index 41be57f0d..63e7442c6 100644 --- a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenError.java +++ b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenError.java @@ -22,7 +22,7 @@ public final class BearerTokenError extends OAuth2Error { private final String scope; /** - * Create a {@code BearerTokenError} using the provided parameters + * Create a {@code BearerTokenError} using the provided parameters. * * @param errorCode the error code * @param httpStatus the HTTP status @@ -33,7 +33,7 @@ public final class BearerTokenError extends OAuth2Error { } /** - * Create a {@code BearerTokenError} using the provided parameters + * Create a {@code BearerTokenError} using the provided parameters. * * @param errorCode the error code * @param httpStatus the HTTP status diff --git a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenErrors.java b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenErrors.java index c6b67e916..a927520f6 100644 --- a/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenErrors.java +++ b/src/main/java/run/halo/app/identity/authentication/verifier/BearerTokenErrors.java @@ -4,7 +4,7 @@ import org.springframework.http.HttpStatus; /** * A factory for creating {@link BearerTokenError} instances that correspond to the - * registered Bearer Token Error Codes + * registered Bearer Token Error Codes. * * @author guqing * @since 2.0.0 @@ -24,7 +24,7 @@ public class BearerTokenErrors { } /** - * Create a {@link BearerTokenError} caused by an invalid request + * Create a {@link BearerTokenError} caused by an invalid request. * * @param message a description of the error * @return a {@link BearerTokenError} @@ -42,7 +42,7 @@ public class BearerTokenErrors { } /** - * Create a {@link BearerTokenError} caused by an invalid token + * Create a {@link BearerTokenError} caused by an invalid token. * * @param message a description of the error * @return a {@link BearerTokenError} @@ -60,7 +60,7 @@ public class BearerTokenErrors { } /** - * Create a {@link BearerTokenError} caused by an invalid token + * Create a {@link BearerTokenError} caused by an invalid token. * * @param scope the scope attribute to use in the error * @return a {@link BearerTokenError} diff --git a/src/main/java/run/halo/app/identity/authentication/verifier/JwtAuthenticationToken.java b/src/main/java/run/halo/app/identity/authentication/verifier/JwtAuthenticationToken.java index 97848b481..0fbe9fde1 100644 --- a/src/main/java/run/halo/app/identity/authentication/verifier/JwtAuthenticationToken.java +++ b/src/main/java/run/halo/app/identity/authentication/verifier/JwtAuthenticationToken.java @@ -61,7 +61,7 @@ public class JwtAuthenticationToken extends AbstractOAuth2TokenAuthenticationTok } /** - * The principal name which is, by default, the {@link Jwt}'s subject + * The principal name which is, by default, the {@link Jwt}'s subject. */ @Override public String getName() { diff --git a/src/main/java/run/halo/app/identity/authorization/AuthorizingVisitor.java b/src/main/java/run/halo/app/identity/authorization/AuthorizingVisitor.java index a8a8ba7a8..97fb82db5 100644 --- a/src/main/java/run/halo/app/identity/authorization/AuthorizingVisitor.java +++ b/src/main/java/run/halo/app/identity/authorization/AuthorizingVisitor.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; /** - * authorizing visitor short-circuits once allowed, and collects any resolution errors encountered + * authorizing visitor short-circuits once allowed, and collects any resolution errors encountered. * * @author guqing * @since 2.0.0 diff --git a/src/main/java/run/halo/app/identity/authorization/RequestInfoFactory.java b/src/main/java/run/halo/app/identity/authorization/RequestInfoFactory.java index 01230a7c4..74434682b 100644 --- a/src/main/java/run/halo/app/identity/authorization/RequestInfoFactory.java +++ b/src/main/java/run/halo/app/identity/authorization/RequestInfoFactory.java @@ -15,11 +15,12 @@ public class RequestInfoFactory { new RequestInfoFactory(Set.of("api", "apis"), Set.of("api")); /** - * without leading and trailing slashes + * without leading and trailing slashes. */ final Set apiPrefixes; + /** - * without leading and trailing slashes + * without leading and trailing slashes. */ final Set grouplessApiPrefixes; diff --git a/src/main/java/run/halo/app/identity/authorization/RoleRef.java b/src/main/java/run/halo/app/identity/authorization/RoleRef.java index bfd4ca381..4d570fa27 100644 --- a/src/main/java/run/halo/app/identity/authorization/RoleRef.java +++ b/src/main/java/run/halo/app/identity/authorization/RoleRef.java @@ -3,7 +3,7 @@ package run.halo.app.identity.authorization; import lombok.Data; /** - * RoleRef contains information that points to the role being used + * RoleRef contains information that points to the role being used. * * @author guqing * @since 2.0.0 @@ -12,17 +12,17 @@ import lombok.Data; public class RoleRef { /** - * Kind is the type of resource being referenced + * Kind is the type of resource being referenced. */ String kind; /** - * Name is the name of resource being referenced + * Name is the name of resource being referenced. */ String name; /** - * APIGroup is the group for the resource being referenced + * APIGroup is the group for the resource being referenced. */ String apiGroup; } diff --git a/src/test/java/run/halo/app/authentication/verifyer/BearerTokenAuthenticationTest.java b/src/test/java/run/halo/app/authentication/verifyer/BearerTokenAuthenticationTest.java index 23a08187a..696ac3ca3 100644 --- a/src/test/java/run/halo/app/authentication/verifyer/BearerTokenAuthenticationTest.java +++ b/src/test/java/run/halo/app/authentication/verifyer/BearerTokenAuthenticationTest.java @@ -22,7 +22,7 @@ import org.springframework.security.oauth2.core.OAuth2TokenIntrospectionClaimNam import run.halo.app.identity.authentication.verifier.BearerTokenAuthentication; /** - * Tests for {@link BearerTokenAuthentication} + * Tests for {@link BearerTokenAuthentication}. * * @author guqing * @since 2.0.0 diff --git a/src/test/java/run/halo/app/authentication/verifyer/BearerTokenAuthenticationTokenTest.java b/src/test/java/run/halo/app/authentication/verifyer/BearerTokenAuthenticationTokenTest.java index a809b73b3..4c4928005 100644 --- a/src/test/java/run/halo/app/authentication/verifyer/BearerTokenAuthenticationTokenTest.java +++ b/src/test/java/run/halo/app/authentication/verifyer/BearerTokenAuthenticationTokenTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test; import run.halo.app.identity.authentication.verifier.BearerTokenAuthenticationToken; /** - * Tests for {@link BearerTokenAuthenticationToken} + * Tests for {@link BearerTokenAuthenticationToken}. * * @author guqing * @since 2.0.0 diff --git a/src/test/java/run/halo/app/authentication/verifyer/BearerTokenErrorTest.java b/src/test/java/run/halo/app/authentication/verifyer/BearerTokenErrorTest.java index 3390ee056..1660c1aa2 100644 --- a/src/test/java/run/halo/app/authentication/verifyer/BearerTokenErrorTest.java +++ b/src/test/java/run/halo/app/authentication/verifyer/BearerTokenErrorTest.java @@ -8,7 +8,7 @@ import org.springframework.http.HttpStatus; import run.halo.app.identity.authentication.verifier.BearerTokenError; /** - * Tests for {@link BearerTokenError} + * Tests for {@link BearerTokenError}. * * @author guqing * @see Bearer Token Error diff --git a/src/test/java/run/halo/app/authentication/verifyer/BearerTokenErrorsTest.java b/src/test/java/run/halo/app/authentication/verifyer/BearerTokenErrorsTest.java index 9792ba518..0ace4accd 100644 --- a/src/test/java/run/halo/app/authentication/verifyer/BearerTokenErrorsTest.java +++ b/src/test/java/run/halo/app/authentication/verifyer/BearerTokenErrorsTest.java @@ -9,7 +9,7 @@ import run.halo.app.identity.authentication.verifier.BearerTokenErrorCodes; import run.halo.app.identity.authentication.verifier.BearerTokenErrors; /** - * Tests for {@link BearerTokenErrors} + * Tests for {@link BearerTokenErrors}. * * @author guqing * @since 2.0.0 diff --git a/src/test/java/run/halo/app/authentication/verifyer/JwtAuthenticationProviderTest.java b/src/test/java/run/halo/app/authentication/verifyer/JwtAuthenticationProviderTest.java index c0ee3127d..ae44090e9 100644 --- a/src/test/java/run/halo/app/authentication/verifyer/JwtAuthenticationProviderTest.java +++ b/src/test/java/run/halo/app/authentication/verifyer/JwtAuthenticationProviderTest.java @@ -26,7 +26,7 @@ import run.halo.app.identity.authentication.verifier.JwtAuthenticationProvider; import run.halo.app.identity.authentication.verifier.JwtAuthenticationToken; /** - * Tests for {@link JwtAuthenticationProvider} + * Tests for {@link JwtAuthenticationProvider}. * * @author guqing * @since 2.0.0 diff --git a/src/test/java/run/halo/app/authentication/verifyer/JwtGrantedAuthoritiesConverterTest.java b/src/test/java/run/halo/app/authentication/verifyer/JwtGrantedAuthoritiesConverterTest.java index 403e9bbfe..7199b7093 100644 --- a/src/test/java/run/halo/app/authentication/verifyer/JwtGrantedAuthoritiesConverterTest.java +++ b/src/test/java/run/halo/app/authentication/verifyer/JwtGrantedAuthoritiesConverterTest.java @@ -13,7 +13,7 @@ import org.springframework.security.oauth2.jwt.Jwt; import run.halo.app.identity.authentication.verifier.JwtGrantedAuthoritiesConverter; /** - * Tests for {@link JwtGrantedAuthoritiesConverter} + * Tests for {@link JwtGrantedAuthoritiesConverter}. * * @author guqing * @since 2.0.0