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

[Feature] Migrate the hg-style.xml to.editorconfig #2485

Closed
1 of 2 tasks
returnToInnocence opened this issue Mar 18, 2024 · 9 comments · Fixed by #2561
Closed
1 of 2 tasks

[Feature] Migrate the hg-style.xml to.editorconfig #2485

returnToInnocence opened this issue Mar 18, 2024 · 9 comments · Fixed by #2561
Assignees
Labels
feature New feature good first issue Good for newcomers

Comments

@returnToInnocence
Copy link
Contributor

returnToInnocence commented Mar 18, 2024

Background

While working on #2457, we noticed that we were using both hugegraph-style.xml and .editorconfig to control the style of our code, so we wanted to try combining the functionality of these two files into a single file

Feature Description

  • Migrate the code format control configuration to .editorconfig

Some advantages

  • The .editorconfig file can define coding conventions that cannot be defined by hg-style.xml, such as insert_final_newline
  • The .editorconfig file does not require the user to make any additional configuration, such as importing code style. If this file exists in the project, it will be automatically invoked by default, and code sytle will be overwritten

    This is if the user allows the EditorConfig support of 🙈 IDEA to be enabled

What need to do

Reference

How do I test the correctness of the results

  • TODO(It's a shame that I don't have a practical way to make sure it's correct😭)
@returnToInnocence returnToInnocence added the feature New feature label Mar 18, 2024
Copy link

dosubot bot commented Mar 18, 2024

To test the correctness of the results after migrating the code format control configuration from hugegraph-style.xml to .editorconfig in the incubator-hugegraph project, you can follow these steps:

  1. Code Formatting Tools Compatibility: Ensure that the tools or IDEs (Integrated Development Environments) used by the project's contributors support .editorconfig. Most modern IDEs like IntelliJ IDEA, Eclipse, and Visual Studio Code have built-in support or plugins available for .editorconfig.

  2. Automated Formatting Check: Implement a CI (Continuous Integration) pipeline step that checks if the code conforms to the .editorconfig settings. This can be achieved by using tools like checkstyle for Java, which can be configured to use .editorconfig directly or through plugins. For example, the eclipse-cs plugin allows Checkstyle to work with .editorconfig.

  3. Manual Review and Testing:

    • Review Changes: Manually review a significant sample of the code changes to ensure that the formatting changes are as expected.
    • Test Suite: Run the project's test suite to ensure that the code changes have not introduced any functional regressions.
  4. Community Feedback: Encourage the project contributors to pull the latest changes and report any issues or unexpected changes in code formatting. This feedback can be invaluable in identifying edge cases or configurations that may have been overlooked.

  5. Documentation: Update the project's documentation to inform contributors about the migration to .editorconfig and how they can configure their IDEs or editors to adhere to the new formatting rules.

By following these steps, you can systematically test and ensure the correctness of the results after migrating to .editorconfig for code formatting in the incubator-hugegraph project.

Regarding the structure of the hugegraph-style.xml file in the incubator-hugegraph project, it provides a comprehensive set of configurations for code styling, particularly focusing on Java, XML, and YAML languages, ensuring consistency and readability across the project's codebase. You can reference this structure when creating your .editorconfig file to ensure that all necessary formatting rules are covered.

For more details, you can refer to the .editorconfig file and the hugegraph-style.xml file in the incubator-hugegraph project.

I hope this helps! If you have any further questions, feel free to ask.

-Dosu

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@returnToInnocence returnToInnocence changed the title [Feature] migrate the hg-style.xml to.editorconfig [Feature] Migrate the hg-style.xml to.editorconfig Mar 18, 2024
@imbajin imbajin moved this to 🆕 New in HugeGraph Tasks Mar 25, 2024
@imbajin imbajin moved this from 🆕 New to Newcomer Task in HugeGraph Tasks Apr 15, 2024
@imbajin imbajin added the good first issue Good for newcomers label Apr 15, 2024
@FrostyHec
Copy link
Contributor

Hi everyone, I wondered if anyone is working on this issue? I'd like to have a try on it.

@VGalaxies
Copy link
Contributor

Hi everyone, I wondered if anyone is working on this issue? I'd like to have a try on it.

No one is working on this issue currently. I've assigned it to you~

@returnToInnocence
Copy link
Contributor Author

returnToInnocence commented Jun 20, 2024

Hi everyone, I wondered if anyone is working on this issue? I'd like to have a try on it.

Hi @FrostyHec, If you encounter any problems, please feel free to @ me😁

@FrostyHec
Copy link
Contributor

@returnToInnocence Thanks~, I would like to inquire if there are some code format requirement for markdown? I see the style requirements for markdown in hugegraph-style.xml in not defined, and the default code format style exported by IDEA is this:

[{*.markdown,*.md}]
ij_visual_guides = 
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
ij_markdown_force_one_space_after_list_bullet = true
ij_markdown_force_one_space_between_words = true
ij_markdown_format_tables = true
ij_markdown_insert_quote_arrows_on_wrap = true
ij_markdown_keep_indents_on_empty_lines = false
ij_markdown_keep_line_breaks_inside_text_blocks = true
ij_markdown_max_lines_around_block_elements = 1
ij_markdown_max_lines_around_header = 1
ij_markdown_max_lines_between_paragraphs = 1
ij_markdown_min_lines_around_block_elements = 1
ij_markdown_min_lines_around_header = 1
ij_markdown_min_lines_between_paragraphs = 1
ij_markdown_wrap_text_if_long = true
ij_markdown_wrap_text_inside_blockquotes = true

@returnToInnocence
Copy link
Contributor Author

returnToInnocence commented Jun 21, 2024

@returnToInnocence Thanks~, I would like to inquire if there are some code format requirement for markdown? I see the style requirements for markdown in hugegraph-style.xml in not defined, and the default code format style exported by IDEA is this: 谢谢~,我想问一下markdown有没有代码格式要求?我看到hugegraph-style.xml中markdown的样式要求没有定义,IDEA导出的默认代码格式样式是这样的:

[{*.markdown,*.md}]
ij_visual_guides = 
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
ij_markdown_force_one_space_after_list_bullet = true
ij_markdown_force_one_space_between_words = true
ij_markdown_format_tables = true
ij_markdown_insert_quote_arrows_on_wrap = true
ij_markdown_keep_indents_on_empty_lines = false
ij_markdown_keep_line_breaks_inside_text_blocks = true
ij_markdown_max_lines_around_block_elements = 1
ij_markdown_max_lines_around_header = 1
ij_markdown_max_lines_between_paragraphs = 1
ij_markdown_min_lines_around_block_elements = 1
ij_markdown_min_lines_around_header = 1
ij_markdown_min_lines_between_paragraphs = 1
ij_markdown_wrap_text_if_long = true
ij_markdown_wrap_text_inside_blockquotes = true

@FrostyHec
In PR:#2525 can see its detailed description), max line length = off This configuration is recommended to be retained, This configuration is expected to do the following for idea (to temporarily ignore the poor visual effects caused by the forced line breaks in .md files):
image

Without this configuration, there are several possible problems with code format:
image

Because it's just mechanical truncation + newline (without adding two Spaces at the end of the truncation, it's not markdown newline syntax), it should not be rendered into a newline in most markdown rendering engines, but in typora and other rendering engines that support non-strict mode, it will cause the text to be rendered into a newline

