mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-02 09:47:16 +03:00
setup: Integrate codespell
Codespell is a tool for checking misspelled words in source code [1]. Integrating this tool will enable automated spell check of the code base. Usage example: ./setup.py codespell [1] https://github.com/codespell-project/codespell Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
This commit is contained in:
parent
39a7cbbad7
commit
bb06053a8a
@ -4,10 +4,14 @@ The following commands will be useful for anyone writing patches:
|
||||
```sh
|
||||
./setup.py test # Run local unit test suite
|
||||
./setup.py pylint # Run a pylint script against the codebase
|
||||
./setup.py codespell # Run a codespell script against the codebase
|
||||
```
|
||||
|
||||
Any patches shouldn't change the output of 'test' or 'pylint'. The
|
||||
'pylint' requires `pylint` and `pycodestyle` to be installed.
|
||||
Any patches shouldn't change the output of 'test', 'pylint' or 'codespell'. The
|
||||
'pylint' requires [`pylint`](https://github.com/PyCQA/pylint) and
|
||||
[`pycodestyle`](https://github.com/pycqa/pycodestyle) to be installed. The
|
||||
'codespell' requires
|
||||
[`codespell`](https://github.com/codespell-project/codespell) to be installed.
|
||||
|
||||
Our pylint script uses a blacklist rather than a whitelist approach,
|
||||
so it could throw some false positives or useless messages. If you think
|
||||
|
27
setup.py
27
setup.py
@ -570,6 +570,32 @@ class TestDist(TestBaseCommand):
|
||||
TestBaseCommand.run(self)
|
||||
|
||||
|
||||
class CheckSpell(distutils.core.Command):
|
||||
user_options = []
|
||||
description = "Check code for common misspellings"
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
import codespell_lib
|
||||
except ImportError:
|
||||
raise ImportError('codespell is not installed')
|
||||
|
||||
files = ["setup.py", "virt-install", "virt-clone",
|
||||
"virt-convert", "virt-xml", "virt-manager",
|
||||
"virtcli", "virtinst", "virtconv", "virtManager",
|
||||
"tests"]
|
||||
# pylint: disable=protected-access
|
||||
codespell_lib._codespell.main(
|
||||
'-I', 'tests/codespell_dict.txt',
|
||||
'--skip', '*.pyc,*.zip,*.vmdk,*.iso,*.xml', *files)
|
||||
|
||||
|
||||
class CheckPylint(distutils.core.Command):
|
||||
user_options = [
|
||||
("jobs=", "j", "use multiple processes to speed up Pylint"),
|
||||
@ -688,6 +714,7 @@ distutils.core.setup(
|
||||
'configure': configure,
|
||||
|
||||
'pylint': CheckPylint,
|
||||
'codespell': CheckSpell,
|
||||
'rpm': my_rpm,
|
||||
'test': TestCommand,
|
||||
'test_ui': TestUI,
|
||||
|
2
tests/codespell_dict.txt
Normal file
2
tests/codespell_dict.txt
Normal file
@ -0,0 +1,2 @@
|
||||
matchs
|
||||
doubleclick
|
Loading…
x
Reference in New Issue
Block a user