chore: refine the hg-style.xml specification#2457
chore: refine the hg-style.xml specification#2457VGalaxies merged 5 commits intoapache:masterfrom returnToInnocence:hg-style-refine-2435
Conversation
|
LGTM |
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
@javeme |
…nting 8 to 4 problem
|
|
||
| [*.{java,xml,py}] | ||
| indent_style = space | ||
| indent_size = 4 |
There was a problem hiding this comment.
not sure why delete this code?
There was a problem hiding this comment.
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
After modification
There was a problem hiding this comment.
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
| <codeStyleSettings language="XML"> | ||
| <option name="RIGHT_MARGIN" value="120" /> | ||
| <option name="WRAP_ON_TYPING" value="1" /> | ||
| <option name="SOFT_MARGINS" value="120" /> | ||
| </codeStyleSettings> |
There was a problem hiding this comment.
good, set max 120 chars for xml is better (could avoid some bugs when format with 100)
VGalaxies
left a comment
There was a problem hiding this comment.
GREAAAAAAAT! Looking forward to further improvements...
- 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`)


Purpose of the PR
Main Changes
hg-style.xml)hg-style.xml)hg-style.xml)<p>tags to JavaDoc blank lines (implemented throughhg-style.xml).xmlfile leaves a blank line at the end (through.editorconfig)hg-style.xml)hg-style.xml).propertiesfile leaves empty lines (implemented viahg-style.xml).yamlfile braces{}, brackets[]remove spacing Spaces (implemented viahg-style.xml)Verifying these changes
Does this PR potentially affect the following parts?
However, you need to use the
ctrl+Cshortcut to enable the.editorconfigprofile in addition to the reformat code option🙈Documentation Status
Doc - TODODoc - DoneDoc - No Need