-
-
Notifications
You must be signed in to change notification settings - Fork 449
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
Solving code smells #277
base: dev
Are you sure you want to change the base?
Solving code smells #277
Conversation
rainUee
commented
Nov 28, 2024
- extract method 提取公共方法
- introduce explaining variable 引入解释变量
- rename getJSONs to exportData and getDateFromRepository
- move the method pushArticleToRhy to B3ArticlePusher
- extract AbstractB3EventListener class
* @version 1.0.0.1, Nov 27, 2024 | ||
* @since 4.4.0 | ||
*/ | ||
public abstract class AbstractB3EventListener extends AbstractEventListener<JSONObject> { |
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.
事件处理器是故意分开实现的,不进行抽象提取,因为之前考虑到可能较为易变。
@@ -71,7 +71,11 @@ public static boolean invalidUserName(final String name) { | |||
char c; | |||
for (int i = 0; i < length; i++) { | |||
c = name.charAt(i); | |||
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || '-' == c) { |
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.
这些是显而易见的判断,不需要引入变量解释。
* @version 1.0.0.1, Nov 27, 2023 | ||
* @since 4.4.0 | ||
*/ | ||
public class B3ArticlePusher { |
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.
请勿重命名
@@ -520,47 +520,47 @@ public JSONObject exportHexoMDs() { | |||
/** | |||
* Gets all data as JSON format. | |||
*/ | |||
public JSONObject getJSONs() { | |||
public JSONObject exportData() { |
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.
请勿重命名
ret.put(User.USERS, users); | ||
return ret; | ||
} | ||
|
||
private JSONArray getJSONs(final Repository repository) { | ||
private JSONArray getDataFromRepository(final Repository repository) { |
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.
请勿重命名