Fix #21: Adopt .editorconfig file and reformat#103
Fix #21: Adopt .editorconfig file and reformat#103olivergondza merged 10 commits intoopenstack4j:masterfrom
Conversation
|
@openstack4j/reviewers, please take a look. Thanks! |
|
@manuelmazzuola, I would especially appreciate your feedback... |
There was a problem hiding this comment.
The project contains some scripts, yaml files, xml like files and the editorconfig file itself so I would add some rules for those files
editorconfig
[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true
some for scripts
[{*.bash,*.zsh,*.sh}]
ij_shell_binary_ops_start_line = false
ij_shell_keep_column_alignment_padding = false
ij_shell_minify_program = false
ij_shell_redirect_followed_by_space = false
ij_shell_switch_cases_indented = false
for yml files
[{*.yml,*.yaml}]
indent_size = 2
ij_continuation_indent_size = 2
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
and xml like files
[{*.jhm,*.xslt,*.xul,*.rng,*.xsl,*.xsd,*.ant,*.tld,*.fxml,*.wsdl,*.jrxml,*.xml,*.jnlp,*.pom}]
indent_style = tab
ij_smart_tabs = true
ij_xml_block_comment_at_first_column = true
ij_xml_keep_indents_on_empty_lines = false
ij_xml_line_comment_at_first_column = true
| ij_formatter_on_tag = @formatter:on | ||
| ij_formatter_tags_enabled = false | ||
| ij_smart_tabs = false | ||
| ij_wrap_on_typing = false |
There was a problem hiding this comment.
| ij_wrap_on_typing = false | |
| ij_wrap_on_typing = false | |
| ij_visual_guides = 80,120 |
There was a problem hiding this comment.
Good point we can make sure this is turned on for people. 120 mark should be enough, though
.editorconfig
Outdated
| ij_wrap_on_typing = false | ||
|
|
||
| [*.java] | ||
| # ij_java_align_consecutive_assignments = false |
There was a problem hiding this comment.
Why these rules are commented?
I suggest uncommenting all the commented lines
There was a problem hiding this comment.
That is a good point as without being as explicit as we can be, the result will always be a blend of .editorconfig and IDE config.
|
So, I generally agree with the reformatting - I've not gone through it in extreme detail, but it looks ok (in github's WebUI anyway). My only concern is that, while I'm generally in favour of standardising stuff, including code layout ... I'm only in favour when it's dead easy to conform to such restrictions. So, I'd want anything like this to have automated checks, and ones that'd show any "ignorant, but trying to contribute" folks what the objections were and what they needed to do to make the code perfect ... especially as I'm likely to be one of those "ignorant, but trying to contribute" people myself. |
How is overly-restrictive?
I don't think that this is a barrier, completely the opposite, is a tool to help novice and expert programmers to format code correctly and encourage people to open PRs. |
|
It can be overly restrictive if there isn't a discoverable and well-documented method of reformatting the code. So, sure, lets do this ... but if we're going to police it (and we need to if we want those rules to be followed!) then any build errors/warnings need to tell folks both what's wrong and where they can find out about the tech behind the warning, otherwise folks who don't know about this already won't discover it. |
|
IntelliJ IDEA is a good IDE. I also use it . |
|
Thanks for your input, folks. Let me integrate this ASAP, so we can reflect this in new MRs. |
Nope, @manuelmazzuola have suggested that for XML only, but I urge us to stick to spaces. |
Suggesting particular
.editorconfgand reformatting the code to match: https://github.com/olivergondza/openstack4j/blob/editorconfig/.editorconfigWhitespace ignoring diff: https://github.com/openstack4j/openstack4j/pull/103/files?w=1