From 491b139b362766f8ceacc28dc5d87b68bc25b8bf Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Jul 2026 02:07:57 +0000 Subject: [PATCH] Update `.editorconfig` file This updates the project `.editorconfig` file to use a better approach that was discovered over time in other projects. Instead of setting properties (particularly `indent_size`) explicitly for most file types, this sets global default values, and then only sets file-specific values if they need to differ from the default(s). In addition, this streamlines the comments to be more concise and focused. --- .editorconfig | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/.editorconfig b/.editorconfig index 27247697ff..ec3c019b52 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,53 +12,44 @@ # See the License for the specific language governing permissions and # limitations under the License. -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Common editor configurations for this project. -# -# EditorConfig is a file format for specifying some common style parameters. -# Many IDEs & editors read .editorconfig files, either natively or via plugins. -# We mostly follow Google's style guides (https://google.github.io/styleguide/) -# with only a few deviations for line length and indentation in some files. -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - root = true +# We mostly follow Google's style guides (https://google.github.io/styleguide/) +# but prefer using 100 columns and 4-space indentation for most file types. + +# IMPORTANT: some of the other config files & entries in pyproject.toml have +# the same settings and need to be updated if changes are made to this file. [*] charset = utf-8 +indent_size = 4 indent_style = space insert_final_newline = true +max_line_length = 100 spelling_language = en-US trim_trailing_whitespace = true -max_line_length = 100 -[{BUILD,*.BUILD,*.bzl,*.bazel,.bazelrc}] -# Google doesn't have a style guideline for Bazel files. Most people use 4. -indent_size = 4 +[{COMMIT_EDITMSG,MERGE_MSG,SQUASH_MSG,TAG_EDITMSG}] +max_line_length = 72 + +[{Makefile,makefile,*.mk}] +indent_style = tab +indent_size = 8 +tab_width = 8 -[{*.cc,*.h}] -# Google style guidelines use 2. +[{*.cc,*.h,*.inc}] indent_size = 2 [{*.js,*.ts}] -# Google style guidelines use 2. indent_size = 2 [*.json] -# Not stated explicitly in Google's guidelines, but the examples use 2. indent_size = 2 -[*.py] -# Google style guidelines use 4. -indent_size = 4 +[*.patch] +trim_trailing_whitespace = false [*.rst] -# Google doesn't have a style guideline for reStructuredText. Many people use 3. indent_size = 3 -[*.sh] -# Google style guidelines use 2. -indent_size = 4 - -[{*.yaml,*.yml}] -# Google doesn't have style guidelines for YAML. Most people use indent = 2. +[{*.yaml,*.yml,*.cff}] indent_size = 2