Files
tldr/pages.zh/common/rubocop.md

32 lines
655 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# rubocop
> 检查 Ruby 文件。
> 更多信息:<https://docs.rubocop.org/rubocop/usage/basic_usage.html>。
- 检查当前目录(包括子目录)中的所有文件:
`rubocop`
- 检查一个或多个特定文件或目录:
`rubocop {{路径/到/文件_或_目录1 路径/到/文件_或_目录2 ...}}`
- 将输出写入文件:
`rubocop --out {{路径/到/文件}}`
- 查看警察lint 规则)列表:
`rubocop --show-cops`
- 排除一个警察:
`rubocop --except {{警察1 警察2 ...}}`
- 仅运行指定的警察:
`rubocop --only {{警察1 警察2 ...}}`
- 自动修正文件(实验性):
`rubocop --auto-correct`