Hi Roi,

Roi Dayan via dev <[email protected]> writes:

> Load dictionary_code.txt in addition to the default dictionary.

The code dictionary isn't loaded by default with codespell 
(codespell_lib/_codespell.py)::

  _builtin_default = "clear,rare"

And there are some questionable conversions in that dictionary (like
uint to unit and stdio to studio).  I think adding the _rare dictionary
could make sense, but perhaps we should be more careful when adding the
others.

Can you add the rationale for turning these on?  I think it's okay to
turn on more than one codespell dict, but we should consider the
individual dictionaries, too.

> Signed-off-by: Roi Dayan <[email protected]>
> Acked-by: Salem Sol <[email protected]>
> ---
>  utilities/checkpatch.py | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
> index f8caeb811604..9571380c291f 100755
> --- a/utilities/checkpatch.py
> +++ b/utilities/checkpatch.py
> @@ -42,14 +42,16 @@ missing_authors = []
>  def open_spell_check_dict():
>      import enchant
>  
> +    codespell_files = []
>      try:
>          import codespell_lib
>          codespell_dir = os.path.dirname(codespell_lib.__file__)
> -        codespell_file = os.path.join(codespell_dir, 'data', 
> 'dictionary.txt')
> -        if not os.path.exists(codespell_file):
> -            codespell_file = ''
> +        for fn in ['dictionary.txt', 'dictionary_code.txt']:
> +            fn = os.path.join(codespell_dir, 'data', fn)
> +            if os.path.exists(fn):
> +                codespell_files.append(fn)
>      except:
> -        codespell_file = ''
> +        pass
>  
>      try:
>          extra_keywords = ['ovs', 'vswitch', 'vswitchd', 'ovs-vswitchd',
> @@ -121,8 +123,8 @@ def open_spell_check_dict():
>  
>          spell_check_dict = enchant.Dict("en_US")
>  
> -        if codespell_file:
> -            with open(codespell_file) as f:
> +        for fn in codespell_files:
> +            with open(fn) as f:
>                  for line in f.readlines():
>                      words = line.strip().split('>')[1].strip(', ').split(',')
>                      for word in words:

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to