apache / incubator-hugegraph

A graph database that supports more than 100+ billion data, high performance and scalability (Include OLTP Engine & REST-API & Backends)
https://hugegraph.apache.org
Apache License 2.0
2.58k stars 512 forks source link

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

Closed returnToInnocence closed 1 week ago

returnToInnocence commented 3 months ago

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

Some advantages

What need to do

Reference

How do I test the correctness of the results

dosubot[bot] commented 3 months ago

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.
FrostyHec commented 2 weeks ago

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

VGalaxies commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

@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 commented 2 weeks ago

@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:https://github.com/apache/incubator-hugegraph/pull/2525(You 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 commented 2 weeks ago

@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 commented 1 week ago

@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 commented 1 week ago

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