https://github.com/utkarsh2102/rubocop-packaging
A RuboCop extension focused on enforcing upstream best practices and coding conventions.
https://github.com/utkarsh2102/rubocop-packaging
code-formatter downstream linter packaging rubocop ruby static-code-analysis upstream
Last synced: 7 months ago
JSON representation
A RuboCop extension focused on enforcing upstream best practices and coding conventions.
- Host: GitHub
- URL: https://github.com/utkarsh2102/rubocop-packaging
- Owner: utkarsh2102
- License: mit
- Created: 2020-06-07T16:56:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-23T05:19:55.000Z (7 months ago)
- Last Synced: 2025-03-28T20:06:26.666Z (7 months ago)
- Topics: code-formatter, downstream, linter, packaging, rubocop, ruby, static-code-analysis, upstream
- Language: Ruby
- Homepage:
- Size: 167 KB
- Stars: 36
- Watchers: 6
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RuboCop::Packaging
`RuboCop::Packaging` is an extension of [RuboCop](https://rubocop.org/),
which is a Ruby static code analyzer (a.k.a. linter) and code formatter.
It helps enforcing some of the guidelines that are expected of upstream
maintainers so that the downstream can build their packages in a clean
environment without any problems.
## Documentation
A detailed documentation, explaining what this extension is doing and the
reasoning behind it, can be found here: https://docs.rubocop.org/rubocop-packaging/
We also have a [packaging-style-guide](https://packaging.rubystyle.guide/),
listing some good and bad examples and the rationale behind these cops.
In case anything is not clear, please feel free to raise an issue, asking
for more explanation!
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'rubocop-packaging'
```
And then execute:
```bash
$ bundle install
```
Or install it yourself as:
```bash
$ gem install rubocop-packaging
```
## Usage
You need to tell RuboCop to load the Packaging extension. There are three
ways to do this:
### RuboCop configuration file
Put this into your `.rubocop.yml` file:
```yaml
plugins: rubocop-packaging
```
Alternatively, use the following array notation when specifying multiple
extensions:
```yaml
plugins:
- rubocop-other-extension
- rubocop-packaging
```
Now you can run `rubocop` and it will automatically load the RuboCop Packaging
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-packaging
```
### Rake task
```ruby
RuboCop::RakeTask.new do |task|
task.plugins << 'rubocop-packaging'
end
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then,
run `rake spec` to run the tests. You can also run `bin/console` for an
interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`.
## Contributing
As always, bug reports and pull requests are heartily welcomed! 💖
This project is intended to be a safe and welcoming space for collaboration.
## License
`rubocop-packaging` is available as open-source under the
[MIT License](https://github.com/utkarsh2102/rubocop-packaging/blob/master/LICENSE).