可扩展代码样式检查器和修正器
codestyle的Python项目详细描述
此脚本检查并自动修复所有受支持语言的代码样式:
- php(phpc)
- Python(鳞片8)
- javascript(jscs和jshint)
- css(csscomb)
- HTML(HTMLCS)
安装
# First install the pip, npm and pear package managers # Example for debian sudo apt-get install python-pip npm php-pear # Install codestyle and dependencies pip install codestyle npm install -g jshint jscs-fixer csscomb htmlcs walk brace-expansion pear install PHP_CodeSniffer
用法
usage: codestyle [-h] [-I] [-i] [-c] [-s standard-dir] [-l language name] [-e glob pattern [glob pattern ...]] target [target ...] Check and fix a code style positional arguments: target files for a checking optional arguments: -h, --help show this help message and exit -i, --fix auto fix codestyle errors if possible -c, --compact Show a compact output -s standard-dir, --standard standard-dir A path to a coding standard directory -l language name, --language language name force set the language for a checking -x glob pattern [glob pattern ...], --exclude glob pattern [glob pattern ...] Exclude paths/files from checking
示例
# check all supported files in directory recursive codestyle /path/to/project/dir # check set of files codestyle test.js test.php test.py # test directory with exclude rules codestyle /path -x '*.html' './tests/excluded_dir' # check file and try to fix errors codestyle -i test.js # check project with compact output (no detail errors information) codestyle -c /path/to/project/dir # check all project and save full report to file codestyle /path/to/project &> report.txt
依赖关系
- PHPC
- phpcbf
- jshint(nodejs)
- jscs修复程序(nodejs)
- jsc(nodejs)
- 薄片8
- csscomb(nodejs)
- htmlcs>;=0.1.4(nodejs)
- 步行(nodejs)
- 大括号扩展(nodejs)
Docker容器中的用法
也可以使用the docker container 所有已安装的依赖项。