@FrostyHec
Copy link
Contributor

FrostyHec commented Jun 21, 2024

@returnToInnocence
Thanks for your detailed reply~. I see mention in the issue that says "Add code format style for .md" , and wondered if it is required to add some addtional code style for .md after max line length = off ?

@returnToInnocence
Copy link
Contributor Author

@returnToInnocence Thanks for your detailed reply~. I see mention in the issue that says "Add code format style for .md" , and wondered if it is required to add some addtional code style for .md after max line length = off ?谢谢您详细的回复~。我在问题中看到提到“为 .md 添加代码格式样式”,并想知道是否需要在 max line length = off 添加一些附加代码样式> ?

@FrostyHec Thank you for identifying this issue🫡. Based on previous research, I have tentatively come to the conclusion that there does not seem to be a strong need for separate formatting of markdown files.

which means that the "What need to do" mentioned in my previous issue is not reasonable😭.

By investigating the .md file format of several outstanding apache projects with high star counts, it is found that there are few separate formats for .md in apache projects. (It is only noticed that most apache projects use trim_trailing_whitespace = false and insert_final_newline = false. But in fact, these two configurations are a common configuration for all files and you don't need to handle the .md file separately.)

@FrostyHec
Copy link
Contributor

@returnToInnocence Thanks for your nice reply (⌒ω⌒) ~

@github-project-automation github-project-automation bot moved this from ⚾️ Newcomer Task to ✅ Done in HugeGraph Tasks Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature good first issue Good for newcomers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants