Skip to content
This repository has been archived by the owner on Jan 2, 2020. It is now read-only.

Include and comply to relaxed Rubocop style #15

Merged
merged 4 commits into from
Jan 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
/.bundle/
/.yardoc
/_yardoc/
Expand Down
33 changes: 3 additions & 30 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
AllCops:
TargetRubyVersion: 2.3

Style/Documentation:
Enabled: false

Style/StringLiterals:
Enabled: false

Style/FrozenStringLiteralComment:
Exclude:
- './bin/*'
- './exe/*'
- './Rakefile'
- './Gemfile'
- './*.gemspec'
inherit_gem:
relaxed-rubocop: .rubocop.yml

Metrics/BlockLength:
Exclude:
- './*.gemspec'

Metrics/LineLength:
Exclude:
- './*.gemspec'
- 'exe/fuel_surcharge'

# Lint/AssignmentInCondition:
# Enabled: false

Metrics/MethodLength:
Exclude:
- 'test/**/*.rb'

Metrics/AbcSize:
Exclude:
- 'test/**/*.rb'
- "*.gemspec"
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ rvm:
- 2.4
- 2.5
- 2.6

2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
Expand Down
23 changes: 21 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GEM
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
ast (2.4.0)
concurrent-ruby (1.1.3)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
Expand All @@ -40,16 +41,31 @@ GEM
http_parser.rb (0.6.0)
i18n (1.1.1)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.1)
minitest (5.11.3)
minitest-stub_any_instance (1.0.2)
multi_json (1.13.1)
multipart-post (2.0.0)
octokit (4.13.0)
sawyer (~> 0.8.0, >= 0.5.3)
parallel (1.12.1)
parser (2.5.3.0)
ast (~> 2.4.0)
powerpack (0.1.2)
public_suffix (3.0.3)
rainbow (3.0.0)
rake (12.3.2)
relaxed-rubocop (2.3.1)
retriable (2.1.0)
rubocop (0.62.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.4.0)
ruby-progressbar (1.10.0)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
Expand All @@ -59,17 +75,20 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unicode-display_width (1.4.1)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.17)
bundler (>= 1.17)
fuel_surcharge!
github_changelog_generator (~> 1.14)
minitest (~> 5.0)
minitest-stub_any_instance (~> 1.0)
rake (~> 12.3)
relaxed-rubocop (~> 2.3.1)
rubocop (~> 0.62)

BUNDLED WITH
2.0.0
2.0.1
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "github_changelog_generator/task"
require "rake/testtask"
Expand Down
1 change: 1 addition & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "fuel_surcharge"
Expand Down
1 change: 1 addition & 0 deletions exe/fuel_surcharge
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "fuel_surcharge"

Expand Down
7 changes: 6 additions & 1 deletion fuel_surcharge.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Expand Down Expand Up @@ -39,9 +41,12 @@ Gem::Specification.new do |spec|

spec.add_dependency "http", "~> 4.0"

spec.add_development_dependency "bundler", "~> 1.17"
spec.add_development_dependency "bundler", ">= 1.17"
spec.add_development_dependency "github_changelog_generator", "~> 1.14"
spec.add_development_dependency "minitest", "~> 5.0"
spec.add_development_dependency "minitest-stub_any_instance", "~> 1.0"
spec.add_development_dependency "rake", "~> 12.3"
# We it is mature, we'll switch to the "standard" gem
spec.add_development_dependency "relaxed-rubocop", "~> 2.3.1"
spec.add_development_dependency "rubocop", "~> 0.62"
end
6 changes: 3 additions & 3 deletions lib/fuel_surcharge/string_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ module FuelSurcharge
module StringFormatter
refine String do
def to_multiplier
number = BigDecimal tr(",", ".").gsub(/[^0-9\.]/, "")

(number / 100 + 1).round(4)
clean_string = tr(",", ".").gsub(/[^0-9\.]/, "")
number = BigDecimal(clean_string)
1 + (number / 100).round(4)
end
end
end
Expand Down