Coder Social home page Coder Social logo

house_style's Introduction

HouseStyle

Be nice and consistent from project to project.

This gem acts as a local repository for house style checkers for Ruby and Rails projects.

Installation

Add this line to your application's Gemfile:

group :development, :test do
  gem 'house_style', git: '[email protected]:BIAINC/house_style.git'
end

And then execute:

$ bundle

Usage

For non-Rails projects, add the following to the top of your .rubocop.yml file:

inherit_gem:
  house_style: ruby/rubocop.yml

For Rails projects, you should use the instruction below, which includes all the standard Ruby house styles, with Rails-specific cops:

inherit_gem:
  house_style: rails/rubocop.yml

If using RSpec, add a spec/.rubocop.yml file:

inherit_gem:
  house_style: rspec/rubocop.yml

house_style comes with a Rails generator which can set up both your project root and your RSpec folder to start using the default house styles by default. With house_style declared in your Gemfile:

$ rails generate house_style:install

This will create .rubocop.yml files in your project root and spec folders.

Using this gem with Atom Editor

  • Install Linter
  • Install Linter Rubocop
  • Inside the settings for the Linter Rubocop package, set the command to:
bundle exec rubocop
  • Ensure the setting is checked that reads:

Disable when no .rubocop.yml config file is found

Using these files with CodeClimate

Codeclimate can not download external gems, but it can download specific files. Add this to the top of your .codeclimate.yml:

prepare:
  fetch:
    - url: https://raw.githubusercontent.com/BIAINC/house_style/master/rails/rubocop.yml
      path: "codeclimate/rails/rubocop.yml"
    - url: https://raw.githubusercontent.com/BIAINC/house_style/master/ruby/rubocop.yml
      path: "codeclimate/ruby/rubocop.yml"
    - url: https://raw.githubusercontent.com/BIAINC/house_style/master/ruby/configuration.yml
      path: "codeclimate/ruby/configuration.yml"
    - url: https://raw.githubusercontent.com/BIAINC/house_style/master/ruby/layout.yml
      path: "codeclimate/ruby/layout.yml"
    - url: https://raw.githubusercontent.com/BIAINC/house_style/master/ruby/metrics.yml
      path: "codeclimate/ruby/metrics.yml"
    - url: https://raw.githubusercontent.com/BIAINC/house_style/master/ruby/style.yml
      path: "codeclimate/ruby/style.yml"

Note that if you are using only the ruby rubocop file, you will need to replace master/rails/ with master/ruby/ in the file paths.

Inside the same file, where you set up rubocop, add the following to use the proper config:

rubocop:
  enabled: true
  config: 'codeclimate/rails/rubocop.yml'

Finally, add /codeclimate to your .gitignore.

Development

The gem has no executable code of its own, so there is no test suite to speak of.

Before committing any changes, ensure that it conforms to its own rubocop settings.

To install this gem onto your local machine, run bundle exec rake install.

Releasing a new version

Update the version number in house_style.gemspec, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/altmetric/house_style. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

house_style's People

Contributors

scottmatthewman avatar d3vkit avatar jbilbo avatar mattmacleod avatar

Watchers

Eric Krause avatar  avatar  avatar Paul Morton avatar James Cloos avatar Michael Gronski avatar Amy Sutedja avatar  avatar  avatar Jared Eklin 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.