Skip to content

Commit

Permalink
Add rubocop rake task
Browse files Browse the repository at this point in the history
Problem
-------

More dog-fooding.  We want to promote the use of our carbonfive/c5-conventions
rubocop file.  Let's use it here.

Solution
--------

* Copy the carbonfive/c5-conventions `.rubocop.yml` into place
* Remove `rubocop-performance` because we don't *really* need it and
it'd require adding another gem dev depenency - seems overkill for it's
possible benefit on *this* project
* Add `lib/tasks` to `rakelib`
* Add `rubocop.rake` file to get the `rubocop` and `rubocop:autocorrect`
tasks
* Run rubocop:autocorrect which cleaned a few things in bin/raygun

NOTE
----

This repo is *still* not rubocop clean.  There are several
not-autofixable issues that could (should?) be addressed once this is
approved.
  • Loading branch information
Jon Rogers committed Jan 25, 2020
1 parent c6fe3aa commit 410c332
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 2 deletions.
104 changes: 104 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Configuration hierarchy:
#
# 1. Rubocop defaults
# 2. Carbon Five defaults (this file)
# 3. Project overrides
#
# See http://rubocop.readthedocs.io/en/latest/configuration/#inheriting-configuration-from-a-remote-url for details.
#

AllCops:
DisplayCopNames: true
DisplayStyleGuide: true

#
# Ruby Cops
#

Layout/CaseIndentation:
Enabled: false

Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent

Layout/HashAlignment:
Enabled: false

Layout/LineLength:
Max: 120

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

Lint/AmbiguousBlockAssociation:
Enabled: false

Lint/ScriptPermission:
Exclude:
- "Rakefile"

Metrics/AbcSize:
Max: 35
Exclude:
- "spec/**/*"

Metrics/BlockLength:
CountComments: false
Max: 50
Exclude:
- "config/**/*"
- "spec/**/*"

Metrics/ClassLength:
Max: 250
Exclude:
- "spec/**/*"

Metrics/MethodLength:
Max: 25
Exclude:
- "db/migrate/*"
- "spec/**/*"

Naming/PredicateName:
Enabled: false

Security/YAMLLoad:
Enabled: false

Style/BarePercentLiterals:
EnforcedStyle: percent_q

Style/BlockDelimiters:
EnforcedStyle: braces_for_chaining

Style/Documentation:
Enabled: false

Style/EmptyMethod:
EnforcedStyle: expanded

Style/FrozenStringLiteralComment:
EnforcedStyle: never

Style/Lambda:
EnforcedStyle: literal

Style/ModuleFunction:
EnforcedStyle: extend_self

Style/MutableConstant:
Enabled: false

Style/PreferredHashMethods:
Enabled: false

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes

Style/StructInheritance:
Enabled: true

1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
require "bundler/gem_tasks"
Rake.add_rakelib "lib/tasks"
4 changes: 2 additions & 2 deletions bin/raygun
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby

File.expand_path('../../lib', __FILE__).tap do |lib|
File.expand_path("../lib", __dir__).tap do |lib|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
end

require 'raygun/raygun'
require "raygun/raygun"

raygun = Raygun::Runner.parse(ARGV)

Expand Down
3 changes: 3 additions & 0 deletions lib/tasks/rubocop.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require "rubocop/rake_task"

RuboCop::RakeTask.new
1 change: 1 addition & 0 deletions raygun.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ Gem::Specification.new do |gem|

gem.add_development_dependency "bundler", "~> 2.0"
gem.add_development_dependency "rake", "~> 13.0"
gem.add_development_dependency "rubocop", "~> 0.79"
end

0 comments on commit 410c332

Please sign in to comment.