[gdb/contrib] Add codespell:ignore-begin/ignore-end (disabled)

Message ID 20250411091220.21506-1-tdevries@suse.de
State Committed
Headers
Series [gdb/contrib] Add codespell:ignore-begin/ignore-end (disabled) |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom de Vries April 11, 2025, 9:12 a.m. UTC
  It would be useful to tell codespell to ignore blocks of code.

A feature ignore-multiline-regex exists, which can be used to implement this:
...
$ codespell --ignore-multiline-regex \
    'codespell:ignore-begin.*codespell:ignore-end'
...

Unfortunately there's a bug in ignore-multiline-regex where using -w in
combination with a file containing such a pattern drops all newlines.

In absence of a fix, commit this solution disabled, to locally document the
current state of this feature.
---
 gdb/contrib/setup.cfg | 9 +++++++++
 1 file changed, 9 insertions(+)


base-commit: 2cec91421e603699aa8f446d1ae44e873c4965f8
  

Comments

Tom de Vries April 26, 2025, 7:50 a.m. UTC | #1
On 4/11/25 11:12, Tom de Vries wrote:
> Unfortunately there's a bug in ignore-multiline-regex where using -w in
> combination with a file containing such a pattern drops all newlines.

Reading the issue again, I see that it's not even necessary for the file 
to contains such a pattern for the bug to trigger.

It's enough to use -w in combination with --ignore-multiline-regex.

I've updated the commit message accordingly, and pushed the patch.

Thanks,
- Tom
  
Tom de Vries Nov. 20, 2025, 9:16 a.m. UTC | #2
On 4/11/25 11:12 AM, Tom de Vries wrote:
> +# This codespell issue (
> +#https://github.com/codespell-project/codespell/issues/3381 ) reports the
> +# need to have support for ignoring blocks of code.
> +# A suggestion there is to use ignore-multiline-regex, which does work, but
> +# has a bug: using -w drops all newlines in the file (
> +#https://github.com/codespell-project/codespell/issues/3642 ).
> +# Consequently, disabled.  To be enabled when the bug is fixed.
> +#ignore-multiline-regex = codespell:ignore-begin.*codespell:ignore-end

I gave this a try ( 
https://github.com/codespell-project/codespell/pull/3832 ).

Thanks,
- Tom
  

Patch

diff --git a/gdb/contrib/setup.cfg b/gdb/contrib/setup.cfg
index 670a85064e2..878dc7ce774 100644
--- a/gdb/contrib/setup.cfg
+++ b/gdb/contrib/setup.cfg
@@ -7,3 +7,12 @@  ignore-words = gdb/contrib/codespell-ignore-words.txt
 
 # Ignore all URLs.
 uri-ignore-words-list = *
+
+# This codespell issue (
+# https://github.com/codespell-project/codespell/issues/3381 ) reports the
+# need to have support for ignoring blocks of code.
+# A suggestion there is to use ignore-multiline-regex, which does work, but
+# has a bug: using -w drops all newlines in the file (
+# https://github.com/codespell-project/codespell/issues/3642 ).
+# Consequently, disabled.  To be enabled when the bug is fixed.
+#ignore-multiline-regex = codespell:ignore-begin.*codespell:ignore-end