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

chore: refine the hg-style.xml specification #2457

Merged
merged 5 commits into from
Feb 27, 2024
Merged

chore: refine the hg-style.xml specification #2457

merged 5 commits into from
Feb 27, 2024

Conversation

returnToInnocence
Copy link
Contributor

@returnToInnocence returnToInnocence commented Feb 23, 2024

Purpose of the PR

Main Changes

  • Change the maximum wrap text length for XML to 120 (implemented through hg-style.xml)
  • Add a blank line between method definitions, inner class definitions, and static code blocks (implemented through hg-style.xml)
  • For Properties files, add the option "KEEP_BLANK_LINES." (implemented through hg-style.xml)
  • Add <p> tags to JavaDoc blank lines (implemented through hg-style.xml)
  • .xml file leaves a blank line at the end (through.editorconfig)
  • Class declaration requires a blank line before and after each line (implemented via hg-style.xml)
  • Javadoc line comment not in line (implemented via hg-style.xml)
  • .properties file leaves empty lines (implemented via hg-style.xml)
  • .yaml file braces {}, brackets [] remove spacing Spaces (implemented via hg-style.xml)

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • By reformat the code modules that have completed merge at present, if there is no change, the test is successful😀

Does this PR potentially affect the following parts?

  • Nope
  • Dependencies (add/update license info)
  • Modify configurations
  • The public API
  • Other affects (typed here)
    • When you use hugegraph-style.xml for code reformat, this pr mentions changes that will affect the final result
      However, you need to use the ctrl+C shortcut to enable the .editorconfig profile in addition to the reformat code option🙈

Documentation Status

  • Doc - TODO
    • I'm writing the corresponding reformat code related documentation, and I will introduce the new pr corresponding documentation later
  • Doc - Done
  • Doc - No Need

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. feature New feature tests Add or improve test cases labels Feb 23, 2024
@returnToInnocence returnToInnocence changed the title refine the hg-style.xml #2435 no indents change chore: refine the hg-style.xml specification Feb 23, 2024
javeme
javeme previously approved these changes Feb 24, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 24, 2024
@javeme
Copy link
Contributor

javeme commented Feb 24, 2024

LGTM

Copy link

codecov bot commented Feb 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.30%. Comparing base (bc421bb) to head (1fde1d0).
Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2457      +/-   ##
============================================
+ Coverage     66.23%   66.30%   +0.07%     
  Complexity      827      827              
============================================
  Files           511      511              
  Lines         42582    42622      +40     
  Branches       5935     5947      +12     
============================================
+ Hits          28204    28262      +58     
+ Misses        11566    11548      -18     
  Partials       2812     2812              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@returnToInnocence returnToInnocence marked this pull request as draft February 24, 2024 03:37
@returnToInnocence returnToInnocence changed the title chore: refine the hg-style.xml specification chore: refine the hg-style.xml specification [WIP] Feb 24, 2024
@returnToInnocence
Copy link
Contributor Author

returnToInnocence commented Feb 24, 2024

LGTM

@javeme
Sorry, I just found a few more configuration omissions, I will mention a new commit to supplement

@returnToInnocence returnToInnocence changed the title chore: refine the hg-style.xml specification [WIP] chore: refine the hg-style.xml specification Feb 25, 2024
@returnToInnocence returnToInnocence marked this pull request as ready for review February 25, 2024 02:23
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. ci-cd Build or deploy and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 25, 2024
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Feb 25, 2024

[*.{java,xml,py}]
indent_style = space
indent_size = 4
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure why delete this code?

Copy link
Contributor Author

@returnToInnocence returnToInnocence Feb 25, 2024

Choose a reason for hiding this comment

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

Sorry sir, I didn't describe this clearly in main change

The reason for this change is that we encountered a problem while formatting the java code,

The intended effect of format is to automatically wrap and indent a line when it exceeds the maximum length of 100, which is a special case where the number of indented Spaces is eight

If the changes in the.editorConfig do not change, the indentation will change to 4, even though the code style has been set to 8

Before modification

img_v3_028c_a7aac239-0ec9-4b39-bc7f-3aa42f6f1cag

After modification

img_v3_028c_492f8f97-bc13-47a0-ba66-b4f675c0851g

Copy link
Contributor Author

@returnToInnocence returnToInnocence Feb 26, 2024

Choose a reason for hiding this comment

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

I'm sorry, but I've found a new solution that doesn't require deleting the above, but instead enables a special option in.editorconfig for indenting more than the maximum line wrap of a single character

I'll make a new commit, which will undo my changes to the.editorconfig section and add the options above

Mainly refer to the configuration of the spring-cloud project

imbajin
imbajin previously approved these changes Feb 26, 2024
Copy link
Member

@imbajin imbajin left a comment

Choose a reason for hiding this comment

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

LGTM almost

Comment on lines +88 to +92
<codeStyleSettings language="XML">
<option name="RIGHT_MARGIN" value="120" />
<option name="WRAP_ON_TYPING" value="1" />
<option name="SOFT_MARGINS" value="120" />
</codeStyleSettings>
Copy link
Member

Choose a reason for hiding this comment

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

good, set max 120 chars for xml is better (could avoid some bugs when format with 100)

@imbajin imbajin added this to the 1.3.0 milestone Feb 26, 2024
Copy link
Contributor

@VGalaxies VGalaxies left a comment

Choose a reason for hiding this comment

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

GREAAAAAAAT! Looking forward to further improvements...

@VGalaxies VGalaxies merged commit 47a68f0 into apache:master Feb 27, 2024
21 checks passed
VGalaxies pushed a commit that referenced this pull request Feb 27, 2024
- Change the maximum wrap text length for XML to 120 (via `hg-style.xml`)
- Add a blank line between method definitions, inner class definitions, and static code blocks (via `hg-style.xml`)
- Add `<p>` tags to Javadoc blank lines (via `hg-style.xml`)
- `.xml` file leaves a blank line at the end (via `.editorconfig`)
- Class declaration requires a blank line before and after each line (via `hg-style.xml`)
- Javadoc line comment not in line (via `hg-style.xml`)
- `.properties` file leaves empty lines (via `hg-style.xml`)
- `.yaml` file braces `{}`, brackets `[]` remove spaces (via `hg-style.xml`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-cd Build or deploy feature New feature lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files. tests Add or improve test cases
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants