Giter Club home page Giter Club logo

ruby-style-guide's Introduction

Ruby Style Guide

Ruby Style Guide for Pattern Ruby Projects

Installation

  1. Add below gems to your Gemfile. If you have remote, development and test group in your Gemfile, please add these gems to all envs.

    gem 'rubocop'
    gem 'rubocop-thread_safety'
    gem 'rubocop-rails'
    gem 'rubocop-rspec'
    gem 'rubocop-performance'
    gem 'rubocop-sequel'
    gem 'rubocop-rake'
  2. Create a new file .rubocop.yml. If you already have .rubocop.yml file, we recommend that you delete it as it may have been obsolute.

    touch .rubocop.yml
  3. Add below code to your .rubocop.yml.

    Always go with the latest version.

    inherit_from:
    - https://raw.githubusercontent.com/patterninc/ruby-style-guide/main/rubocop.yml
    - .rubocop_todo.yml

    For some reason, if you want to go to the previous version, you can use it like this:

    inherit_from:
    - https://raw.githubusercontent.com/patterninc/ruby-style-guide/1.0.0/rubocop.yml
    - .rubocop_todo.yml
  4. Run the below command to generate your todo. This will put all existing violations into TODO file which will let you ignore them for intital setup. This shouldn't be a practice to run it to exclude your violations.

    rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 10000
  5. Run Rubocop before every commit to prevent new violations.

    bundle exec rubocop
  6. Setup CircleCI. Add below code to your .circleci/config.yml

    run:
        name: Static Code Analysis
        command: bundle exec rubocop
  7. Add this to your .gitignore file

    .rubocop-https---raw-githubusercontent-com-patterninc-ruby-style-guide-*
    

Updating Project's Ruby Style Guide

When you modify rubocop.yml, all consuming repositories would start getting voilations depending on the rules you change. Whenever this file is updated, we need to regenerate .rubocop_todo.yml in all projects. This will add newly discovered voiloations into .rubocop_todo.yml file and prevent builds from breaking.

Regenrate todo using this command

rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 10000

Updating Pattern's Ruby Style Guide

This repository follows Semantic Versioning. All changes are documented in CHANGELOG.md as per https://keepachangelog.com/.

Regenerating .rubocop_todo.yml file

Always regenerate todo file using below command

rubocop --regenerate-todo --auto-gen-only-exclude --exclude-limit 10000

ruby-style-guide's People

Contributors

ssontakke avatar rachna23 avatar

Stargazers

Sagar Junnarkar avatar

Watchers

Nate Salisbury avatar Landon Cope avatar  avatar  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.