Automated docstring and comments spell check

前端 未结 1 1028
长情又很酷
长情又很酷 2021-02-05 04:33

Consider the following sample code:

# -*- coding: utf-8 -*-
\"\"\"Test module.\"\"\"


def test():
    \"\"\"Tets function\"\"\"
    return 10

1条回答
  •  再見小時候
    2021-02-05 04:48

    Pylint just released 1.4.0, which includes a spell-checker. Here is the initial pull-request.

    Note that, to make the checker work, you need to install pyenchant python module and have an enchant library installed system-wide. On mac, it can be installed via brew:

    $ brew install enchant
    

    By default, the spelling pylint checker is turned off. You can enable it either in the pylint rc configuration file, or from the command-line:

    $ cat test.py
    # I am the tyop
    
    $ pylint --disable all --enable spelling --spelling-dict en_US test.py
    C:  1, 0: Wrong spelling of a word 'tyop' in a comment:
    # I am the tyop
               ^^^^
    Did you mean: 'typo' or 'top' or 'tip' or 'topi'? (wrong-spelling-in-comment)
    

    0 讨论(0)
提交回复
热议问题