public inbox for [email protected]
help / color / mirror / Atom feedAdd editorconfig support for Postgres spec files
5+ messages / 5 participants
[nested] [flat]
* Add editorconfig support for Postgres spec files
@ 2026-04-16 21:49 Tristan Partin <[email protected]>
2026-04-17 08:18 ` Re: Add editorconfig support for Postgres spec files Heikki Linnakangas <[email protected]>
0 siblings, 1 reply; 5+ messages in thread
From: Tristan Partin @ 2026-04-16 21:49 UTC (permalink / raw)
To: pgsql-hackers
I was reading through some spec files today, and my editor was resolving
the tab width as 8. I looked at some of the spec files, and we seem to
have standardized on a tab width of 4 with tabs expanded into spaces.
I decided to encode this in the .editorconfig file for convenience.
PS: I am working on a tree-sitter grammar for these files. I'll probably
try to set up a TextMate grammar was well for those who use editors that
support that. I'll share that later.
--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)
Attachments:
[text/x-patch] spec.patch (400B, 2-spec.patch)
download | inline diff:
diff --git i/.editorconfig w/.editorconfig
index 0ee9bd28ac..07e1bd0af6 100644
--- i/.editorconfig
+++ w/.editorconfig
@@ -53,6 +53,13 @@ indent_style = space
tab_width = unset
indent_size = 1
+[*.spec]
+trim_trailing_whitespace = true
+insert_final_newline = true
+indent_style = space
+tab_width = unset
+indent_size = 4
+
[*.xml]
trim_trailing_whitespace = true
insert_final_newline = true
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Add editorconfig support for Postgres spec files
2026-04-16 21:49 Add editorconfig support for Postgres spec files Tristan Partin <[email protected]>
@ 2026-04-17 08:18 ` Heikki Linnakangas <[email protected]>
2026-04-17 20:10 ` Re: Add editorconfig support for Postgres spec files Jelte Fennema-Nio <[email protected]>
2026-04-21 05:43 ` Re: Add editorconfig support for Postgres spec files Michael Paquier <[email protected]>
0 siblings, 2 replies; 5+ messages in thread
From: Heikki Linnakangas @ 2026-04-17 08:18 UTC (permalink / raw)
To: Tristan Partin <[email protected]>; pgsql-hackers
On 17/04/2026 00:49, Tristan Partin wrote:
> I was reading through some spec files today, and my editor was resolving
> the tab width as 8. I looked at some of the spec files, and we seem to
> have standardized on a tab width of 4 with tabs expanded into spaces.
There's a mix of styles in different files. To pick a few random examples:
src/test/isolation/specs/nowait.spec: indented with 2 spaces. But there
are some tabs too.
src/test/modules/injection_points/specs/repack_toast.spec: Tabs
src/test/modules/brin/specs/summarization-and-inprogress-insertion.spec:
Mix of tabs and spaces, width 4.
Yeah, it would be nice to standardize on something...
- Heikki
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Add editorconfig support for Postgres spec files
2026-04-16 21:49 Add editorconfig support for Postgres spec files Tristan Partin <[email protected]>
2026-04-17 08:18 ` Re: Add editorconfig support for Postgres spec files Heikki Linnakangas <[email protected]>
@ 2026-04-17 20:10 ` Jelte Fennema-Nio <[email protected]>
2026-04-30 19:24 ` Re: Add editorconfig support for Postgres spec files Andreas Karlsson <[email protected]>
1 sibling, 1 reply; 5+ messages in thread
From: Jelte Fennema-Nio @ 2026-04-17 20:10 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; +Cc: Tristan Partin <[email protected]>; pgsql-hackers
On Fri, 17 Apr 2026 at 10:18, Heikki Linnakangas <[email protected]> wrote:
> Yeah, it would be nice to standardize on something...
Agreed.
Whatever that standardized indenting style then is, it should then be
encoded in .gitattributes. Our editorconfig file is generated based on
that using src/tools/generate_editorconfig.py.
I think in any case that script should be update to add some "DO NOT
MODIFY MANUALLY! GENERATED USING src/tools/generate_editorconfig.py "
header to the resulting editorconfig file. Because I agree that's not
clear at the moment.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Add editorconfig support for Postgres spec files
2026-04-16 21:49 Add editorconfig support for Postgres spec files Tristan Partin <[email protected]>
2026-04-17 08:18 ` Re: Add editorconfig support for Postgres spec files Heikki Linnakangas <[email protected]>
2026-04-17 20:10 ` Re: Add editorconfig support for Postgres spec files Jelte Fennema-Nio <[email protected]>
@ 2026-04-30 19:24 ` Andreas Karlsson <[email protected]>
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Karlsson @ 2026-04-30 19:24 UTC (permalink / raw)
To: Jelte Fennema-Nio <[email protected]>; Heikki Linnakangas <[email protected]>; +Cc: Tristan Partin <[email protected]>; pgsql-hackers
On 4/17/26 22:10, Jelte Fennema-Nio wrote:
> I think in any case that script should be update to add some "DO NOT
> MODIFY MANUALLY! GENERATED USING src/tools/generate_editorconfig.py "
> header to the resulting editorconfig file. Because I agree that's not
> clear at the moment.
You mean like this? I think the comment should point them towards the
script which generated it.
--
Andreas Karlsson
Percona
Attachments:
[text/x-patch] 0001-Add-comment-clarifying-.editorconfig-is-generated.patch (1.2K, 2-0001-Add-comment-clarifying-.editorconfig-is-generated.patch)
download | inline diff:
From 72e9b5aa323756c1d1b30b597a9e5a57da227928 Mon Sep 17 00:00:00 2001
From: Andreas Karlsson <[email protected]>
Date: Thu, 30 Apr 2026 21:18:27 +0200
Subject: [PATCH] Add comment clarifying .editorconfig is generated
To make sure people do not try to manually edit .editorconfig let's add
a comment on top of the file pointing them towards where they can learn
how to generate it.
---
.editorconfig | 2 ++
src/tools/generate_editorconfig.py | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/.editorconfig b/.editorconfig
index 0ee9bd28ac4..24d3fdeae81 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,3 +1,5 @@
+# Generated by src/tools/generate_editorconfig.py
+
root = true
[*]
diff --git a/src/tools/generate_editorconfig.py b/src/tools/generate_editorconfig.py
index 0ce54f7292a..7ea1dcf5442 100755
--- a/src/tools/generate_editorconfig.py
+++ b/src/tools/generate_editorconfig.py
@@ -25,7 +25,9 @@ def main():
with open(".gitattributes", "r") as f:
lines = f.read().splitlines()
- new_contents = """root = true
+ new_contents = """# Generated by src/tools/generate_editorconfig.py
+
+root = true
[*]
indent_size = tab
--
2.43.0
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Add editorconfig support for Postgres spec files
2026-04-16 21:49 Add editorconfig support for Postgres spec files Tristan Partin <[email protected]>
2026-04-17 08:18 ` Re: Add editorconfig support for Postgres spec files Heikki Linnakangas <[email protected]>
@ 2026-04-21 05:43 ` Michael Paquier <[email protected]>
1 sibling, 0 replies; 5+ messages in thread
From: Michael Paquier @ 2026-04-21 05:43 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; +Cc: Tristan Partin <[email protected]>; pgsql-hackers
On Fri, Apr 17, 2026 at 11:18:22AM +0300, Heikki Linnakangas wrote:
> src/test/isolation/specs/nowait.spec: indented with 2 spaces. But there are
> some tabs too.
>
> src/test/modules/injection_points/specs/repack_toast.spec: Tabs
>
> src/test/modules/brin/specs/summarization-and-inprogress-insertion.spec: Mix
> of tabs and spaces, width 4.
>
> Yeah, it would be nice to standardize on something...
In terms of system_views.sql, the SQL input files in the regression
test suites and the sample files, we are using whitespaces, not tabs.
I cannot say much about the width part and what would be a good
number, but at least it seems to me that the tabs should go. We don't
really have a strict width rule for the SQL files in the regression
tests, and I don't think we need one. It would be nice to keep the
same flexibility for the isolation spec files.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, 2-signature.asc)
download
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-04-30 19:24 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-16 21:49 Add editorconfig support for Postgres spec files Tristan Partin <[email protected]>
2026-04-17 08:18 ` Heikki Linnakangas <[email protected]>
2026-04-17 20:10 ` Jelte Fennema-Nio <[email protected]>
2026-04-30 19:24 ` Andreas Karlsson <[email protected]>
2026-04-21 05:43 ` Michael Paquier <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox