Linux command
standardrb 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Lint Ruby files
standardrb
Lint specific files
standardrb [path/to/file.rb] [path/to/other.rb]
Automatically fix
standardrb --fix
Fix including unsafe corrections
standardrb --fix-unsafely
Generate a todo file
standardrb --generate-todo
Output in progress format
standardrb --format progress
Start language server
standardrb --lsp
说明
standardrb is Ruby's opinionated linter and formatter, bringing the StandardJS philosophy to Ruby. It provides a zero-configuration approach to code style by wrapping RuboCop with a fixed set of rules, eliminating debates about code formatting. The tool enforces consistent style across Ruby projects without requiring configuration files or team discussions about style preferences. It includes rules from RuboCop's built-in cops and rubocop-performance. Standard Ruby integrates with editors via LSP support and can be used in CI pipelines. The --generate-todo option helps adopt Standard in existing projects by creating an ignore file for current violations that can be addressed incrementally.
参数
- --fix
- Automatically fix code style issues where possible.
- --fix-unsafely
- Apply fixes including those marked as unsafe.
- --generate-todo
- Create .standard_todo.yml to ignore existing violations.
- --format _format_
- Output format: progress, simple, json, etc.
- --lsp
- Run as Language Server Protocol server for IDE integration.
- --no-fix
- Disable auto-fixing (default behavior).
- --parallel
- Run in parallel mode for faster linting.
- --config _file_
- Use a specific configuration file.
- -v, --version
- Display version information.
- -h, --help
- Display help information.
FAQ
What is the standardrb command used for?
standardrb is Ruby's opinionated linter and formatter, bringing the StandardJS philosophy to Ruby. It provides a zero-configuration approach to code style by wrapping RuboCop with a fixed set of rules, eliminating debates about code formatting. The tool enforces consistent style across Ruby projects without requiring configuration files or team discussions about style preferences. It includes rules from RuboCop's built-in cops and rubocop-performance. Standard Ruby integrates with editors via LSP support and can be used in CI pipelines. The --generate-todo option helps adopt Standard in existing projects by creating an ignore file for current violations that can be addressed incrementally.
How do I run a basic standardrb example?
Run `standardrb` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --fix do in standardrb?
Automatically fix code style issues where possible.