https://github.com/rubocop/rubocop-capybara
Code style checking for Capybara files.
https://github.com/rubocop/rubocop-capybara
capybara lint rubocop ruby static-analysis testing
Last synced: about 1 year ago
JSON representation
Code style checking for Capybara files.
- Host: GitHub
- URL: https://github.com/rubocop/rubocop-capybara
- Owner: rubocop
- License: mit
- Created: 2022-12-16T10:15:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-12T16:06:09.000Z (over 1 year ago)
- Last Synced: 2025-03-31T14:16:32.330Z (about 1 year ago)
- Topics: capybara, lint, rubocop, ruby, static-analysis, testing
- Language: Ruby
- Homepage: https://docs.rubocop.org/rubocop-capybara
- Size: 978 KB
- Stars: 45
- Watchers: 4
- Forks: 9
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: MIT-LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# RuboCop Capybara
[](https://gitter.im/rubocop-rspec/Lobby)
[](https://rubygems.org/gems/rubocop-capybara)

[Capybara](https://teamcapybara.github.io/capybara)-specific analysis for your projects, as an extension to
[RuboCop](https://github.com/rubocop/rubocop).
## Installation
Just install the `rubocop-capybara` gem
```bash
gem install rubocop-capybara
```
or if you use bundler put this in your `Gemfile`
```ruby
gem 'rubocop-capybara', require: false
```
## Usage
You need to tell RuboCop to load the Capybara extension. There are three
ways to do this:
### RuboCop configuration file
Put this into your `.rubocop.yml`.
```yaml
plugins: rubocop-capybara
```
Alternatively, use the following array notation when specifying multiple extensions.
```yaml
plugins:
- rubocop-other-extension
- rubocop-capybara
```
Now you can run `rubocop` and it will automatically load the RuboCop Capybara
cops together with the standard cops.
> [!NOTE]
> The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
### Command line
```bash
rubocop --plugin rubocop-capybara
```
### Rake task
```ruby
RuboCop::RakeTask.new do |task|
task.plugins << 'rubocop-capybara'
end
```
## Documentation
You can read more about RuboCop Capybara in its [official manual](https://docs.rubocop.org/rubocop-capybara).
## The Cops
All cops are located under
[`lib/rubocop/cop/capybara`](lib/rubocop/cop/capybara), and contain
examples/documentation.
In your `.rubocop.yml`, you may treat the Capybara cops just like any other
cop. For example:
```yaml
Capybara/SpecificMatcher:
Exclude:
- spec/my_spec.rb
```
## Contributing
Checkout the [contribution guidelines](.github/CONTRIBUTING.md).
## License
`rubocop-capybara` is MIT licensed. [See the accompanying file](MIT-LICENSE.md) for
the full text.