Skip to content

Commit

Permalink
Add rubocop and fix offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Bates committed Feb 8, 2018
1 parent add3c7e commit a5707af
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 37 deletions.
65 changes: 65 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
AllCops:
TargetRubyVersion: 2.3

Documentation:
Enabled: false

Layout/DotPosition:
Enabled: false

Metrics/ClassLength:
Enabled: false

Metrics/LineLength:
Max: 120
Enabled: true

Metrics/MethodLength:
Max: 15
CountComments: false
Enabled: true

StringLiterals:
Enabled: true

Style/AsciiComments:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false

Style/EmptyMethod:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: false

Style/Lambda:
Enabled: false

Style/MethodCallWithoutArgsParentheses:
Enabled: true

Style/MethodDefParentheses:
Enabled: true

Style/PercentLiteralDelimiters:
PreferredDelimiters:
default: ()
'%i': '()'
'%I': '()'
'%r': '{}'
'%w': '()'
'%W': '()'

Style/RegexpLiteral:
Enabled: false

Style/StructInheritance:
Enabled: false

Style/SymbolArray:
Enabled: false

Style/WordArray:
Enabled: false
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"
source 'https://rubygems.org'

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

# Specify your gem's dependencies in hodlmoon.gemspec
gemspec
16 changes: 16 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ PATH
GEM
remote: https://rubygems.org/
specs:
ast (2.4.0)
coderay (1.1.1)
diff-lcs (1.3)
httparty (0.15.7)
multi_xml (>= 0.5.2)
method_source (0.8.2)
multi_xml (0.6.0)
parallel (1.12.0)
parser (2.4.0.2)
ast (~> 2.3)
powerpack (0.1.1)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rainbow (3.0.0)
rake (10.5.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
Expand All @@ -32,8 +38,17 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rubocop (0.52.1)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
slop (3.6.0)
thor (0.20.0)
unicode-display_width (1.3.0)

PLATFORMS
ruby
Expand All @@ -44,6 +59,7 @@ DEPENDENCIES
pry
rake (~> 10.0)
rspec (~> 3.0)
rubocop (~> 0.52.1)

BUNDLED WITH
1.16.1
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

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

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

require "bundler/setup"
require "hodlmoon"
require 'bundler/setup'
require 'hodlmoon'

# 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 +10,5 @@ require "hodlmoon"
# require "pry"
# Pry.start

require "irb"
require 'irb'
IRB.start(__FILE__)
43 changes: 22 additions & 21 deletions hodlmoon.gemspec
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@

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

Gem::Specification.new do |spec|
spec.name = "hodlmoon"
spec.name = 'hodlmoon'
spec.version = Hodlmoon::VERSION
spec.authors = ["Richard Bates"]
spec.email = ["richo225@gmail.com"]
spec.authors = ['Richard Bates']
spec.email = ['richo225@gmail.com']

spec.summary = %q{Write a short summary, because RubyGems requires one.}
spec.description = %q{Write a longer description or delete this line.}
spec.homepage = "https://github.com/richo225/hodlmoon"
spec.license = "MIT"
spec.summary = 'Write a short summary, because RubyGems requires one.'
spec.description = 'Write a longer description or delete this line.'
spec.homepage = 'https://github.com/richo225/hodlmoon'
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_dependency "thor"
spec.add_dependency "httparty"
spec.add_dependency 'httparty'
spec.add_dependency 'thor'

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 "pry"
spec.add_development_dependency 'bundler', '~> 1.16'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rubocop', '~> 0.52.1'
end
4 changes: 2 additions & 2 deletions lib/hodlmoon/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class Cli < Thor
eur: '€'
}.freeze

desc "hello NAME", "say hello to NAME"
desc 'hello NAME', 'say hello to NAME'
def hello(name)
puts "Hello #{name}"
end

desc "price COIN CURRENCY", "get current price of COIN in CURRENCY"
desc 'price COIN CURRENCY', 'get current price of COIN in CURRENCY'
def price(coin, currency)
price = Hodlmoon::Client::CoinMarketCap.retrieve_price(coin, currency)
puts "#{CURRENCY[currency.to_sym]}#{price}"
Expand Down
2 changes: 1 addition & 1 deletion lib/hodlmoon/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Hodlmoon
VERSION = "0.1.0"
VERSION = '0.1.0'.freeze
end
4 changes: 2 additions & 2 deletions spec/hodlmoon_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
RSpec.describe Hodlmoon do
it "has a version number" do
it 'has a version number' do
expect(Hodlmoon::VERSION).not_to be nil
end

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

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 a5707af

Please sign in to comment.