From 5bba4eb80652f8e8f9a448919ebbe4a1ba37e75d Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Mon, 15 Jul 2024 18:44:51 +0100 Subject: [PATCH] Make `config.ignore` filename list case-insensitive & add more automatically ignored filenames --- docs/configuration.rst | 4 ++-- src/towncrier/_builder.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 562ec51c..955f62e2 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -131,11 +131,11 @@ Top level keys ``true`` by default. ``ignore`` - A list of filenames in the news fragments directory to ignore. + A case-insensitive list of filenames in the news fragments directory to ignore. ``towncrier check`` will fail if there are any news fragment files that have invalid filenames, except for those in the list. ``towncrier build`` will likewise fail, but only if this list has been configured (set to an empty list if there are no files to ignore). - Note that if a custom template is stored in the news fragment directory, you should add it to this list. + Some filenames such as ``.gitignore`` and ``README`` are automatically ignored. However, if a custom template is stored in the news fragment directory, you should add it to this list. ``None`` by default. diff --git a/src/towncrier/_builder.py b/src/towncrier/_builder.py index 6ad8f2e6..b883cea2 100644 --- a/src/towncrier/_builder.py +++ b/src/towncrier/_builder.py @@ -114,7 +114,7 @@ def find_fragments( If strict, raise ClickException if any fragments have an invalid name. """ - ignored_files = {".gitignore"} + ignored_files = {".gitignore", ".keep", "readme", "readme.md", "readme.rst"} if config.ignore: ignored_files.update(config.ignore) @@ -137,7 +137,7 @@ def find_fragments( file_content = {} for basename in files: - if basename in ignored_files: + if basename.lower() in ignored_files: continue issue, category, counter = parse_newfragment_basename(