可扩展代码样式检查器和修正器

codestyle的Python项目详细描述


https://travis-ci.org/webpp-studio/codestyle.svg?branch=master

此脚本检查并自动修复所有受支持语言的代码样式:

  1. php(phpc)
  2. Python(鳞片8)
  3. javascript(jscs和jshint)
  4. css(csscomb)
  5. 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

依赖关系

  1. PHPC
  2. phpcbf
  3. jshint(nodejs)
  4. jscs修复程序(nodejs)
  5. jsc(nodejs)
  6. 薄片8
  7. csscomb(nodejs)
  8. htmlcs>;=0.1.4(nodejs)
  9. 步行(nodejs)
  10. 大括号扩展(nodejs)

Docker容器中的用法

也可以使用the docker container 所有已安装的依赖项。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java接口中的每个方法都是抽象的,但在抽象类中,我们也只能使用抽象方法   初始化Java中声明的、未初始化的变量会发生什么情况?   java BouncyCastle openPGP将字节[]数组加密为csv文件   在Java中将类A(和所有子类)映射到类B的实例的字典   RSA公钥编码,在Java和Android中,代码相同,结果不同   java在安卓中实现数字检测语音识别   java取消选择复选框   java如何在其他配置中重用Maven配置XML片段   java有没有一种有效的方法来检查HashMap是否包含映射到相同值的键?   spring处理程序调度失败;嵌套的例外是java。lang.NoClassDefFoundError:org/apache/http/client/HttpClient   带有ehcache的java多层缓存   java如何访问chromium(或任何其他浏览器)cookie   java通过将两个集合与spring data mongodb data中的条件合并来获取计数   安卓中R.java的语法错误