-
Notifications
You must be signed in to change notification settings - Fork 67
Fix/Modify code format #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fixt: fix blockgroup and block
Refactor/develop
fixt: fix blockgroup and block
Refactor/develop
…ngine-backend-java into refactor/develop
fix:fix block and group
Refactor/develop
…ne-backend-java into refactor/develop
Refactor/develop
Refactor/develop
feat: create component by bundle.json
fix:format code and fix style issue
Refactor/develop
Refactor/develop
Refactor/develop
WalkthroughThis pull request performs a package reorganization from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Areas requiring attention:
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
base/src/main/java/com/tinyengine/it/login/controller/LoginController.java (1)
146-149: Missingreturnon empty user list causes runtime errorIn
login, whenusersis empty you callResult.failed(ExceptionEnum.CM004);but do not return, and then immediately dousers.get(0), which will throwIndexOutOfBoundsException.Recommend returning the failure result:
- if (users.isEmpty()) { - Result.failed(ExceptionEnum.CM004); - } + if (users.isEmpty()) { + return Result.failed(ExceptionEnum.CM004); + }
🧹 Nitpick comments (3)
base/src/main/java/com/tinyengine/it/login/utils/JwtUtil.java (1)
45-52: Avoid hard-coded default JWT secret in production
getSecretString()falls back to a hard-codedDEFAULT_SECRETwhenSECRET_STRINGis unset. If this ever runs in production without the env var, all tokens share a well-known key.Consider failing fast (e.g., throw on missing env in non-dev profiles) or at least logging a clear warning and requiring a strong, externalized secret.
base/src/main/java/com/tinyengine/it/login/controller/LoginController.java (1)
187-191: Confirm success vs failure contract for invalid new passwordIn
forgotPassword, when the new password fails policy validation you returnResult.success(passwordValidationResult), whereas increateUseryou returnResult.failed(...)on validation failure. The inconsistency may be intentional (front-end expects a successful response with details) but it’s worth double-checking.base/src/main/java/com/tinyengine/it/login/config/context/DefaultLoginUserContext.java (1)
44-48: Defensively handle nullCURRENT_USERinsetTenants
setTenantsdoesUserInfo userInfo = CURRENT_USER.get(); userInfo.setTenants(tenants);without a null check. IfsetTenantsis ever called beforesetCurrentUser, this will NPE.Consider guarding against null (or explicitly failing fast), for example:
@Override public void setTenants(List<Tenant> tenants) { - UserInfo userInfo = CURRENT_USER.get(); - userInfo.setTenants(tenants); - CURRENT_USER.set(userInfo); + UserInfo userInfo = CURRENT_USER.get(); + if (userInfo == null) { + // Either no-op or throw an IllegalStateException, depending on desired contract + return; + } + userInfo.setTenants(tenants); + CURRENT_USER.set(userInfo); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
base/src/main/java/com/tinyengine/it/controller/AppTemplateController.java(0 hunks)base/src/main/java/com/tinyengine/it/controller/TenantController.java(2 hunks)base/src/main/java/com/tinyengine/it/login/config/SSOInterceptor.java(1 hunks)base/src/main/java/com/tinyengine/it/login/config/context/DefaultLoginUserContext.java(2 hunks)base/src/main/java/com/tinyengine/it/login/controller/LoginController.java(5 hunks)base/src/main/java/com/tinyengine/it/login/model/UserInfo.java(1 hunks)base/src/main/java/com/tinyengine/it/login/service/ConfigurablePasswordValidator.java(4 hunks)base/src/main/java/com/tinyengine/it/login/service/impl/LoginServiceImpl.java(1 hunks)base/src/main/java/com/tinyengine/it/login/utils/JwtUtil.java(2 hunks)base/src/main/java/com/tinyengine/it/login/utils/SM2EncryptionUtil.java(1 hunks)base/src/main/java/com/tinyengine/it/login/utils/SM3PasswordUtil.java(1 hunks)base/src/main/java/com/tinyengine/it/mapper/AuthUsersUnitsRolesMapper.java(0 hunks)base/src/main/java/com/tinyengine/it/service/app/AppTemplateService.java(0 hunks)base/src/main/java/com/tinyengine/it/service/app/impl/AppServiceImpl.java(1 hunks)base/src/main/java/com/tinyengine/it/service/app/impl/AppTemplateServiceImpl.java(1 hunks)base/src/main/java/com/tinyengine/it/service/platform/impl/TenantServiceImpl.java(1 hunks)
💤 Files with no reviewable changes (3)
- base/src/main/java/com/tinyengine/it/service/app/AppTemplateService.java
- base/src/main/java/com/tinyengine/it/controller/AppTemplateController.java
- base/src/main/java/com/tinyengine/it/mapper/AuthUsersUnitsRolesMapper.java
🧰 Additional context used
🧬 Code graph analysis (1)
base/src/main/java/com/tinyengine/it/login/controller/LoginController.java (2)
base/src/main/java/com/tinyengine/it/login/utils/SM3PasswordUtil.java (1)
SM3PasswordUtil(25-79)base/src/main/java/com/tinyengine/it/login/utils/SM2EncryptionUtil.java (1)
SM2EncryptionUtil(33-129)
🔇 Additional comments (20)
base/src/main/java/com/tinyengine/it/service/app/impl/AppTemplateServiceImpl.java (1)
115-116: Whitespace-only change — behavior preservedThe
queryAllAppTemplatecall keeps the same arguments and pagination logic; this is a pure formatting tweak and is safe.base/src/main/java/com/tinyengine/it/service/platform/impl/TenantServiceImpl.java (1)
113-121: Consistent spacing inifconditionThe updated
if (result == 1)improves readability without changing thecreateTenantlogic.base/src/main/java/com/tinyengine/it/service/app/impl/AppServiceImpl.java (1)
107-108: Formatting-only change to paged queryThe
queryAllAppByPageinvocation keeps the same parameters and pagination behavior; change is purely stylistic.base/src/main/java/com/tinyengine/it/login/utils/SM3PasswordUtil.java (1)
13-13: Package path normalization for SM3 utilityMoving
SM3PasswordUtiltocom.tinyengine.it.login.utilsaligns it with the other login utilities without changing behavior. Just ensure all callers now import from the newlogin.utilspackage.base/src/main/java/com/tinyengine/it/login/utils/SM2EncryptionUtil.java (1)
13-13: SM2 utility moved underlogin.utilspackageThe package rename to
com.tinyengine.it.login.utilssimply reorganizes the namespace; all public methods and behavior remain the same.base/src/main/java/com/tinyengine/it/controller/TenantController.java (3)
43-48: Swagger annotation formatting onlyThe reflow of
@Operation/@ApiResponsecontent keeps the same schema and response codes, just formatted more cleanly.
51-54: Added blank line for readabilityThe extra blank line inside
getAllTenantis purely cosmetic and does not affect behavior.
62-70: Re-indentedcreateTenantOpenAPI metadataParameter and response definitions are unchanged; only indentation and line breaks were adjusted.
base/src/main/java/com/tinyengine/it/login/config/SSOInterceptor.java (1)
15-15: Updated JwtUtil import to new utils packageSwitching to
com.tinyengine.it.login.utils.JwtUtilmatches the package reorganization and keeps SSO validation behavior identical.base/src/main/java/com/tinyengine/it/login/service/impl/LoginServiceImpl.java (2)
33-37: Static imports updated tologin.utils.SM2EncryptionUtilThe static imports now reference the new package while keeping the same SM2 helper methods; downstream encryption logic is unaffected.
42-44: Minor formatting after autowired mapperThe blank line after
AuthUsersUnitsRolesMapperimproves readability and has no functional effect.base/src/main/java/com/tinyengine/it/login/utils/JwtUtil.java (1)
13-13: Package rename and explicit long literal are correctThe package move to
com.tinyengine.it.login.utilsand theEXPIRATION_TIMEchange to a long literal are consistent with the rest of the PR and behaviorally equivalent.Also applies to: 45-45
base/src/main/java/com/tinyengine/it/login/model/UserInfo.java (1)
39-66: Accessor reformatting is behavior-preservingGetters and setters still directly map to the underlying fields; only brace/line formatting changed. No behavioral impact.
base/src/main/java/com/tinyengine/it/login/controller/LoginController.java (2)
19-20: Updated utility imports to.utilslook consistentImports and static imports now point to
com.tinyengine.it.login.utils.*, aligning with the package reorganization (JwtUtil, SM2EncryptionUtil, SM3PasswordUtil). This is consistent with the utils move.Also applies to: 59-61
115-115: Whitespace-only changes around validationsThe added spaces in the
ifconditions and authenticate call sites are purely cosmetic and do not affect behavior.Also applies to: 153-153
base/src/main/java/com/tinyengine/it/login/config/context/DefaultLoginUserContext.java (1)
16-16: ThreadLocal rename toCURRENT_USERis consistentRenaming the
ThreadLocalto an uppercase constant and updating all getters/setters/clear methods is applied consistently and keeps behavior the same.Also applies to: 22-22, 28-28, 34-35, 45-48, 55-56, 63-64, 71-72
base/src/main/java/com/tinyengine/it/login/service/ConfigurablePasswordValidator.java (4)
32-36: Excellent performance optimization with precompiled patterns.The introduction of precompiled regex patterns as static final constants is a solid optimization that avoids repeated pattern compilation on each validation call. Pattern objects are thread-safe and immutable, making this approach safe for concurrent use. The naming follows Java conventions, and the comment clearly documents the intent.
50-50: Good practice using Locale.ROOT for consistent formatting.Using
Locale.ROOTensures locale-insensitive number formatting in error messages, which provides consistent and predictable output regardless of the system's default locale.Also applies to: 55-55
58-75: LGTM! Character type checks correctly use precompiled patterns.The validation logic now efficiently uses the precompiled pattern constants, maintaining the same behavior while improving performance. The updated comment clearly documents this optimization.
86-91: LGTM! Consecutive character check correctly uses precompiled pattern.The validation logic now efficiently uses the precompiled
CONSECUTIVE_CHARS_PATTERNconstant, maintaining the same behavior while improving performance.
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
Release Notes
Refactor
Chores
✏️ Tip: You can customize this high-level summary in your review settings.