{"id":22740498,"url":"https://github.com/datarockets/ruby-style","last_synced_at":"2025-04-14T05:52:58.241Z","repository":{"id":52428386,"uuid":"177447943","full_name":"datarockets/ruby-style","owner":"datarockets","description":"Shared rubocop configs and custom linters for datarockets projects","archived":false,"fork":false,"pushed_at":"2024-08-27T13:23:16.000Z","size":230,"stargazers_count":10,"open_issues_count":14,"forks_count":2,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-14T05:52:51.490Z","etag":null,"topics":["hacktoberfest","linter","rubocop","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datarockets.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-24T17:40:06.000Z","updated_at":"2024-09-27T08:58:01.000Z","dependencies_parsed_at":"2024-08-26T09:18:33.216Z","dependency_job_id":"baa999e7-8cc0-4b84-b12c-e2a17bb0bdf1","html_url":"https://github.com/datarockets/ruby-style","commit_stats":null,"previous_names":["datarockets/datarockets-style"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarockets%2Fruby-style","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarockets%2Fruby-style/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarockets%2Fruby-style/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datarockets%2Fruby-style/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datarockets","download_url":"https://codeload.github.com/datarockets/ruby-style/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248830389,"owners_count":21168272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","linter","rubocop","ruby"],"created_at":"2024-12-10T23:09:08.889Z","updated_at":"2025-04-14T05:52:58.216Z","avatar_url":"https://github.com/datarockets.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Datarockets::Style [![Gem Version](https://badge.fury.io/rb/datarockets-style.svg)](https://badge.fury.io/rb/datarockets-style)\n\nDatarockets shared style configs and notes of code-style conventions. Based on the [Rubocop](https://github.com/rubocop-hq/rubocop) util.\n\nThis config enforces many of the guidelines outlined in the datarockets [Ruby Style Guide](doc/STYLE_GUIDE.md).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngroup :test, :development do\n  gem 'datarockets-style', '~\u003e 1.6.0'\nend\n```\n\nOr, for a Ruby library, add this to your gemspec:\n\n```ruby\nspec.add_development_dependency 'datarockets-style', '~\u003e 1.6.0'\n```\n\nAnd then execute:\n\n```bash\n$ bundle install\n```\n\n## Usage\n\nCreate a `.rubocop.yml` with the following directives:\n\n\n### Ruby application\n\nThis config includes specific rules for Ruby application. It works for Ruby gems and no-Rails applications.\n\n```yaml\ninherit_gem:\n  datarockets-style:\n    - config/ruby.yml\n```\n\n### Rails application\n\nFor Rails applications, you can use a specific Rails instead of Ruby config\n\n```yaml\ninherit_gem:\n  datarockets-style:\n    - config/rails.yml\n```\n\nBy default, it doesn't include rules for I18n. For enabling them, add the next styles\n\n```yaml\ninherit_gem:\n  datarockets-style:\n    - config/rails.yml\n    - config/rails-locales.yml\n```\n\n### GraphQL config\n\nTo include specific rules for GraphQL, you can add the following config\n\n```yaml\ninherit_gem:\n  datarockets-style:\n    - config/graphql.yml\n```\n\n### Rspec config\n\nFor Rspec tests, you can add a special rubocop config\n\n```yaml\ninherit_gem:\n  datarockets-style:\n    - config/ruby.yml\n    - config/rspec.yml\n```\n\nNow, run:\n\n```bash\n$ bundle exec rubocop\n```\n\nYou do not need to include rubocop directly in your application's dependencies. Datarockets-style will include a specific version of `rubocop` and `rubocop-rspec` that is shared across all projects.\n\n### Configurable cops\n\nThere are some areas in which there is no clear consensus in datarockets team regarding a particular style (like string literal quoting).\nIn such scenarios, all popular styles are acknowledged and it’s up to you to pick one and apply it consistently.\nFor that just set up these cops before starting of usage.\n\n#### RSpec/LetSetup\n\n[This cop](https://rubocop-rspec.readthedocs.io/en/latest/cops_rspec/#rspecletsetup) is enabled by default and we suggest not to use unreferenced `let` variables in your test cases.\nHowever, if it feels like the cop should be enabled and tests can't be written w/o them, please create an issue with your cases so that we can re-thinking our solution about enabling this cop.\n\n#### Style/StringLiterals\n\nThere are two popular styles in the Ruby community, both of which are considered good - single quotes by default and double quotes by default.\nThere is no clear consensus about this style in the Ruby community and in the datarockets team.\nSo we suggest just to set up a [preferable style](https://rubocop.readthedocs.io/en/latest/cops_style/#stylestringliterals) before running this gem.\n\nP.S. The string literals in this gem are using double quotes by default.\n\n##### Tips\n\nFor an existing project, we suggest running rubocop with both styles and choose which has fewer offenses (which is more popular in the current project).\n\n### Custom cops\n\nWe have custom cops. You can find specification for them [here](manual).\n\n## Formatters\n\n### ToDo list formatter\n\nThis formatter allows us to get list of files for some offense and with number of offenses in each file. This file can be useful if you need to fix a large some cop step by step.\n\nResult of the formatter is compatible with rubocop config or rubocop todo file.\n\nFor running that cop, just print in your command like\n\n```bash\n$ bundle exec rubocop -f TodoListFormatter -r datarockets_style\nInspecting 10 files\n...CC.CC..\n10 files inspected, 7 offenses detected\n\nLayout/IndentationConsistency:\n  Exclude:\n    - 'spec/datarockets_style/formatter/todo_list_formatter_spec.rb' # 1\n\nNaming/MemoizedInstanceVariableName:\n  Exclude:\n    - 'lib/datarockets_style/formatter/todo_list_formatter/report_summary.rb' # 1\n\nRSpec/ExampleLength:\n  Exclude:\n    - 'spec/datarockets_style/formatter/todo_list_formatter/report_summary_spec.rb' # 1\n    - 'spec/datarockets_style/formatter/todo_list_formatter_spec.rb' # 2\n\nStyle/Documentation:\n  Exclude:\n    - 'lib/datarockets_style/formatter/todo_list_formatter/report_summary.rb' # 1\n    - 'lib/datarockets_style/formatter/todo_list_formatter.rb' # 1\n```\n\n#### Autocorrection\n\nIf you run the formatter with autocorrection options, the formatter skip corrected cop and does not include it to the result.\n\n```bash\n$ bundle exec rubocop -f TodoListFormatter -r datarockets_style -a\nInspecting 10 files\n...CC.CC..\n10 files inspected, 7 offenses detected, 1 offenses corrected\n\nNaming/MemoizedInstanceVariableName:\n  Exclude:\n    - 'lib/datarockets_style/formatter/todo_list_formatter/report_summary.rb' # 1\n\nRSpec/ExampleLength:\n  Exclude:\n    - 'spec/datarockets_style/formatter/todo_list_formatter/report_summary_spec.rb' # 1\n    - 'spec/datarockets_style/formatter/todo_list_formatter_spec.rb' # 2\n\nStyle/Documentation:\n  Exclude:\n    - 'lib/datarockets_style/formatter/todo_list_formatter/report_summary.rb' # 1\n    - 'lib/datarockets_style/formatter/todo_list_formatter.rb' # 1\n```\n\n## Non-goals of RuboCop\n\n### Rspec configuration\n\nRSpec-core library provides some configuration rules which provides some linting rules itself. Read more about it in [RuboCop Rspec non-goals topic](https://github.com/rubocop-hq/rubocop-rspec#non-goals-of-rubocop-rspec).\n\n## Changelog\n\nDatarockets Style's changelog is available [here](CHANGELOG.md).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/datarockets/datarockets-style. If you'd like to contribute to our RuboCop config and code-style rules, please take the time to go through our short [contribution guidelines](CONTRIBUTING.md).\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the DatarocketsStyle project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatarockets%2Fruby-style","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatarockets%2Fruby-style","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatarockets%2Fruby-style/lists"}