0.0
No commit activity in last 3 years
No release in over 3 years
A package of Influitive cop(s) for Rubocop.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
>= 0
~> 10.0
~> 3.5

Runtime

>= 0.37.1
 Project Readme

Rubocop::Infl

This gem contains Influitive specific rubocop cops. To use them you can do this in your Gemfile for a project:

group :development to
  gem 'rubocop', require: false
  gem 'rubocop-infl', require: false
end

And add this to your .rubocop.yml for the project:

require: "rubocop-infl"

Infl/SoftLineLength

It is considered good style to limit the length of lines in Ruby source code, and we have found that sometimes there are lines which are a little longer than our conventional limit and breaking up made the code less readable and "greppable". This Cop attempts to help with that situation by allowing a file to have up to a certain percentage of the lines be longer than our "usual" limit.

Metrics/LineLength:
  Enabled: false

Infl/SoftLineLength:
  Enabled: true
  SoftLimit: 80
  HardLimit: 120
  AllowedLongLinePercentage: 2
  IgnoreCopDirectives: true

This would complain about any lines which were longer than 120 characters, and allow up to 2% of lines in a file to be longer than 80 characters before starting to complain about the lines longer that 80 characters.

The IgnoreCopDirectives allows us to ignore # rubocop:enable ... (or disable) lines in the count so that we avoid the situation where adding a # rubocop:disable Infl/SoftLineLength to a file to stop a warning increases the line count so you then start getting an Unnecessary disabling ... message. The name for this option matches the option in recent Metrics/LineLength versions.

Inspiration

Shamelessly based on https://github.com/backus/rubocop-rspec

http://rubocop.readthedocs.io/en/latest/extensions/#custom-cop has more information on custom cops.

License

This is licensed under the MIT License