This is an automated email from the ASF dual-hosted git repository.

panyuepeng pushed a commit to branch dev
in repository 
https://gitbox.apache.org/repos/asf/incubator-streampark-website.git


The following commit(s) were added to refs/heads/dev by this push:
     new 63598c9b [Hotfix] Supplements the constants extracting rules. (#251)
63598c9b is described below

commit 63598c9b9c5f960a3a9a6d10015e2043daa6121e
Author: Yuepeng Pan <[email protected]>
AuthorDate: Sat Sep 16 21:37:17 2023 +0800

    [Hotfix] Supplements the constants extracting rules. (#251)
---
 community/submit_guide/code-style-and-quality-guide.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/community/submit_guide/code-style-and-quality-guide.md 
b/community/submit_guide/code-style-and-quality-guide.md
index f43d6b1a..86ea140b 100644
--- a/community/submit_guide/code-style-and-quality-guide.md
+++ b/community/submit_guide/code-style-and-quality-guide.md
@@ -136,6 +136,8 @@ sidebar_position: 3
       ```
 
 2. Redundant strings should be extracted as constants
+If a constant has been hardcoded twice or more times, please directly extract 
it as a constant and change the corresponding reference.
+In generally, constants in `log` can be ignored to extract.
 
     - Negative demo:
 
@@ -162,15 +164,13 @@ sidebar_position: 3
       > Strings are extracted as constant references.
 
       ```java
-        public static final String STATUS_SUCCESS = "success";
-        public static final String STATUS_FAIL = "error";
         public static final String STATUS = "status";
         public static final String CODE = "code";
         public static final String DATA = "data";
         
         public static RestResponse success(Object data) {
             RestResponse resp = new RestResponse();
-            resp.put(STATUS, STATUS_SUCCESS);
+            resp.put(STATUS, "success");
             resp.put(CODE, ResponseCode.CODE_SUCCESS);
             resp.put(DATA, data);
             return resp;
@@ -178,7 +178,7 @@ sidebar_position: 3
         
         public static RestResponse error() {
             RestResponse resp = new RestResponse();
-            resp.put(STATUS, STATUS_FAIL);
+            resp.put(STATUS, "error");
             resp.put(CODE, ResponseCode.CODE_FAIL);
             resp.put(DATA, null);
             return resp;

Reply via email to