cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Add basic `.editorconfig` file to help maintain consistent coding styles

Open jbampton opened this issue 2 years ago • 6 comments

Description

This PR adds a simple EditorConfig file. I used only three settings to start with.

Lots of great projects already use EditorConfig:

https://github.com/editorconfig/editorconfig/wiki/Projects-Using-EditorConfig

And you can see how Apache Airflow does it:

https://github.com/apache/airflow/blob/main/.editorconfig

From the official site:

"EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various 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."

https://editorconfig.org/

A lot of editors already come bundled with support: https://editorconfig.org/#pre-installed

Some editors require you to download a plugin: https://editorconfig.org/#download

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [X] New feature (non-breaking change which adds functionality)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] Enhancement (improves an existing feature and functionality)
  • [ ] Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [ ] Major
  • [X] Minor

Bug Severity

  • [ ] BLOCKER
  • [ ] Critical
  • [ ] Major
  • [ ] Minor
  • [X] Trivial

Screenshots (if appropriate):

How Has This Been Tested?

jbampton avatar May 25 '23 18:05 jbampton

@jbampton I like the idea but would like to not enforce people installing something. I think style would be best set in a pre-commit hook. is that possible with this tool?

DaanHoogland avatar May 26 '23 07:05 DaanHoogland

also, (i had a look at some examples) your config is not tuned to the project yet. some file types are more equal than others.

DaanHoogland avatar May 26 '23 07:05 DaanHoogland

let's move to 4.20

DaanHoogland avatar Oct 31 '23 15:10 DaanHoogland

@blueorangutan package

sureshanaparti avatar Jun 05 '25 10:06 sureshanaparti

@jbampton , is this still relevant?

DaanHoogland avatar Dec 12 '25 08:12 DaanHoogland

We should use an EditorConfig file. A lot of top projects use it:

https://github.com/editorconfig/editorconfig/wiki/Projects-Using-EditorConfig

I am not sure if we are ready to set the config and apply it to all files etc. It could possibly cause formatting changes to be mixed up with features in other peoples PRs since IDEs normally just auto format files based on the EditorConfig settings.

Normally we need to also set the indent_style and indent_size for all files overall or for each type. I think some of the Python code is currently using mixed indentation last I checked.

I have some other PRs in play and I was working on code standardization with pre-commit.

We have some other issues as seen in #12246

jbampton avatar Dec 12 '25 08:12 jbampton

@jbampton I don’t mind this. Does it need more work?

cc @vishesh92 @sureshanaparti et al.

DaanHoogland avatar Dec 12 '25 12:12 DaanHoogland

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 17.58%. Comparing base (8936e4c) to head (b567165).

Additional details and impacted files
@@            Coverage Diff            @@
##               4.22    #7562   +/-   ##
=========================================
  Coverage     17.58%   17.58%           
- Complexity    15580    15582    +2     
=========================================
  Files          5910     5910           
  Lines        529439   529439           
  Branches      64691    64691           
=========================================
+ Hits          93093    93116   +23     
+ Misses       425861   425837   -24     
- Partials      10485    10486    +1     
Flag Coverage Δ
uitests 3.57% <ø> (ø)
unittests 18.65% <ø> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Dec 18 '25 16:12 codecov[bot]