From 7bcbef16fe4b3e4b39794addab70eb60a2c6c562 Mon Sep 17 00:00:00 2001 From: Mikhail Polivakha <68962645+mipo256@users.noreply.github.com> Date: Sun, 11 May 2025 16:42:14 +0300 Subject: [PATCH 1/4] Added a small section addressing empty editorconfig files --- index.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.rst b/index.rst index 9ee7309..205fad2 100644 --- a/index.rst +++ b/index.rst @@ -207,8 +207,8 @@ When a filename is given to EditorConfig a search is performed in the directory of the given file and all parent directories for an EditorConfig file. An EditorConfig file is named ".editorconfig", all lowercased. Non-existing directories are treated as if they exist and are empty. All found -EditorConfig files are searched for sections with section names matching the -given filename. The search shall stop if an EditorConfig file is found with +EditorConfig files are searched for sections with section glob expressions matching +the given filename. The search shall stop if an EditorConfig file is found with the ``root`` key set to ``true`` in the preamble or when reaching the root filesystem directory. @@ -238,6 +238,11 @@ described in the previous paragraph is to prevent the need of the additional operation of specifically retrieving the filename, which can be relatively expensive in the context of EditorConfig. +Empty EditorConfig Files +------------------------ +An empty ``.editorconfig`` file is considered to be a valid ``.editorconfig`` file +with no sections and with implicit ``root`` key set to ``false``. + .. _supported-pairs: Supported Pairs From fec38b2e80a904aef4d1932563edb5ee5bc67393 Mon Sep 17 00:00:00 2001 From: Mikhail Polivakha <68962645+mipo256@users.noreply.github.com> Date: Mon, 12 May 2025 18:56:44 +0300 Subject: [PATCH 2/4] Code review changes --- index.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.rst b/index.rst index 205fad2..55b447c 100644 --- a/index.rst +++ b/index.rst @@ -110,6 +110,12 @@ Any line that is not one of the above is invalid. EditorConfig files must be UTF-8 encoded, with LF or CRLF line separators. +Empty EditorConfig Files +------------------------ +An empty ``.editorconfig`` file contains only Blank and Comment lines, or no +lines at all. It is equivalent to an ``.editorconfig`` file that contains only +one line, ``root = false``. + No inline comments ------------------ @@ -238,11 +244,6 @@ described in the previous paragraph is to prevent the need of the additional operation of specifically retrieving the filename, which can be relatively expensive in the context of EditorConfig. -Empty EditorConfig Files ------------------------- -An empty ``.editorconfig`` file is considered to be a valid ``.editorconfig`` file -with no sections and with implicit ``root`` key set to ``false``. - .. _supported-pairs: Supported Pairs From fe4ed6b6e93ece684e727e8875d08fb5546bc56b Mon Sep 17 00:00:00 2001 From: Mikhail Polivakha <68962645+mipo256@users.noreply.github.com> Date: Wed, 14 May 2025 11:34:10 +0300 Subject: [PATCH 3/4] Update index.rst --- index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.rst b/index.rst index 55b447c..57d004b 100644 --- a/index.rst +++ b/index.rst @@ -213,8 +213,8 @@ When a filename is given to EditorConfig a search is performed in the directory of the given file and all parent directories for an EditorConfig file. An EditorConfig file is named ".editorconfig", all lowercased. Non-existing directories are treated as if they exist and are empty. All found -EditorConfig files are searched for sections with section glob expressions matching -the given filename. The search shall stop if an EditorConfig file is found with +EditorConfig files are searched for sections with section names matching the +given filename. The search shall stop if an EditorConfig file is found with the ``root`` key set to ``true`` in the preamble or when reaching the root filesystem directory. From 36f276f3b2f91d07d62972225ae2eadcdf1ae9c8 Mon Sep 17 00:00:00 2001 From: Mikhail Polivakha <68962645+mipo256@users.noreply.github.com> Date: Wed, 14 May 2025 11:34:41 +0300 Subject: [PATCH 4/4] Update index.rst --- index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.rst b/index.rst index 57d004b..5be5785 100644 --- a/index.rst +++ b/index.rst @@ -213,7 +213,7 @@ When a filename is given to EditorConfig a search is performed in the directory of the given file and all parent directories for an EditorConfig file. An EditorConfig file is named ".editorconfig", all lowercased. Non-existing directories are treated as if they exist and are empty. All found -EditorConfig files are searched for sections with section names matching the +EditorConfig files are searched for sections with section names matching the given filename. The search shall stop if an EditorConfig file is found with the ``root`` key set to ``true`` in the preamble or when reaching the root filesystem directory.