Skip to content

Commit

Permalink
Install rubocop && rubocop -a
Browse files Browse the repository at this point in the history
  • Loading branch information
ganmacs committed Oct 6, 2018
1 parent 26ff47c commit f874da6
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 33 deletions.
62 changes: 62 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
AllCops:
Exclude:
- '**/**/*.pb.rb'
- "vendor/**/*"
DisplayCopNames: true
TargetRubyVersion: 2.4

Style/AndOr:
EnforcedStyle: conditionals

Style/AsciiComments:
Enabled: false

Style/Documentation:
Enabled: false

Style/DoubleNegation:
Enabled: false

Style/EmptyElse:
EnforcedStyle: empty

Style/FormatString:
EnforcedStyle: percent

Style/IfUnlessModifier:
Enabled: false


Style/PredicateName:
NamePrefixBlacklist:
- "is_"
- "have_"
NamePrefix:
- "is_"
- "have_"

Style/SignalException:
EnforcedStyle: only_raise

Style/SingleLineBlockParams:
Enabled: false

Lint/UnderscorePrefixedVariableName:
Enabled: false

##################### Metrics ##################################

Metrics/AbcSize:
Max: 30

Metrics/CyclomaticComplexity:
Max: 10

Metrics/LineLength:
Max: 160

Metrics/MethodLength:
Max: 20

Metrics/PerceivedComplexity:
Max: 8
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
source "https://rubygems.org"
# frozen_string_literal: true

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
source 'https://rubygems.org'

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in grpc_kit.gemspec
gemspec
8 changes: 5 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
task default: :spec
7 changes: 4 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "grpc_kit"
require 'bundler/setup'
require 'grpc_kit'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand All @@ -10,5 +11,5 @@ require "grpc_kit"
# require "pry"
# Pry.start

require "irb"
require 'irb'
IRB.start(__FILE__)
38 changes: 20 additions & 18 deletions grpc_kit.gemspec
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
# frozen_string_literal: true

lib = File.expand_path("../lib", __FILE__)
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "grpc_kit/version"
require 'grpc_kit/version'

Gem::Specification.new do |spec|
spec.name = "grpc_kit"
spec.name = 'grpc_kit'
spec.version = GrpcKit::VERSION
spec.authors = ["ganmacs"]
spec.email = ["ganmacs@gmail.com"]
spec.authors = ['ganmacs']
spec.email = ['ganmacs@gmail.com']

spec.summary = "..."
spec.description = "..."
spec.homepage = "https://github.com/ganmacs/grpc_kit"
spec.license = "MIT"
spec.summary = '...'
spec.description = '...'
spec.homepage = 'https://github.com/ganmacs/grpc_kit'
spec.license = 'MIT'

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if spec.respond_to?(:metadata)
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
else
raise "RubyGems 2.0 or newer is required to protect against " \
"public gem pushes."
raise 'RubyGems 2.0 or newer is required to protect against ' \
'public gem pushes.'
end

spec.files = `git ls-files -z`.split("\x0").reject do |f|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = "exe"
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.require_paths = ['lib']

spec.add_development_dependency "bundler", "~> 1.16"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency 'bundler', '~> 1.16'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rubocop'
end
4 changes: 3 additions & 1 deletion lib/grpc_kit.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require "grpc_kit/version"
# frozen_string_literal: true

require 'grpc_kit/version'

module GrpcKit
# Your code goes here...
Expand Down
4 changes: 3 additions & 1 deletion lib/grpc_kit/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module GrpcKit
VERSION = "0.1.0"
VERSION = '0.1.0'
end
6 changes: 4 additions & 2 deletions spec/grpc_kit_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# frozen_string_literal: true

RSpec.describe GrpcKit do
it "has a version number" do
it 'has a version number' do
expect(GrpcKit::VERSION).not_to be nil
end

it "does something useful" do
it 'does something useful' do
expect(false).to eq(true)
end
end
8 changes: 5 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
require "bundler/setup"
require "grpc_kit"
# frozen_string_literal: true

require 'bundler/setup'
require 'grpc_kit'

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
config.example_status_persistence_file_path = '.rspec_status'

# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
Expand Down

0 comments on commit f874da6

Please sign in to comment.