Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .editorconfig #6033

Merged
merged 5 commits into from
Jan 31, 2022
Merged

Add .editorconfig #6033

merged 5 commits into from
Jan 31, 2022

Conversation

levbishop
Copy link
Member

EditorConfig sets project-wide editor defaults: https://EditorConfig.org
Line ending, tab-width, etc, etc

A small quality-of-life improvement for new contributors if they happen to be using one of the many compatible editors.

@levbishop levbishop requested a review from a team as a code owner March 16, 2021 18:39
.editorconfig Outdated Show resolved Hide resolved
indent_size = 4

# Javascript
[*.{js,json}]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have js files?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Do you think its a bad idea to specify a default indentation for such extension even if we currently don't have any?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually do have a tiny bit of js in the repo. Not as standalone files though, there is some javascript embedded in the html template files used for the docs theme. Although those files aren't pure html either as it's actually a jinja2 template for an html file. Not that this is really relevant for this.

indent_size = 4

# Javascript
[*.{js,json}]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I think all our json files are not human-generated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that these are: https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/schemas (they're at least hand edited frequently) although all the schemas are deprecated and will be removed soon.

All the json files in https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/test/mock/backends are machine generated and not expected to be editted

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the schema files are inconsistently indented, but lean more towards 4-space than 2-space.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any preference for 2-vs-4 spaces for json?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably go 4 spaces just to be consistent with the python style we use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, since this was originally opened the schema files finished their deprecation cycle and the schema files have been removed from terra. That being said I ran tokei to find where we still have json files committed in the repo and there are 2 types. The first are api payload snapshots for the fake backends which are machine generated. The second are the user style guides which are hand generated.

========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
 Language                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Files        Lines         Code     Comments       Blanks
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
 JSON                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           105         1121         1121            0            0
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ./qiskit/visualization/styles/iqx-dark.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 202          202            0            0
 ./qiskit/visualization/styles/default.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  202          202            0            0
 ./qiskit/visualization/styles/iqx.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      202          202            0            0
 ./qiskit/visualization/styles/bw.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       202          202            0            0
 ./qiskit/test/mock/backends/rochester/conf_rochester.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1            1            0            0
 ./qiskit/test/mock/backends/santiago/conf_santiago.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1            1            0            0
 ./qiskit/test/mock/backends/quito/conf_quito.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1            1            0            0
 ./qiskit/test/mock/backends/ourense/conf_ourense.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         1            1            0            0
 ./qiskit/test/mock/backends/rome/props_rome.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              1            1            0            0
 ./qiskit/test/mock/backends/jakarta/props_jakarta.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1            1            0            0
 ./qiskit/test/mock/backends/yorktown/props_yorktown.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1            1            0            0
 ./qiskit/test/mock/backends/quito/props_quito.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1            1            0            0
 ./qiskit/test/mock/backends/valencia/props_valencia.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1            1            0            0
 ./qiskit/test/mock/backends/ourense/props_ourense.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1            1            0            0
 ./qiskit/test/mock/backends/jakarta/conf_jakarta.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         1            1            0            0
 ./qiskit/test/mock/backends/london/props_london.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1            1            0            0
 ./qiskit/test/mock/backends/lagos/conf_lagos.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1            1            0            0
 ./qiskit/test/mock/backends/valencia/defs_valencia.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1            1            0            0
 ./qiskit/test/mock/backends/johannesburg/conf_johannesburg.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1            1            0            0
 ./qiskit/test/mock/backends/cambridge/conf_cambridge.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1            1            0            0
 ./qiskit/test/mock/backends/rome/defs_rome.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1            1            0            0
 ./qiskit/test/mock/backends/santiago/defs_santiago.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1            1            0            0
 ./qiskit/test/mock/backends/quito/defs_quito.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1            1            0            0
 ./qiskit/test/mock/backends/burlington/conf_burlington.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   1            1            0            0
 ./qiskit/test/mock/backends/tokyo/props_tokyo.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1            1            0            0
 ./qiskit/test/mock/backends/casablanca/conf_casablanca.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   1            1            0            0
 ./qiskit/test/mock/backends/yorktown/defs_yorktown.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1            1            0            0
 ./qiskit/test/mock/backends/burlington/props_burlington.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  1            1            0            0
 ./qiskit/test/mock/backends/bogota/props_bogota.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1            1            0            0
 ./qiskit/test/mock/backends/bogota/conf_bogota.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/lima/conf_lima.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1            1            0            0
 ./qiskit/test/mock/backends/essex/conf_essex.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1            1            0            0
 ./qiskit/test/mock/backends/athens/props_athens.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1            1            0            0
 ./qiskit/test/mock/backends/belem/props_belem.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1            1            0            0
 ./qiskit/test/mock/backends/boeblingen/conf_boeblingen.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   1            1            0            0
 ./qiskit/test/mock/backends/athens/conf_athens.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/bogota/defs_bogota.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/paris/conf_paris.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1            1            0            0
 ./qiskit/test/mock/backends/belem/conf_belem.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1            1            0            0
 ./qiskit/test/mock/backends/cambridge/props_cambridge.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1            1            0            0
 ./qiskit/test/mock/backends/cambridge/props_cambridge_alt.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                1            1            0            0
 ./qiskit/test/mock/backends/armonk/props_armonk.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1            1            0            0
 ./qiskit/test/mock/backends/armonk/conf_armonk.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/armonk/defs_armonk.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/casablanca/props_casablanca.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  1            1            0            0
 ./qiskit/test/mock/backends/boeblingen/props_boeblingen.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  1            1            0            0
 ./qiskit/test/mock/backends/poughkeepsie/props_poughkeepsie.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                              1            1            0            0
 ./qiskit/test/mock/backends/almaden/conf_almaden.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         1            1            0            0
 ./qiskit/test/mock/backends/mumbai/conf_mumbai.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/montreal/conf_montreal.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1            1            0            0
 ./qiskit/test/mock/backends/athens/defs_athens.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/lima/defs_lima.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1            1            0            0
 ./qiskit/test/mock/backends/belem/defs_belem.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1            1            0            0
 ./qiskit/test/mock/backends/melbourne/conf_melbourne.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1            1            0            0
 ./qiskit/test/mock/backends/jakarta/defs_jakarta.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         1            1            0            0
 ./qiskit/test/mock/backends/almaden/props_almaden.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1            1            0            0
 ./qiskit/test/mock/backends/lagos/props_lagos.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1            1            0            0
 ./qiskit/test/mock/backends/toronto/conf_toronto.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         1            1            0            0
 ./qiskit/test/mock/backends/valencia/conf_valencia.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1            1            0            0
 ./qiskit/test/mock/backends/london/conf_london.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/rochester/props_rochester.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1            1            0            0
 ./qiskit/test/mock/backends/sydney/props_sydney.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1            1            0            0
 ./qiskit/test/mock/backends/manhattan/conf_manhattan.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1            1            0            0
 ./qiskit/test/mock/backends/singapore/conf_singapore.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1            1            0            0
 ./qiskit/test/mock/backends/rome/conf_rome.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1            1            0            0
 ./qiskit/test/mock/backends/manila/conf_manila.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/mumbai/props_mumbai.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1            1            0            0
 ./qiskit/test/mock/backends/manila/props_manila.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1            1            0            0
 ./qiskit/test/mock/backends/guadalupe/conf_guadalupe.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1            1            0            0
 ./qiskit/test/mock/backends/vigo/conf_vigo.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1            1            0            0
 ./qiskit/test/mock/backends/paris/props_paris.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1            1            0            0
 ./qiskit/test/mock/backends/santiago/props_santiago.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1            1            0            0
 ./qiskit/test/mock/backends/guadalupe/props_guadalupe.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1            1            0            0
 ./qiskit/test/mock/backends/melbourne/props_melbourne.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1            1            0            0
 ./qiskit/test/mock/backends/boeblingen/defs_boeblingen.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   1            1            0            0
 ./qiskit/test/mock/backends/toronto/props_toronto.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1            1            0            0
 ./qiskit/test/mock/backends/montreal/props_montreal.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1            1            0            0
 ./qiskit/test/mock/backends/brooklyn/props_brooklyn.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1            1            0            0
 ./qiskit/test/mock/backends/poughkeepsie/conf_poughkeepsie.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1            1            0            0
 ./qiskit/test/mock/backends/sydney/conf_sydney.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/singapore/props_singapore.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1            1            0            0
 ./qiskit/test/mock/backends/tenerife/props_tenerife.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1            1            0            0
 ./qiskit/test/mock/backends/vigo/props_vigo.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              1            1            0            0
 ./qiskit/test/mock/backends/lima/props_lima.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              1            1            0            0
 ./qiskit/test/mock/backends/essex/props_essex.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1            1            0            0
 ./qiskit/test/mock/backends/yorktown/conf_yorktown.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1            1            0            0
 ./qiskit/test/mock/backends/mumbai/defs_mumbai.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/paris/defs_paris.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1            1            0            0
 ./qiskit/test/mock/backends/sydney/defs_sydney.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/manila/defs_manila.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1            1            0            0
 ./qiskit/test/mock/backends/brooklyn/conf_brooklyn.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1            1            0            0
 ./qiskit/test/mock/backends/casablanca/defs_casablanca.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   1            1            0            0
 ./qiskit/test/mock/backends/johannesburg/props_johannesburg.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                              1            1            0            0
 ./qiskit/test/mock/backends/montreal/defs_montreal.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1            1            0            0
 ./qiskit/test/mock/backends/manhattan/defs_manhattan.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1            1            0            0
 ./qiskit/test/mock/backends/brooklyn/defs_brooklyn.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1            1            0            0
 ./qiskit/test/mock/backends/toronto/defs_toronto.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         1            1            0            0
 ./qiskit/test/mock/backends/poughkeepsie/defs_poughkeepsie.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1            1            0            0
 ./qiskit/test/mock/backends/lagos/defs_lagos.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1            1            0            0
 ./test/ipynb/mpl/circuit/user_style.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    213          213            0            0
 ./qiskit/test/mock/backends/guadalupe/defs_guadalupe.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1            1            0            0
 ./qiskit/test/mock/backends/manhattan/props_manhattan.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1            1            0            0
 ./qiskit/test/mock/backends/johannesburg/defs_johannesburg.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1            1            0            0
 ./qiskit/test/mock/backends/singapore/defs_singapore.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     1            1            0            0
 ./qiskit/test/mock/backends/almaden/defs_almaden.json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         1            1            0            0
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
 Total                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          105         1121         1121            0            0
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================```

Co-authored-by: Luciano Bello <[email protected]>
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM in it's current form. While I probably won't end up using this in vim (since I don't have the plugin installed), given the list of editors which support it out of the box and the current most popular editors out there seem to be on that list, it's good to have this in place to set defaults (although I'd be surprised if any editor used different defaults especially for python). Sorry this fell through the cracks.

@mtreinish mtreinish added automerge Changelog: None Do not include in changelog labels Jan 31, 2022
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1774289589

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 83.157%

Totals Coverage Status
Change from base Build 1763987014: 0.003%
Covered Lines: 51910
Relevant Lines: 62424

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants