I'd like to open a discussion about the code style used for the CiviCRM WordPress plugin. At present, the plugin (loosely) conforms to Drupal/CiviCRM code style conventions. Is this what we want?
Pros:
CiviCRM devs are used to space-indentation and compact code style
Cons:
WordPress devs may be put off from contributing by the current code style
My personal opinion:
I work almost exclusively with CiviCRM in WordPress. I'm comfortable with CiviCRM code style conventions for Core, but I would prefer if the WordPress plugin conformed to WordPress code style. Because it's a WordPress plugin.
I do not think this is the right place for a discussion like this. Might be more useful on either Stack Exchange or Mattermost? It is certainly not a bug or a proposal to change any of the code :-) nor does it require any action from a product-maintenance perspective.
@haystack not worried about the stats :-) But it does not really fit in the workflow we are using, who would I assign this to? I think you are quite right in wanting to open the discussion. This is just not the forum where I as a community member would look for a discussion. So I think you are likely to get more discussion participation on StackExchange and/or Mattermost. I do think it is worth a discussion!
@ErikHommel I don't think this discussion lines up with Mattermost nor Stack Exchange. I agree assigning it is difficult, as it needs feedback from many people. I also don't see this as a 'Feature Request' so it would not belong in that Issue Queue.
Since we are discussing Coding Standards for CiviCRM-WP what better place than here?
If the concern is who can move this along, I can have the task assigned to me and we can ping the people we would like feedback and link to the issue in Mattermost. That would make the most sense to me, what do you think?
Proposed action which would close this issue: add .editorconfig file to the repo specifying the codestyle. Many text editors and IDEs respect the contents of such a file. See: https://editorconfig.org/
@haystack agreed the .editorconfig would help. Do you propose using same standards as civicrm-core? That would be more consistent as then civicrm-wordpress and civicrm-core would use the same code style. It would be different for anyone with WP background, but they would have that issue once they needed to contribute to any core files.
I am leaning towards one code style for the wp integration and core, but can be persuaded.
I am leaning towards one code style for the wp integration and core, but can be persuaded.
@kcristiano The .editorconfig file won't impose code-styling rules, it just helps configure the coder's editor. I'd say it would be unproblematic to implement the bare minimum and take it from there. Here's my suggestion for the initial commit:
# EditorConfig is awesome: https://editorconfig.org# top-most EditorConfig fileroot = true# Unix-style newlines with a newline ending every file[*]end_of_line = lfinsert_final_newline = truetrim_trailing_whitespace = true# Tab indentation[*.php]indent_style = spaceindent_size = 2
# CiviCRM editor configuration normalization# @see http://editorconfig.org/# This is the top-most .editorconfig file; do not search in parent directories.root = true# All files.[*]end_of_line = LFindent_style = spaceindent_size = 2charset = utf-8trim_trailing_whitespace = trueinsert_final_newline = true
is the civicrm-core.editorconfig I don't see any real differences, so I think this should work. This is agood approach, set the config in the editor, but not change any policy on enforcing.