Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [RFC] add EditorConfig file
@ 2024-02-18  7:46 0x5c
  2024-03-05 14:57 ` [PR PATCH] [Updated] " 0x5c
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: 0x5c @ 2024-02-18  7:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1435 bytes --]

There is a new pull request by 0x5c against master on the void-packages repository

https://github.com/0x5c/void-packages editor-config
https://github.com/void-linux/void-packages/pull/48808

[RFC] add EditorConfig file
This PR adds an [EditorConfig](https://editorconfig.org) file to help following the general style used in the repo, along with xlint.

EditorConfig is supported by many editors (see previous link), and automatically adjusts editor settings for indentation, line endings, encoding, etc for a file based on rules. Editors that support it don't act as reformatters when saving; they only use the settings for additions and new files (just as if you has manually changed those settings), which should help new lines and new files follow basic style without user intervention and without generating large "reformat" git diffs[^1].

The exact rules in this PR are just what I surmised to be "the style", namely:
- utf-8, `lf` line-endings, no trailing whitespace at end of lines, and final newline for all files (mostly "files on linux in git")
- 4 space indent for markdown, 2 space indent for YAML
- tab indent for xbps-src and `template`/`update` (done in the everything glob)


[^1]: While that is the case, there are also linters/formatters that can use the `.editorconfig` file if a wholesale reformat is desired.

A patch file from https://github.com/void-linux/void-packages/pull/48808.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-editor-config-48808.patch --]
[-- Type: text/x-diff, Size: 977 bytes --]

From ba75618f46bc3d09d8573e04849cf6a4d14f6300 Mon Sep 17 00:00:00 2001
From: 0x5c <dev@0x5c.io>
Date: Sun, 18 Feb 2024 01:30:53 -0500
Subject: [PATCH] add EditorConfig file

---
 .editorconfig | 16 ++++++++++++++++
 .gitignore    |  1 +
 2 files changed, 17 insertions(+)
 create mode 100644 .editorconfig

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000000000..85d588a66e1d70
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+indent_size = 4
+indent_style = space
+
+[*.{yml,yaml}]
+indent_size = 2
+indent_style = space
diff --git a/.gitignore b/.gitignore
index 0a1b2da0284e7c..e91ff787554d57 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
 
 # exclude everything in root except files and directories from void-packages
 /*
+!/.editorconfig
 !/.gitattributes
 !/.github
 !/.gitignore

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-03-07 23:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-18  7:46 [PR PATCH] [RFC] add EditorConfig file 0x5c
2024-03-05 14:57 ` [PR PATCH] [Updated] " 0x5c
2024-03-05 14:58 ` 0x5c
2024-03-05 15:01 ` 0x5c
2024-03-05 15:49 ` [PR PATCH] [Updated] " 0x5c
2024-03-05 15:50 ` 0x5c
2024-03-05 16:03 ` 0x5c
2024-03-07 23:59 ` [PR PATCH] [Merged]: " classabbyamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).