Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

#5638 closed enhancement (fixed)

Introduce .editorconfig to BuddyPress

Reported by: netweb Owned by: djpaul
Milestone: 2.1 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch commit
Cc:

Description

Configuring your editor/IDE for submitting code/patches to BuddyPress and follow the code styling guidelines of BuddyPress is not the simplest of tasks...

Via http://editorconfig.org

"EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems."

Particularly as WordPress has now implemented this via #WP26429 if your editor or IDE supports this and you checkout the BuddyPress repo into a folder contained within the WordPress develop repo the default is to inherit all the rules from the upstream .editorconfig.

To this end BuddyPress should include an .editorconfig file to explicitly declare it's own code styling guidelines or the same .editorconfig file as WordPress to use their .editorconfig rules.

I just came across this whilst creating a patch for the BuddyPress package.json file, WordPress uses 'spaces' for tab indentation whereas BuddyPress are using tabs. I quickly fudged the WordPress .editorconfig file to match BuddyPress' so I could create a patch for package.json to match the current whitespace format.

Attachments (2)

5638.diff (555 bytes) - added by netweb 5 years ago.
5638.2.diff (561 bytes) - added by netweb 5 years ago.

Download all attachments as: .zip

Change History (9)

@netweb
5 years ago

#1 @netweb
5 years ago

5638.diff​ is an exact duplicate of WordPress' .editorconfig (without the *.txt and txt,wp-config-sample.php)

Source: https://core.trac.wordpress.org/browser/trunk/.editorconfig

WordPress Coding Standards http://make.wordpress.org/core/handbook/coding-standards/

#2 @DJPaul
5 years ago

  • Keywords commit added

Sure, this looks harmless enough. Thanks for the patch.

#3 @DJPaul
5 years ago

  • Milestone changed from Awaiting Review to 2.1

#4 @netweb
5 years ago

Cool, the majority of BuddyPress' source already matches the proposed 'standards' listed in the .editorconfig.

As patches come in for those who do use an .editorconfig there will be at times various patches with some extra changes pertaining to 'end of line', 'insert final new line', 'trim trailing whitespace' and 'tab vs space' indentation, in these cases we need to be nice to the patch submitter and understand that those changes are included in the patch due to their IDE/Editor use of the .editorconfig.

@netweb
5 years ago

#5 @netweb
5 years ago

In 5638.2.diff add support for YAML files should use the same code styling as JSON files in .editorconfig

http://yaml.org/spec/1.2/spec.html#id2777534

To maintain portability, tab characters must not be used in indentation


This ticket was mentioned in IRC in #buddypress-dev by netweb. View the logs.


5 years ago

#7 @djpaul
5 years ago

  • Owner set to djpaul
  • Resolution set to fixed
  • Status changed from new to closed

In 8484:

Add .editorconfig file, see http://editorconfig.org/

"EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs."

Props netweb, fixes #5638

Note: See TracTickets for help on using tickets.