[Bug build/34241] New: [gdb/build] Codespell word regexp refinement

"vries at gcc dot gnu.org via Gdb-prs" <[email protected]>
Newsgroups gmane.comp.gdb.bugs.discuss
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34241

            Bug ID: 34241
           Summary: [gdb/build] Codespell word regexp refinement
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I noticed a commit fixing a typo gcs_availabe -> gcs_available.

I wondered whether this was detected by codespell, and found that while this is
detected:
...
$ echo availabe | codespell -
1: availabe
        availabe ==> available
...
this isn't:
...
$ echo gcs_availabe | codespell -
$ 
...

This has to do with the --regex REGEX option, which defaults to:
...
any alphanumeric character, the underscore, the hyphen, and the apostrophe
...
which AFAICT translates to --regex="[a-zA-Z0-9_\-']+".

If we drop the underscore in there, we do get:
...
$ echo gcs_availabe | codespell --regex="[a-zA-Z0-9\-']+" -
1: gcs_availabe
        availabe ==> available
...

Trying this out in pre-commit codespell:
...
diff --git a/gdb/pyproject.toml b/gdb/pyproject.toml
index 4109dfb8f82..85d3fefa889 100644
--- a/gdb/pyproject.toml
+++ b/gdb/pyproject.toml
@@ -68,3 +68,5 @@ uri-ignore-words-list = '*'

 # How to ignore blocks of code.
 ignore-multiline-regex = 'codespell:ignore-begin.*?codespell:ignore-end'
+
+regex = "[a-zA-Z0-9\\-']+"
...
we get a fair amount of new hits:
...
$ pre-commit run codespell --all-files | grep -c '==>'
144
...

A problem with this option is that it doesn't combine with -w:
...
  -r, --regex REGEX     ... . This option cannot be specified together 
                        with --write-changes.
...   
which is a convenient way to fix codespell errors.

There's an enhancement issue open about this ( 
https://github.com/codespell-project/codespell/issues/1508 ).

Regardless, we can already use this, just not in combination with -w.

I suppose if the codespell cleanup is complete, not being able to use -w won't
be such a big issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.