Skip to content
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

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

Solving code smells #277

wants to merge 5 commits into from

Conversation

rainUee
Copy link

@rainUee 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> {
Copy link
Owner

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) {
Copy link
Owner

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 {
Copy link
Owner

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() {
Copy link
Owner

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) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请勿重命名

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants