Skip to content

Commit 0930f60

Browse files
james2mLeFnord
authored andcommitted
Rubocop cleanup (#264)
* Ignore some project files. * Add .rubocop.yml. * Autofix some Rubocop errors. * Autogenerate .rubocop_todo.yml. * Add CHANGELOG entry for Rubocop. * Updated gemspec to rubocop ~> 0.48 and rubocop Target to 2.4. * Frozen string literals.
1 parent 17b0c6c commit 0930f60

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+143
-42
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ dist
3232
Gemfile.lock
3333
tmp
3434
coverage/
35+
.byebug_history
36+
.ruby-version
37+
.ruby-gemset
3538

3639
## Rubinius
3740
.rbx

.rubocop.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
AllCops:
2+
TargetRubyVersion: 2.4
3+
Include:
4+
- Dangerfile
5+
26
Exclude:
37
- vendor/**/*
8+
- bin/**/*
49
- Guardfile
510

611
inherit_from: .rubocop_todo.yml
12+
13+
Style/FileName:
14+
Exclude:
15+
- 'Gemfile'
16+
- 'Rakefile'
17+
- 'grape-entity.gemspec'
18+
- 'lib/grape-entity.rb'
19+
20+
Style/Documentation:
21+
Enabled: false
22+
23+
Style/MultilineIfModifier:
24+
Enabled: false
25+
26+
Style/RaiseArgs:
27+
Enabled: false
28+
29+
Lint/UnneededDisable:
30+
Enabled: false

.rubocop_todo.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2016-11-20 10:04:42 -0500 using RuboCop version 0.45.0.
3+
# on 2017-04-05 10:30:29 +0700 using RuboCop version 0.48.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9+
# Offense count: 1
10+
Lint/AmbiguousBlockAssociation:
11+
Exclude:
12+
- 'spec/grape_entity/exposure/represent_exposure_spec.rb'
13+
914
# Offense count: 6
1015
Metrics/AbcSize:
1116
Max: 32
1217

18+
# Offense count: 35
19+
# Configuration parameters: CountComments, ExcludedMethods.
20+
Metrics/BlockLength:
21+
Max: 1499
22+
1323
# Offense count: 2
1424
# Configuration parameters: CountComments.
1525
Metrics/ClassLength:
@@ -19,27 +29,17 @@ Metrics/ClassLength:
1929
Metrics/CyclomaticComplexity:
2030
Max: 11
2131

22-
# Offense count: 237
23-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
32+
# Offense count: 238
33+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
2434
# URISchemes: http, https
2535
Metrics/LineLength:
2636
Max: 146
2737

28-
# Offense count: 6
38+
# Offense count: 7
2939
# Configuration parameters: CountComments.
3040
Metrics/MethodLength:
3141
Max: 28
3242

3343
# Offense count: 2
3444
Metrics/PerceivedComplexity:
3545
Max: 13
36-
37-
# Offense count: 33
38-
Style/Documentation:
39-
Enabled: false
40-
41-
# Offense count: 1
42-
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
43-
Style/FileName:
44-
Exclude:
45-
- 'lib/grape-entity.rb'

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#### Features
44

5+
* [#264](https://github.com/ruby-grape/grape-entity/pull/264): Adds Rubocop config and todo list - [@james2m](https://github.com/james2m).
56
* [#255](https://github.com/ruby-grape/grape-entity/pull/255): Adds code coverage w/ coveralls - [@LeFnord](https://github.com/LeFnord).
67

78
* Your contribution here.

Dangerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# frozen_string_literal: true
2+
13
danger.import_dangerfile(gem: 'ruby-grape-danger')

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'http://rubygems.org'
24

35
gemspec

Rakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# encoding: utf-8
2+
# frozen_string_literal: true
23

34
require 'rubygems'
45
require 'bundler'
@@ -17,4 +18,4 @@ RSpec::Core::RakeTask.new(:spec)
1718
require 'rubocop/rake_task'
1819
RuboCop::RakeTask.new(:rubocop)
1920

20-
task default: [:spec, :rubocop]
21+
task default: %i[spec rubocop]

bench/serializing.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
24
require 'grape-entity'
35
require 'benchmark'

grape-entity.gemspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
24
require 'grape_entity/version'
35

@@ -21,7 +23,7 @@ Gem::Specification.new do |s|
2123

2224
s.add_development_dependency 'bundler'
2325
s.add_development_dependency 'rake'
24-
s.add_development_dependency 'rubocop', '~> 0.40'
26+
s.add_development_dependency 'rubocop', '~> 0.48'
2527
s.add_development_dependency 'rspec', '~> 3.0'
2628
s.add_development_dependency 'rack-test'
2729
s.add_development_dependency 'maruku'

lib/grape-entity.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# frozen_string_literal: true
2+
13
require 'grape_entity'

0 commit comments

Comments
 (0)