Coder Social home page Coder Social logo

byellokore / rubocop-rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rubocop/rubocop-rails

0.0 0.0 0.0 26.84 MB

A RuboCop extension focused on enforcing Rails best practices and coding conventions.

Home Page: https://docs.rubocop.org/rubocop-rails

License: MIT License

Ruby 99.99% Shell 0.01%

rubocop-rails's Introduction

RuboCop Rails

Gem Version CircleCI

A RuboCop extension focused on enforcing Rails best practices and coding conventions.

Note: This repository manages rubocop-rails gem (>= 2.0.0). rubocop-rails gem (<= 1.5.0) has been renamed to rubocop-rails_config gem.

Installation

Just install the rubocop-rails gem

gem install rubocop-rails

or if you use bundler put this in your Gemfile

gem 'rubocop-rails', require: false

Usage

You need to tell RuboCop to load the Rails extension. There are three ways to do this:

RuboCop configuration file

Put this into your .rubocop.yml.

require: rubocop-rails

Alternatively, use the following array notation when specifying multiple extensions.

require:
  - rubocop-other-extension
  - rubocop-rails

Now you can run rubocop and it will automatically load the RuboCop Rails cops together with the standard cops.

Command line

rubocop --require rubocop-rails

Note: --rails option is required while rubocop command supports --rails option.

Rake task

RuboCop::RakeTask.new do |task|
  task.requires << 'rubocop-rails'
end

The Cops

All cops are located under lib/rubocop/cop/rails, and contain examples/documentation.

In your .rubocop.yml, you may treat the Rails cops just like any other cop. For example:

Rails/FindBy:
  Exclude:
    - lib/example.rb

Documentation

You can read a lot more about RuboCop Rails in its official docs.

Compatibility

Rails cops support the following versions:

  • Rails 4.2+

Readme Badge

If you use RuboCop Rails in your project, you can include one of these badges in your readme to let people know that your code is written following the community Rails Style Guide.

Rails Style Guide

Rails Style Guide

Here are the Markdown snippets for the two badges:

[![Rails Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop-rails)

[![Rails Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rails.rubystyle.guide)

Contributing

Checkout the contribution guidelines.

License

rubocop-rails is MIT licensed. See the accompanying file for the full text.

rubocop-rails's People

Contributors

koic avatar drenmi avatar pocke avatar rrosenblum avatar fatkodima avatar wata727 avatar bbatsov avatar eugeneius avatar backus avatar bquorning avatar tejasbubane avatar andyw8 avatar garettarrowood avatar palkan avatar pirj avatar alexdowad avatar hoshinotsuyoshi avatar jonas054 avatar lumeet avatar sinsoku avatar dvandersluis avatar maxjacobson avatar geniou avatar sunny avatar yujinakayama avatar quinnharris avatar santib avatar r7kamura avatar knack avatar robotdana avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.