├── .rspec ├── lib ├── rubyflare │ ├── version.rb │ ├── response.rb │ └── connect.rb └── rubyflare.rb ├── Gemfile ├── .travis.yml ├── Rakefile ├── bin ├── setup └── console ├── .gitignore ├── .codeclimate.yml ├── spec ├── spec_helper.rb ├── rubyflare_spec.rb ├── rubyflare │ ├── response_spec.rb │ └── connect_spec.rb └── rubyflare_integration_spec.rb ├── LICENSE.txt ├── rubyflare.gemspec ├── CODE_OF_CONDUCT.md ├── README.md └── .rubocop.yml /.rspec: -------------------------------------------------------------------------------- 1 | --format documentation 2 | --require spec_helper 3 | --color 4 | -------------------------------------------------------------------------------- /lib/rubyflare/version.rb: -------------------------------------------------------------------------------- 1 | module Rubyflare 2 | VERSION = "0.2.1" 3 | end 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in rubyflare.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.0.0 4 | - 2.1.7 5 | - 2.2.3 6 | before_install: gem install bundler -v 1.11 7 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | require "rspec/core/rake_task" 3 | 4 | RSpec::Core::RakeTask.new(:spec) 5 | 6 | task :default => :spec 7 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | bundle install 6 | 7 | # Do any other automated setup that you need to do here 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | /fixtures/ 11 | -------------------------------------------------------------------------------- /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | --- 2 | engines: 3 | fixme: 4 | enabled: true 5 | rubocop: 6 | enabled: true 7 | ratings: 8 | paths: 9 | - "**.rb" 10 | exclude_paths: 11 | - spec/**/* 12 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "bundler/setup" 4 | require "rubyflare" 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require "pry" 11 | # Pry.start 12 | 13 | require "irb" 14 | IRB.start 15 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require "codeclimate-test-reporter" 2 | CodeClimate::TestReporter.start 3 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 4 | require 'rubyflare' 5 | 6 | RSpec.configure do |config| 7 | config.mock_with :rspec do |mocks| 8 | mocks.verify_partial_doubles = true 9 | end 10 | 11 | config.filter_run :focus 12 | config.run_all_when_everything_filtered = true 13 | config.order = :random 14 | end 15 | -------------------------------------------------------------------------------- /spec/rubyflare_spec.rb: -------------------------------------------------------------------------------- 1 | describe Rubyflare do 2 | 3 | describe '.connect_with' do 4 | subject(:connection) { described_class.connect_with('bear@dog.com', 'superapikey') } 5 | 6 | it 'creates an instance of RubyFlare::Connect with passed arguments' do 7 | expect(Rubyflare::Connect).to receive(:new).with('bear@dog.com', 'superapikey') 8 | connection 9 | end 10 | 11 | it 'returns an instance of Rubyflare::Connect' do 12 | expect(connection).to be_a(Rubyflare::Connect) 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /lib/rubyflare.rb: -------------------------------------------------------------------------------- 1 | require 'rubyflare/version' 2 | require 'rubyflare/connect' 3 | require 'rubyflare/response' 4 | 5 | require 'curb' 6 | require 'json' 7 | 8 | module Rubyflare 9 | class ConnectionError < StandardError 10 | attr_reader :response 11 | def initialize(message, response) 12 | super(message) 13 | @response = response 14 | end 15 | end 16 | 17 | def self.connect_with(email, api_key) 18 | Rubyflare::Connect.new(email: email, api_key: api_key) 19 | end 20 | 21 | def self.connect_with_token(api_token) 22 | Rubyflare::Connect.new(api_token: api_token) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /spec/rubyflare/response_spec.rb: -------------------------------------------------------------------------------- 1 | describe Rubyflare::Response do 2 | 3 | let(:method_name) { :get } 4 | let(:endpoint) { 'user' } 5 | let(:response) { { success: true }.to_json } 6 | subject { described_class.new(method_name, endpoint, response) } 7 | 8 | describe '#initialize' do 9 | 10 | context 'with a successful response' do 11 | it "returns an instance of #{described_class}" do 12 | expect(subject).to be_a described_class 13 | end 14 | end 15 | 16 | context 'with an unsuccessful response' do 17 | let(:response) { { success: false }.to_json } 18 | 19 | it 'raises a Rubyflare::ConnectionError' do 20 | expect { subject }.to raise_error(Rubyflare::ConnectionError) 21 | end 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /lib/rubyflare/response.rb: -------------------------------------------------------------------------------- 1 | module Rubyflare 2 | class Response 3 | attr_reader :body 4 | 5 | def initialize(method_name, endpoint, response) 6 | @body = JSON.parse(response, symbolize_names: true) 7 | 8 | unless successful? 9 | message = "Unable to #{method_name.to_s.upcase} to endpoint: " \ 10 | "#{endpoint}. Inspect Rubyflare::ConnectionError#response "\ 11 | "for further details" 12 | raise Rubyflare::ConnectionError.new(message, self) 13 | end 14 | end 15 | 16 | def result 17 | body[:result].first 18 | end 19 | 20 | def results 21 | body[:result] 22 | end 23 | 24 | def successful? 25 | body[:success] 26 | end 27 | 28 | def errors 29 | body[:errors] 30 | end 31 | 32 | def messages 33 | body[:messages] 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /spec/rubyflare_integration_spec.rb: -------------------------------------------------------------------------------- 1 | describe 'integration' do 2 | describe Rubyflare, order: :defined do 3 | context 'given I have valid Cloudflare credentials' do 4 | let(:email) { ENV['CLOUDFLARE_EMAIL'] } 5 | let(:api_key) { ENV['CLOUDFLARE_API_KEY'] } 6 | 7 | context 'when I create a Rubyflare instance' do 8 | let(:connection) { described_class.connect_with(email, api_key) } 9 | 10 | context 'and GET my Cloudflare user details' do 11 | 12 | it 'should return a valid response' do 13 | response = connection.get('user') 14 | expect(response).to be_successful 15 | end 16 | end 17 | 18 | context 'and update(PATCH) my user details' do 19 | 20 | it 'should return a valid response' do 21 | response = connection.patch('user', { first_name: 'Trevor' }) 22 | expect(response).to be_successful 23 | end 24 | end 25 | end 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Trevor Wistaff 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /lib/rubyflare/connect.rb: -------------------------------------------------------------------------------- 1 | module Rubyflare 2 | class Connect 3 | 4 | attr_reader :response 5 | 6 | API_URL = "https://api.cloudflare.com/client/v4/" 7 | 8 | def initialize(**options) 9 | @api_token = options[:api_token] 10 | @email = options[:email] 11 | @api_key = options[:api_key] 12 | 13 | end 14 | 15 | %i(get post put patch delete).each do |method_name| 16 | define_method(method_name) do |endpoint, options = {}| 17 | options = options.to_json unless method_name == :get 18 | response = Curl.send(method_name, API_URL + endpoint, options) do |http| 19 | # Send the Bearer request if using an API Token 20 | unless @api_token.nil? 21 | http.headers['Authorization'] = "Bearer " + @api_token 22 | else 23 | http.headers['X-Auth-Email'] = @email 24 | http.headers['X-Auth-Key'] = @api_key 25 | end 26 | http.headers['Content-Type'] = 'application/json' 27 | http.headers['User-Agent'] = "Rubyflare/#{Rubyflare::VERSION}" 28 | end 29 | @response = Rubyflare::Response.new(method_name, endpoint, response.body_str) 30 | end 31 | end 32 | end 33 | end 34 | 35 | -------------------------------------------------------------------------------- /rubyflare.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'rubyflare/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "rubyflare" 8 | spec.version = Rubyflare::VERSION 9 | spec.authors = ["Trevor Wistaff"] 10 | spec.email = ["trev@a07.com.au"] 11 | 12 | spec.summary = %q{Thin Ruby wrapper around Cloudflare's V4 API.} 13 | spec.description = %q{Thin Ruby wrapper around Cloudflare's V4 API for good measure!} 14 | spec.homepage = "https://github.com/trev/rubyflare" 15 | spec.license = "MIT" 16 | 17 | spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 18 | spec.bindir = "exe" 19 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 20 | spec.require_paths = ["lib"] 21 | 22 | spec.required_ruby_version = '>= 2.0' 23 | 24 | spec.add_development_dependency "bundler", "~> 2" 25 | spec.add_development_dependency "rake", "~> 11.3" 26 | spec.add_development_dependency "rspec", "~> 3.5" 27 | spec.add_development_dependency "webmock", "~> 2.1" 28 | spec.add_development_dependency "codeclimate-test-reporter", "~> 0.6.0" 29 | 30 | spec.add_runtime_dependency "curb", "~> 0.9.3" 31 | end 32 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 4 | 5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. 6 | 7 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 8 | 9 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. 10 | 11 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. 12 | 13 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/) 14 | -------------------------------------------------------------------------------- /spec/rubyflare/connect_spec.rb: -------------------------------------------------------------------------------- 1 | describe Rubyflare::Connect do 2 | 3 | let(:email) { ENV['CLOUDFLARE_EMAIL'] } 4 | let(:api_key) { ENV['CLOUDFLARE_API_KEY'] } 5 | 6 | subject(:connection) { described_class.new(email, api_key) } 7 | 8 | describe '#initialize' do 9 | 10 | it 'stores the supplied email and api_key as instance variables' do 11 | expect(connection.instance_variable_get(:@email)).to eq email 12 | expect(connection.instance_variable_get(:@api_key)).to eq api_key 13 | end 14 | 15 | it "returns an instance of #{described_class}" do 16 | expect(connection).to be_a described_class 17 | end 18 | end 19 | 20 | describe '#get' do 21 | 22 | context 'with valid credentials' do 23 | 24 | context 'and a valid endpoint' do 25 | it 'returns an intance of Rubyflare::Response' do 26 | expect(connection.get('user')).to be_a Rubyflare::Response 27 | end 28 | end 29 | 30 | context 'and an invalid endpoint' do 31 | it 'raises a Rubyflare::ConnectionError' do 32 | expect { connection.get('invalid') }.to raise_error(Rubyflare::ConnectionError) 33 | end 34 | end 35 | end 36 | 37 | context 'with invalid credentials' do 38 | let(:email) { 'bear@dog.com' } 39 | let(:api_key) { 'superapikey' } 40 | 41 | it 'raises a Rubyflare::ConnectionError' do 42 | expect { connection.get('user') }.to raise_error(Rubyflare::ConnectionError) 43 | end 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Gem Version](https://badge.fury.io/rb/rubyflare.svg)](https://badge.fury.io/rb/rubyflare) [![Code Climate](https://codeclimate.com/github/trev/rubyflare/badges/gpa.svg)](https://codeclimate.com/github/trev/rubyflare) [![Test Coverage](https://codeclimate.com/github/trev/rubyflare/badges/coverage.svg)](https://codeclimate.com/github/trev/rubyflare/coverage) [![Build Status](https://travis-ci.org/trev/rubyflare.svg?branch=master)](https://travis-ci.org/trev/rubyflare) 2 | # Rubyflare 3 | 4 | Super thin Ruby wrapper for Cloudflare's V4 API. 5 | 6 | ## Installation 7 | 8 | Add this line to your application's Gemfile: 9 | 10 | ```ruby 11 | gem 'rubyflare' 12 | ``` 13 | 14 | And then execute: 15 | 16 | $ bundle 17 | 18 | Or install it yourself as: 19 | 20 | $ gem install rubyflare 21 | 22 | ## Usage 23 | 24 | First off, open https://api.cloudflare.com/ to see all the available endpoints 25 | 26 | ### Quick start 27 | 28 | #### Setup connection 29 | 30 | ``` 31 | require 'rubyflare' 32 | 33 | connection = Rubyflare.connect_with('bear@dog.com', 'supersecretapikey') 34 | 35 | # OR connect with API Token 36 | connection = Rubyflare.connect_with_token('API_TOKEN') 37 | ``` 38 | 39 | #### GET your user account details 40 | 41 | ``` 42 | user = connection.get('user') 43 | 44 | # Read the first result 45 | p user.result 46 | 47 | # Read your first name 48 | p user.result[:first_name] 49 | ``` 50 | 51 | #### Update(PATCH) your user account 52 | 53 | ``` 54 | user = connection.patch('user', { first_name: 'Bear' }) 55 | 56 | # Read the first result 57 | p user.result 58 | ``` 59 | 60 | #### GET all your zones 61 | 62 | ``` 63 | zones = connection.get('zones') 64 | 65 | # Read the first zone 66 | p zones.result 67 | 68 | # Read the array of zones. Pluralize #result 69 | p zones.results 70 | ``` 71 | 72 | #### Create(POST) a new zone (domain) 73 | 74 | ``` 75 | zone = connection.post('zones', { name: 'supercooldomain.com' }) 76 | 77 | # Check it out 78 | p zone.result 79 | ``` 80 | 81 | #### Add(POST) an A Record to the zone 82 | 83 | ``` 84 | dns_record = connection.post('zones/{#zone.result[:id]}/dns_records', { 85 |                               type: 'A', 86 | name: 'supercooldomain.com', 87 | content: '127.0.0.1' 88 | }) 89 | 90 | # Check it out 91 | p dns_record.result 92 | ``` 93 | 94 | #### DELETE a zone 95 | 96 | ``` 97 | deleted_zone = connection.delete('zones/#{zone.result[:id]}') 98 | 99 | # Check out the response 100 | p deleted_zone 101 | ``` 102 | 103 | #### Catch errors 104 | 105 | ``` 106 | begin 107 | connection.get('user') 108 | rescue => e 109 | # Inspect e.reponse for more details 110 | p e.response 111 | end 112 | ``` 113 | 114 | ## Development 115 | 116 | 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. 117 | 118 | To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, 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](https://rubygems.org). 119 | 120 | ## Contributing 121 | 122 | Bug reports and pull requests are welcome on GitHub at https://github.com/trev/rubyflare. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct. 123 | 124 | 125 | ## License 126 | 127 | The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). 128 | 129 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | # Disable all checks not explicitly referenced in this file 2 | # This is used to easily disable Style/* checks 3 | AllCops: 4 | DisabledByDefault: true 5 | 6 | ################## STYLE ################################# 7 | 8 | Style/AccessModifierIndentation: 9 | Description: Check indentation of private/protected visibility modifiers. 10 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected' 11 | Enabled: false 12 | 13 | Style/AccessorMethodName: 14 | Description: Check the naming of accessor methods for get_/set_. 15 | Enabled: false 16 | 17 | Style/Alias: 18 | Description: 'Use alias_method instead of alias.' 19 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method' 20 | Enabled: false 21 | 22 | Style/AlignArray: 23 | Description: >- 24 | Align the elements of an array literal if they span more than 25 | one line. 26 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays' 27 | Enabled: false 28 | 29 | Style/AlignHash: 30 | Description: >- 31 | Align the elements of a hash literal if they span more than 32 | one line. 33 | Enabled: false 34 | 35 | Style/AlignParameters: 36 | Description: >- 37 | Align the parameters of a method call if they span more 38 | than one line. 39 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent' 40 | Enabled: false 41 | 42 | Style/AndOr: 43 | Description: 'Use &&/|| instead of and/or.' 44 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-and-or-or' 45 | Enabled: false 46 | 47 | Style/ArrayJoin: 48 | Description: 'Use Array#join instead of Array#*.' 49 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join' 50 | Enabled: false 51 | 52 | Style/AsciiComments: 53 | Description: 'Use only ascii symbols in comments.' 54 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments' 55 | Enabled: false 56 | 57 | Style/AsciiIdentifiers: 58 | Description: 'Use only ascii symbols in identifiers.' 59 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers' 60 | Enabled: false 61 | 62 | Style/Attr: 63 | Description: 'Checks for uses of Module#attr.' 64 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr' 65 | Enabled: false 66 | 67 | Style/BeginBlock: 68 | Description: 'Avoid the use of BEGIN blocks.' 69 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks' 70 | Enabled: false 71 | 72 | Style/BarePercentLiterals: 73 | Description: 'Checks if usage of %() or %Q() matches configuration.' 74 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q-shorthand' 75 | Enabled: false 76 | 77 | Style/BlockComments: 78 | Description: 'Do not use block comments.' 79 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments' 80 | Enabled: false 81 | 82 | Style/BlockEndNewline: 83 | Description: 'Put end statement of multiline block on its own line.' 84 | Enabled: false 85 | 86 | Style/BlockDelimiters: 87 | Description: >- 88 | Avoid using {...} for multi-line blocks (multiline chaining is 89 | always ugly). 90 | Prefer {...} over do...end for single-line blocks. 91 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks' 92 | Enabled: false 93 | 94 | Style/BracesAroundHashParameters: 95 | Description: 'Enforce braces style around hash parameters.' 96 | Enabled: false 97 | 98 | Style/CaseEquality: 99 | Description: 'Avoid explicit use of the case equality operator(===).' 100 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality' 101 | Enabled: false 102 | 103 | Style/CaseIndentation: 104 | Description: 'Indentation of when in a case/when/[else/]end.' 105 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-when-to-case' 106 | Enabled: false 107 | 108 | Style/CharacterLiteral: 109 | Description: 'Checks for uses of character literals.' 110 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals' 111 | Enabled: false 112 | 113 | Style/ClassAndModuleCamelCase: 114 | Description: 'Use CamelCase for classes and modules.' 115 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#camelcase-classes' 116 | Enabled: false 117 | 118 | Style/ClassAndModuleChildren: 119 | Description: 'Checks style of children classes and modules.' 120 | Enabled: false 121 | 122 | Style/ClassCheck: 123 | Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.' 124 | Enabled: false 125 | 126 | Style/ClassMethods: 127 | Description: 'Use self when defining module/class methods.' 128 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#def-self-class-methods' 129 | Enabled: false 130 | 131 | Style/ClassVars: 132 | Description: 'Avoid the use of class variables.' 133 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars' 134 | Enabled: false 135 | 136 | Style/ClosingParenthesisIndentation: 137 | Description: 'Checks the indentation of hanging closing parentheses.' 138 | Enabled: false 139 | 140 | Style/ColonMethodCall: 141 | Description: 'Do not use :: for method call.' 142 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons' 143 | Enabled: false 144 | 145 | Style/CommandLiteral: 146 | Description: 'Use `` or %x around command literals.' 147 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-x' 148 | Enabled: false 149 | 150 | Style/CommentAnnotation: 151 | Description: >- 152 | Checks formatting of special comments 153 | (TODO, FIXME, OPTIMIZE, HACK, REVIEW). 154 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords' 155 | Enabled: false 156 | 157 | Style/CommentIndentation: 158 | Description: 'Indentation of comments.' 159 | Enabled: false 160 | 161 | Style/ConstantName: 162 | Description: 'Constants should use SCREAMING_SNAKE_CASE.' 163 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#screaming-snake-case' 164 | Enabled: false 165 | 166 | Style/DefWithParentheses: 167 | Description: 'Use def with parentheses when there are arguments.' 168 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens' 169 | Enabled: false 170 | 171 | Style/DeprecatedHashMethods: 172 | Description: 'Checks for use of deprecated Hash methods.' 173 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key' 174 | Enabled: false 175 | 176 | Style/Documentation: 177 | Description: 'Document classes and non-namespace modules.' 178 | Enabled: false 179 | 180 | Style/DotPosition: 181 | Description: 'Checks the position of the dot in multi-line method calls.' 182 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains' 183 | Enabled: false 184 | 185 | Style/DoubleNegation: 186 | Description: 'Checks for uses of double negation (!!).' 187 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang' 188 | Enabled: false 189 | 190 | Style/EachWithObject: 191 | Description: 'Prefer `each_with_object` over `inject` or `reduce`.' 192 | Enabled: false 193 | 194 | Style/ElseAlignment: 195 | Description: 'Align elses and elsifs correctly.' 196 | Enabled: false 197 | 198 | Style/EmptyElse: 199 | Description: 'Avoid empty else-clauses.' 200 | Enabled: false 201 | 202 | Style/EmptyLineBetweenDefs: 203 | Description: 'Use empty lines between defs.' 204 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods' 205 | Enabled: false 206 | 207 | Style/EmptyLines: 208 | Description: "Don't use several empty lines in a row." 209 | Enabled: false 210 | 211 | Style/EmptyLinesAroundAccessModifier: 212 | Description: "Keep blank lines around access modifiers." 213 | Enabled: false 214 | 215 | Style/EmptyLinesAroundBlockBody: 216 | Description: "Keeps track of empty lines around block bodies." 217 | Enabled: false 218 | 219 | Style/EmptyLinesAroundClassBody: 220 | Description: "Keeps track of empty lines around class bodies." 221 | Enabled: false 222 | 223 | Style/EmptyLinesAroundModuleBody: 224 | Description: "Keeps track of empty lines around module bodies." 225 | Enabled: false 226 | 227 | Style/EmptyLinesAroundMethodBody: 228 | Description: "Keeps track of empty lines around method bodies." 229 | Enabled: false 230 | 231 | Style/EmptyLiteral: 232 | Description: 'Prefer literals to Array.new/Hash.new/String.new.' 233 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash' 234 | Enabled: false 235 | 236 | Style/EndBlock: 237 | Description: 'Avoid the use of END blocks.' 238 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-END-blocks' 239 | Enabled: false 240 | 241 | Style/EndOfLine: 242 | Description: 'Use Unix-style line endings.' 243 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf' 244 | Enabled: false 245 | 246 | Style/EvenOdd: 247 | Description: 'Favor the use of Fixnum#even? && Fixnum#odd?' 248 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods' 249 | Enabled: false 250 | 251 | Style/ExtraSpacing: 252 | Description: 'Do not use unnecessary spacing.' 253 | Enabled: false 254 | 255 | Style/FileName: 256 | Description: 'Use snake_case for source file names.' 257 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files' 258 | Enabled: false 259 | 260 | Style/InitialIndentation: 261 | Description: >- 262 | Checks the indentation of the first non-blank non-comment line in a file. 263 | Enabled: false 264 | 265 | Style/FirstParameterIndentation: 266 | Description: 'Checks the indentation of the first parameter in a method call.' 267 | Enabled: false 268 | 269 | Style/FlipFlop: 270 | Description: 'Checks for flip flops' 271 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops' 272 | Enabled: false 273 | 274 | Style/For: 275 | Description: 'Checks use of for or each in multiline loops.' 276 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-for-loops' 277 | Enabled: false 278 | 279 | Style/FormatString: 280 | Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.' 281 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf' 282 | Enabled: false 283 | 284 | Style/GlobalVars: 285 | Description: 'Do not introduce global variables.' 286 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars' 287 | Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html' 288 | Enabled: false 289 | 290 | Style/GuardClause: 291 | Description: 'Check for conditionals that can be replaced with guard clauses' 292 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals' 293 | Enabled: false 294 | 295 | Style/HashSyntax: 296 | Description: >- 297 | Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax 298 | { :a => 1, :b => 2 }. 299 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals' 300 | Enabled: false 301 | 302 | Style/IfUnlessModifier: 303 | Description: >- 304 | Favor modifier if/unless usage when you have a 305 | single-line body. 306 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier' 307 | Enabled: false 308 | 309 | Style/IfWithSemicolon: 310 | Description: 'Do not use if x; .... Use the ternary operator instead.' 311 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs' 312 | Enabled: false 313 | 314 | Style/IndentationConsistency: 315 | Description: 'Keep indentation straight.' 316 | Enabled: false 317 | 318 | Style/IndentationWidth: 319 | Description: 'Use 2 spaces for indentation.' 320 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation' 321 | Enabled: false 322 | 323 | Style/IndentArray: 324 | Description: >- 325 | Checks the indentation of the first element in an array 326 | literal. 327 | Enabled: false 328 | 329 | Style/IndentHash: 330 | Description: 'Checks the indentation of the first key in a hash literal.' 331 | Enabled: false 332 | 333 | Style/InfiniteLoop: 334 | Description: 'Use Kernel#loop for infinite loops.' 335 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#infinite-loop' 336 | Enabled: false 337 | 338 | Style/Lambda: 339 | Description: 'Use the new lambda literal syntax for single-line blocks.' 340 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line' 341 | Enabled: false 342 | 343 | Style/LambdaCall: 344 | Description: 'Use lambda.call(...) instead of lambda.(...).' 345 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call' 346 | Enabled: false 347 | 348 | Style/LeadingCommentSpace: 349 | Description: 'Comments should start with a space.' 350 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space' 351 | Enabled: false 352 | 353 | Style/LineEndConcatenation: 354 | Description: >- 355 | Use \ instead of + or << to concatenate two string literals at 356 | line end. 357 | Enabled: false 358 | 359 | Style/MethodCallParentheses: 360 | Description: 'Do not use parentheses for method calls with no arguments.' 361 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens' 362 | Enabled: false 363 | 364 | Style/MethodDefParentheses: 365 | Description: >- 366 | Checks if the method definitions have or don't have 367 | parentheses. 368 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens' 369 | Enabled: false 370 | 371 | Style/MethodName: 372 | Description: 'Use the configured style when naming methods.' 373 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars' 374 | Enabled: false 375 | 376 | Style/ModuleFunction: 377 | Description: 'Checks for usage of `extend self` in modules.' 378 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function' 379 | Enabled: false 380 | 381 | Style/MultilineBlockChain: 382 | Description: 'Avoid multi-line chains of blocks.' 383 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks' 384 | Enabled: false 385 | 386 | Style/MultilineBlockLayout: 387 | Description: 'Ensures newlines after multiline block do statements.' 388 | Enabled: false 389 | 390 | Style/MultilineIfThen: 391 | Description: 'Do not use then for multi-line if/unless.' 392 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-then' 393 | Enabled: false 394 | 395 | Style/MultilineOperationIndentation: 396 | Description: >- 397 | Checks indentation of binary operations that span more than 398 | one line. 399 | Enabled: false 400 | 401 | Style/MultilineTernaryOperator: 402 | Description: >- 403 | Avoid multi-line ?: (the ternary operator); 404 | use if/unless instead. 405 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary' 406 | Enabled: false 407 | 408 | Style/NegatedIf: 409 | Description: >- 410 | Favor unless over if for negative conditions 411 | (or control flow or). 412 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives' 413 | Enabled: false 414 | 415 | Style/NegatedWhile: 416 | Description: 'Favor until over while for negative conditions.' 417 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives' 418 | Enabled: false 419 | 420 | Style/NestedTernaryOperator: 421 | Description: 'Use one expression per branch in a ternary operator.' 422 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary' 423 | Enabled: false 424 | 425 | Style/Next: 426 | Description: 'Use `next` to skip iteration instead of a condition at the end.' 427 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals' 428 | Enabled: false 429 | 430 | Style/NilComparison: 431 | Description: 'Prefer x.nil? to x == nil.' 432 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods' 433 | Enabled: false 434 | 435 | Style/NonNilCheck: 436 | Description: 'Checks for redundant nil checks.' 437 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks' 438 | Enabled: false 439 | 440 | Style/Not: 441 | Description: 'Use ! instead of not.' 442 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not' 443 | Enabled: false 444 | 445 | Style/NumericLiterals: 446 | Description: >- 447 | Add underscores to large numeric literals to improve their 448 | readability. 449 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics' 450 | Enabled: false 451 | 452 | Style/OneLineConditional: 453 | Description: >- 454 | Favor the ternary operator(?:) over 455 | if/then/else/end constructs. 456 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator' 457 | Enabled: false 458 | 459 | Style/OpMethod: 460 | Description: 'When defining binary operators, name the argument other.' 461 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg' 462 | Enabled: false 463 | 464 | Style/OptionalArguments: 465 | Description: >- 466 | Checks for optional arguments that do not appear at the end 467 | of the argument list 468 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#optional-arguments' 469 | Enabled: false 470 | 471 | Style/ParallelAssignment: 472 | Description: >- 473 | Check for simple usages of parallel assignment. 474 | It will only warn when the number of variables 475 | matches on both sides of the assignment. 476 | This also provides performance benefits 477 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parallel-assignment' 478 | Reference: 'https://github.com/JuanitoFatas/fast-ruby#parallel-assignment-vs-sequential-assignment-code' 479 | Enabled: false 480 | 481 | Style/ParenthesesAroundCondition: 482 | Description: >- 483 | Don't use parentheses around the condition of an 484 | if/unless/while. 485 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-parens-if' 486 | Enabled: false 487 | 488 | Style/PercentLiteralDelimiters: 489 | Description: 'Use `%`-literal delimiters consistently' 490 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces' 491 | Enabled: false 492 | 493 | Style/PercentQLiterals: 494 | Description: 'Checks if uses of %Q/%q match the configured preference.' 495 | Enabled: false 496 | 497 | Style/PerlBackrefs: 498 | Description: 'Avoid Perl-style regex back references.' 499 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers' 500 | Enabled: false 501 | 502 | Style/PredicateName: 503 | Description: 'Check the names of predicate methods.' 504 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark' 505 | Enabled: false 506 | 507 | Style/Proc: 508 | Description: 'Use proc instead of Proc.new.' 509 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc' 510 | Enabled: false 511 | 512 | Style/RaiseArgs: 513 | Description: 'Checks the arguments passed to raise/fail.' 514 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages' 515 | Enabled: false 516 | 517 | Style/RedundantBegin: 518 | Description: "Don't use begin blocks when they are not needed." 519 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#begin-implicit' 520 | Enabled: false 521 | 522 | Style/RedundantException: 523 | Description: "Checks for an obsolete RuntimeException argument in raise/fail." 524 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror' 525 | Enabled: false 526 | 527 | Style/RedundantReturn: 528 | Description: "Don't use return where it's not required." 529 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-return' 530 | Enabled: false 531 | 532 | Style/RedundantSelf: 533 | Description: "Don't use self where it's not needed." 534 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-self-unless-required' 535 | Enabled: false 536 | 537 | Style/RegexpLiteral: 538 | Description: 'Use / or %r around regular expressions.' 539 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r' 540 | Enabled: false 541 | 542 | Style/RescueEnsureAlignment: 543 | Description: 'Align rescues and ensures correctly.' 544 | Enabled: false 545 | 546 | Style/RescueModifier: 547 | Description: 'Avoid using rescue in its modifier form.' 548 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers' 549 | Enabled: false 550 | 551 | Style/SelfAssignment: 552 | Description: >- 553 | Checks for places where self-assignment shorthand should have 554 | been used. 555 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment' 556 | Enabled: false 557 | 558 | Style/Semicolon: 559 | Description: "Don't use semicolons to terminate expressions." 560 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon' 561 | Enabled: false 562 | 563 | Style/SignalException: 564 | Description: 'Checks for proper usage of fail and raise.' 565 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method' 566 | Enabled: false 567 | 568 | Style/SingleLineBlockParams: 569 | Description: 'Enforces the names of some block params.' 570 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks' 571 | Enabled: false 572 | 573 | Style/SingleLineMethods: 574 | Description: 'Avoid single-line methods.' 575 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods' 576 | Enabled: false 577 | 578 | Style/SingleSpaceBeforeFirstArg: 579 | Description: >- 580 | Checks that exactly one space is used between a method name 581 | and the first argument for method calls without parentheses. 582 | Enabled: false 583 | 584 | Style/SpaceAfterColon: 585 | Description: 'Use spaces after colons.' 586 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators' 587 | Enabled: false 588 | 589 | Style/SpaceAfterComma: 590 | Description: 'Use spaces after commas.' 591 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators' 592 | Enabled: false 593 | 594 | Style/SpaceAfterControlKeyword: 595 | Description: 'Use spaces after if/elsif/unless/while/until/case/when.' 596 | Enabled: false 597 | 598 | Style/SpaceAfterMethodName: 599 | Description: >- 600 | Do not put a space between a method name and the opening 601 | parenthesis in a method definition. 602 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces' 603 | Enabled: false 604 | 605 | Style/SpaceAfterNot: 606 | Description: Tracks redundant space after the ! operator. 607 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-bang' 608 | Enabled: false 609 | 610 | Style/SpaceAfterSemicolon: 611 | Description: 'Use spaces after semicolons.' 612 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators' 613 | Enabled: false 614 | 615 | Style/SpaceBeforeBlockBraces: 616 | Description: >- 617 | Checks that the left block brace has or doesn't have space 618 | before it. 619 | Enabled: false 620 | 621 | Style/SpaceBeforeComma: 622 | Description: 'No spaces before commas.' 623 | Enabled: false 624 | 625 | Style/SpaceBeforeComment: 626 | Description: >- 627 | Checks for missing space between code and a comment on the 628 | same line. 629 | Enabled: false 630 | 631 | Style/SpaceBeforeSemicolon: 632 | Description: 'No spaces before semicolons.' 633 | Enabled: false 634 | 635 | Style/SpaceInsideBlockBraces: 636 | Description: >- 637 | Checks that block braces have or don't have surrounding space. 638 | For blocks taking parameters, checks that the left brace has 639 | or doesn't have trailing space. 640 | Enabled: false 641 | 642 | Style/SpaceAroundBlockParameters: 643 | Description: 'Checks the spacing inside and after block parameters pipes.' 644 | Enabled: false 645 | 646 | Style/SpaceAroundEqualsInParameterDefault: 647 | Description: >- 648 | Checks that the equals signs in parameter default assignments 649 | have or don't have surrounding space depending on 650 | configuration. 651 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-around-equals' 652 | Enabled: false 653 | 654 | Style/SpaceAroundOperators: 655 | Description: 'Use a single space around operators.' 656 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators' 657 | Enabled: false 658 | 659 | Style/SpaceBeforeModifierKeyword: 660 | Description: 'Put a space before the modifier keyword.' 661 | Enabled: false 662 | 663 | Style/SpaceInsideBrackets: 664 | Description: 'No spaces after [ or before ].' 665 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces' 666 | Enabled: false 667 | 668 | Style/SpaceInsideHashLiteralBraces: 669 | Description: "Use spaces inside hash literal braces - or don't." 670 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators' 671 | Enabled: false 672 | 673 | Style/SpaceInsideParens: 674 | Description: 'No spaces after ( or before ).' 675 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces' 676 | Enabled: false 677 | 678 | Style/SpaceInsideRangeLiteral: 679 | Description: 'No spaces inside range literals.' 680 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals' 681 | Enabled: false 682 | 683 | Style/SpaceInsideStringInterpolation: 684 | Description: 'Checks for padding/surrounding spaces inside string interpolation.' 685 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#string-interpolation' 686 | Enabled: false 687 | 688 | Style/SpecialGlobalVars: 689 | Description: 'Avoid Perl-style global variables.' 690 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms' 691 | Enabled: false 692 | 693 | Style/StringLiterals: 694 | Description: 'Checks if uses of quotes match the configured preference.' 695 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals' 696 | Enabled: false 697 | 698 | Style/StringLiteralsInInterpolation: 699 | Description: >- 700 | Checks if uses of quotes inside expressions in interpolated 701 | strings match the configured preference. 702 | Enabled: false 703 | 704 | Style/StructInheritance: 705 | Description: 'Checks for inheritance from Struct.new.' 706 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new' 707 | Enabled: false 708 | 709 | Style/SymbolLiteral: 710 | Description: 'Use plain symbols instead of string symbols when possible.' 711 | Enabled: false 712 | 713 | Style/SymbolProc: 714 | Description: 'Use symbols as procs instead of blocks when possible.' 715 | Enabled: false 716 | 717 | Style/Tab: 718 | Description: 'No hard tabs.' 719 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation' 720 | Enabled: false 721 | 722 | Style/TrailingBlankLines: 723 | Description: 'Checks trailing blank lines and final newline.' 724 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof' 725 | Enabled: false 726 | 727 | Style/TrailingComma: 728 | Description: 'Checks for trailing comma in parameter lists and literals.' 729 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas' 730 | Enabled: false 731 | 732 | Style/TrailingWhitespace: 733 | Description: 'Avoid trailing whitespace.' 734 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace' 735 | Enabled: false 736 | 737 | Style/TrivialAccessors: 738 | Description: 'Prefer attr_* methods to trivial readers/writers.' 739 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family' 740 | Enabled: false 741 | 742 | Style/UnlessElse: 743 | Description: >- 744 | Do not use unless with else. Rewrite these with the positive 745 | case first. 746 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-else-with-unless' 747 | Enabled: false 748 | 749 | Style/UnneededCapitalW: 750 | Description: 'Checks for %W when interpolation is not needed.' 751 | Enabled: false 752 | 753 | Style/UnneededPercentQ: 754 | Description: 'Checks for %q/%Q when single quotes or double quotes would do.' 755 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q' 756 | Enabled: false 757 | 758 | Style/TrailingUnderscoreVariable: 759 | Description: >- 760 | Checks for the usage of unneeded trailing underscores at the 761 | end of parallel variable assignment. 762 | Enabled: false 763 | 764 | Style/VariableInterpolation: 765 | Description: >- 766 | Don't interpolate global, instance and class variables 767 | directly in strings. 768 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate' 769 | Enabled: false 770 | 771 | Style/VariableName: 772 | Description: 'Use the configured style when naming variables.' 773 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars' 774 | Enabled: false 775 | 776 | Style/WhenThen: 777 | Description: 'Use when x then ... for one-line cases.' 778 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases' 779 | Enabled: false 780 | 781 | Style/WhileUntilDo: 782 | Description: 'Checks for redundant do after while or until.' 783 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do' 784 | Enabled: false 785 | 786 | Style/WhileUntilModifier: 787 | Description: >- 788 | Favor modifier while/until usage when you have a 789 | single-line body. 790 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier' 791 | Enabled: false 792 | 793 | Style/WordArray: 794 | Description: 'Use %w or %W for arrays of words.' 795 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w' 796 | Enabled: false 797 | 798 | ########################################################## 799 | Metrics/AbcSize: 800 | Description: >- 801 | A calculated magnitude based on number of assignments, 802 | branches, and conditions. 803 | Reference: 'http://c2.com/cgi/wiki?AbcMetric' 804 | Enabled: true 805 | Max: 20 806 | 807 | Metrics/BlockNesting: 808 | Description: 'Avoid excessive block nesting' 809 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count' 810 | Enabled: true 811 | Max: 4 812 | 813 | Metrics/ClassLength: 814 | Description: 'Avoid classes longer than 100 lines of code.' 815 | Enabled: true 816 | Max: 150 817 | 818 | Metrics/ModuleLength: 819 | Description: 'Avoid modules longer than 100 lines of code.' 820 | Enabled: true 821 | Max: 150 822 | 823 | Metrics/CyclomaticComplexity: 824 | Description: >- 825 | A complexity metric that is strongly correlated to the number 826 | of test cases needed to validate a method. 827 | Enabled: false 828 | 829 | Metrics/LineLength: 830 | Description: 'Limit lines to 80 characters.' 831 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits' 832 | Enabled: false 833 | 834 | Metrics/MethodLength: 835 | Description: 'Avoid methods longer than 10 lines of code.' 836 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods' 837 | Enabled: false 838 | 839 | Metrics/ParameterLists: 840 | Description: 'Avoid parameter lists longer than three or four parameters.' 841 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params' 842 | Enabled: true 843 | 844 | Metrics/PerceivedComplexity: 845 | Description: >- 846 | A complexity metric geared towards measuring complexity for a 847 | human reader. 848 | Enabled: false 849 | 850 | #################### Lint ################################ 851 | ### Warnings 852 | 853 | Lint/AmbiguousOperator: 854 | Description: >- 855 | Checks for ambiguous operators in the first argument of a 856 | method invocation without parentheses. 857 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args' 858 | Enabled: true 859 | 860 | Lint/AmbiguousRegexpLiteral: 861 | Description: >- 862 | Checks for ambiguous regexp literals in the first argument of 863 | a method invocation without parenthesis. 864 | Enabled: true 865 | 866 | Lint/AssignmentInCondition: 867 | Description: "Don't use assignment in conditions." 868 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition' 869 | Enabled: true 870 | 871 | Lint/BlockAlignment: 872 | Description: 'Align block ends correctly.' 873 | Enabled: true 874 | 875 | Lint/CircularArgumentReference: 876 | Description: "Don't refer to the keyword argument in the default value." 877 | Enabled: true 878 | 879 | Lint/ConditionPosition: 880 | Description: >- 881 | Checks for condition placed in a confusing position relative to 882 | the keyword. 883 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition' 884 | Enabled: true 885 | 886 | Lint/Debugger: 887 | Description: 'Check for debugger calls.' 888 | Enabled: true 889 | 890 | Lint/DefEndAlignment: 891 | Description: 'Align ends corresponding to defs correctly.' 892 | Enabled: true 893 | 894 | Lint/DeprecatedClassMethods: 895 | Description: 'Check for deprecated class method calls.' 896 | Enabled: true 897 | 898 | Lint/DuplicateMethods: 899 | Description: 'Check for duplicate methods calls.' 900 | Enabled: true 901 | 902 | Lint/EachWithObjectArgument: 903 | Description: 'Check for immutable argument given to each_with_object.' 904 | Enabled: true 905 | 906 | Lint/ElseLayout: 907 | Description: 'Check for odd code arrangement in an else block.' 908 | Enabled: true 909 | 910 | Lint/EmptyEnsure: 911 | Description: 'Checks for empty ensure block.' 912 | Enabled: true 913 | 914 | Lint/EmptyInterpolation: 915 | Description: 'Checks for empty string interpolation.' 916 | Enabled: true 917 | 918 | Lint/EndAlignment: 919 | Description: 'Align ends correctly.' 920 | Enabled: true 921 | 922 | Lint/EndInMethod: 923 | Description: 'END blocks should not be placed inside method definitions.' 924 | Enabled: true 925 | 926 | Lint/EnsureReturn: 927 | Description: 'Do not use return in an ensure block.' 928 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure' 929 | Enabled: true 930 | 931 | Lint/Eval: 932 | Description: 'The use of eval represents a serious security risk.' 933 | Enabled: true 934 | 935 | Lint/FormatParameterMismatch: 936 | Description: 'The number of parameters to format/sprint must match the fields.' 937 | Enabled: true 938 | 939 | Lint/HandleExceptions: 940 | Description: "Don't suppress exception." 941 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions' 942 | Enabled: true 943 | 944 | Lint/InvalidCharacterLiteral: 945 | Description: >- 946 | Checks for invalid character literals with a non-escaped 947 | whitespace character. 948 | Enabled: true 949 | 950 | Lint/LiteralInCondition: 951 | Description: 'Checks of literals used in conditions.' 952 | Enabled: true 953 | 954 | Lint/LiteralInInterpolation: 955 | Description: 'Checks for literals used in interpolation.' 956 | Enabled: true 957 | 958 | Lint/Loop: 959 | Description: >- 960 | Use Kernel#loop with break rather than begin/end/until or 961 | begin/end/while for post-loop tests. 962 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break' 963 | Enabled: true 964 | 965 | Lint/NestedMethodDefinition: 966 | Description: 'Do not use nested method definitions.' 967 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods' 968 | Enabled: true 969 | 970 | Lint/NonLocalExitFromIterator: 971 | Description: 'Do not use return in iterator to cause non-local exit.' 972 | Enabled: true 973 | 974 | Lint/ParenthesesAsGroupedExpression: 975 | Description: >- 976 | Checks for method calls with a space before the opening 977 | parenthesis. 978 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces' 979 | Enabled: true 980 | 981 | Lint/RequireParentheses: 982 | Description: >- 983 | Use parentheses in the method call to avoid confusion 984 | about precedence. 985 | Enabled: true 986 | 987 | Lint/RescueException: 988 | Description: 'Avoid rescuing the Exception class.' 989 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues' 990 | Enabled: true 991 | 992 | Lint/ShadowingOuterLocalVariable: 993 | Description: >- 994 | Do not use the same name as outer local variable 995 | for block arguments or block local variables. 996 | Enabled: true 997 | 998 | Lint/SpaceBeforeFirstArg: 999 | Description: >- 1000 | Put a space between a method name and the first argument 1001 | in a method call without parentheses. 1002 | Enabled: true 1003 | 1004 | Lint/StringConversionInInterpolation: 1005 | Description: 'Checks for Object#to_s usage in string interpolation.' 1006 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s' 1007 | Enabled: true 1008 | 1009 | Lint/UnderscorePrefixedVariableName: 1010 | Description: 'Do not use prefix `_` for a variable that is used.' 1011 | Enabled: true 1012 | 1013 | Lint/UnneededDisable: 1014 | Description: >- 1015 | Checks for rubocop:disable comments that can be removed. 1016 | Note: this cop is not disabled when disabling all cops. 1017 | It must be explicitly disabled. 1018 | Enabled: true 1019 | 1020 | Lint/UnusedBlockArgument: 1021 | Description: 'Checks for unused block arguments.' 1022 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars' 1023 | Enabled: true 1024 | 1025 | Lint/UnusedMethodArgument: 1026 | Description: 'Checks for unused method arguments.' 1027 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars' 1028 | Enabled: true 1029 | 1030 | Lint/UnreachableCode: 1031 | Description: 'Unreachable code.' 1032 | Enabled: true 1033 | 1034 | Lint/UselessAccessModifier: 1035 | Description: 'Checks for useless access modifiers.' 1036 | Enabled: true 1037 | 1038 | Lint/UselessAssignment: 1039 | Description: 'Checks for useless assignment to a local variable.' 1040 | StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars' 1041 | Enabled: true 1042 | 1043 | Lint/UselessComparison: 1044 | Description: 'Checks for comparison of something with itself.' 1045 | Enabled: true 1046 | 1047 | Lint/UselessElseWithoutRescue: 1048 | Description: 'Checks for useless `else` in `begin..end` without `rescue`.' 1049 | Enabled: true 1050 | 1051 | Lint/UselessSetterCall: 1052 | Description: 'Checks for useless setter call to a local variable.' 1053 | Enabled: true 1054 | 1055 | Lint/Void: 1056 | Description: 'Possible use of operator/literal/variable in void context.' 1057 | Enabled: true 1058 | 1059 | ##################### Performance ############################# 1060 | 1061 | Performance/Count: 1062 | Description: >- 1063 | Use `count` instead of `select...size`, `reject...size`, 1064 | `select...count`, `reject...count`, `select...length`, 1065 | and `reject...length`. 1066 | Enabled: true 1067 | 1068 | Performance/Detect: 1069 | Description: >- 1070 | Use `detect` instead of `select.first`, `find_all.first`, 1071 | `select.last`, and `find_all.last`. 1072 | Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code' 1073 | Enabled: true 1074 | 1075 | Performance/FlatMap: 1076 | Description: >- 1077 | Use `Enumerable#flat_map` 1078 | instead of `Enumerable#map...Array#flatten(1)` 1079 | or `Enumberable#collect..Array#flatten(1)` 1080 | Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code' 1081 | Enabled: true 1082 | EnabledForFlattenWithoutParams: false 1083 | # If enabled, this cop will warn about usages of 1084 | # `flatten` being called without any parameters. 1085 | # This can be dangerous since `flat_map` will only flatten 1 level, and 1086 | # `flatten` without any parameters can flatten multiple levels. 1087 | 1088 | Performance/ReverseEach: 1089 | Description: 'Use `reverse_each` instead of `reverse.each`.' 1090 | Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code' 1091 | Enabled: true 1092 | 1093 | Performance/Sample: 1094 | Description: >- 1095 | Use `sample` instead of `shuffle.first`, 1096 | `shuffle.last`, and `shuffle[Fixnum]`. 1097 | Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code' 1098 | Enabled: true 1099 | 1100 | Performance/Size: 1101 | Description: >- 1102 | Use `size` instead of `count` for counting 1103 | the number of elements in `Array` and `Hash`. 1104 | Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code' 1105 | Enabled: true 1106 | 1107 | Performance/StringReplacement: 1108 | Description: >- 1109 | Use `tr` instead of `gsub` when you are replacing the same 1110 | number of characters. Use `delete` instead of `gsub` when 1111 | you are deleting characters. 1112 | Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code' 1113 | Enabled: true 1114 | --------------------------------------------------------------------------------