Add .editorconfig.
ClosedPublic

Authored by knauss on Dec 19 2018, 12:38 AM.

Details

Summary

As sebas discribed in a blogpost [1], editorconfig is a way for
communicating the code styles in different editors and IDEs.

the list of supported editors is already quite long, so let's make it
easy for new people to have the correct coding style. Especially for
python it makes sense not to mess up with a mixure of tabs and spaces.

[1] https://vizzzion.org/blog/2018/11/different-indentation-styles-per-filetype/

Diff Detail

Repository
R857 CI System Tooling
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 6198
Build 6216: arc lint + arc unit
knauss requested review of this revision.Dec 19 2018, 12:38 AM
knauss created this revision.
bcooksley accepted this revision.Dec 19 2018, 7:26 AM
bcooksley added a subscriber: bcooksley.

Looks fine to me, thanks for putting this together.

This revision is now accepted and ready to land.Dec 19 2018, 7:26 AM

Sorry, just reading over this a second time - should indent_style be tab for the .py files as that is what ci-tooling uses?

Sorry, just reading over this a second time - should indent_style be tab for the .py files as that is what ci-tooling uses?

I prefer spaces and beeing standard complience with pep8. But I'm not the owner of the repo, so you have to desice.
Well we already have mixure of tabs vs. spaces, so we need to update the scripts, that does not match the coding style afterwards:

with tabs grep -lr ' ' --exclude-dir ".git" | grep py$:

repo-metadata/scripts/BuildXML.py
repo-metadata/scripts/BuildTree.py
repo-metadata/scripts/BuildGitolite.py
repo-metadata/scripts/BuildRepoIndex.py
helpers/check-platform.py
helpers/gather-jobs.py
helpers/run-tests.py
helpers/configure-build.py
helpers/check-abi.py
helpers/list-dependencies.py
helpers/create-abi-dump.py
helpers/helperslib/BuildSpecs.py
helpers/helperslib/Settings.py
helpers/helperslib/Version.py
helpers/helperslib/Packages.py
system-images/android/sdk/target-from-manifest.py
system-images/android/sdk/target-from-appdata.py

without tabs grep -vlr ' ' --exclude-dir ".git" | grep py$:

repo-metadata/scripts/BuildXML.py
repo-metadata/scripts/BuildTree.py
repo-metadata/scripts/BuildGitolite.py
repo-metadata/scripts/BuildRepoIndex.py
helpers/check-platform.py
helpers/gather-jobs.py
helpers/run-tests.py
helpers/configure-build.py
helpers/print-lcov-results.py
helpers/check-abi.py
helpers/generate-dependency-diagram-data.py
helpers/prepare-dependencies.py
helpers/capture-workspace.py
helpers/check-appstream-compliance.py
helpers/publish-package.py
helpers/sftp-directory-mirror.py
helpers/list-dependencies.py
helpers/extract-lcov-results.py
helpers/install-build.py
helpers/getsetting.py
helpers/capture-install.py
helpers/create-abi-dump.py
helpers/extract-cmake-dependency-metadata.py
helpers/compile-build.py
helpers/build-product-dependencies.py
helpers/helperslib/BuildSpecs.py
helpers/helperslib/Settings.py
helpers/helperslib/Buildable.py
helpers/helperslib/EnvironmentHandler.py
helpers/helperslib/CommonUtils.py
helpers/helperslib/BuildSystem.py
helpers/helperslib/Version.py
helpers/helperslib/Packages.py
system-images/android/sdk/target-from-manifest.py
system-images/android/sdk/target-from-appdata.py

I can assure you that virtually all of the Python files in helpers/ (perhaps with exception for the ones you've added) will be using tabs.
Not sure where the non-tabs are being found by that grep - Python doesn't allow for mixed tabs/spaces usage for indentation.

I can assure you that virtually all of the Python files in helpers/ (perhaps with exception for the ones you've added) will be using tabs.

argh okay tab does not work to search but spaces (4spaces in a row):
check-platform.py (complete)
gather-jobs.py (see line 114)
run-tests.py (block at line 168)
configure-build.py (block line 28)
check-abi.py (complete)
list-dependencies.py (block at line 46)
getsetting.py
create-abi-dump.py
helperslib/BuildSpecs.py
helperslib/Settings.py
helperslib/CommonUtils.py
helperslib/Version.py
helperslib/Packages.py

Not sure where the non-tabs are being found by that grep

entering a tab in a space literaly is hard and I failed - but searching for spaces works.

Python doesn't allow for mixed tabs/spaces usage for indentation.

this is not true - only for one indention level this is true. and even this is not true see gather-jobs.py line 114. The rest is using tabs except this line. You see this nicely if you change tab-width to an uncommon one like 3.

The areas with spaces in those files were unintentional, and in most cases were added by others (for BuildSpecs.py, that is certainly the case).
The correct code-style for this repository is tabs for .py files.

knauss updated this revision to Diff 47882.Dec 20 2018, 10:28 AM

use tab for python.

bcooksley accepted this revision.Dec 21 2018, 2:38 AM

Thanks for updating that.

This revision was automatically updated to reflect the committed changes.