-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Rubocop and and fix compliance (#9)
- Loading branch information
1 parent
3804065
commit e4eb445
Showing
22 changed files
with
466 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
inherit_from: .rubocop_todo.yml | ||
|
||
# inherit_from: .rubocop_todo.yml | ||
|
||
require: | ||
- rubocop-performance | ||
- rubocop-rake | ||
- rubocop-rspec | ||
|
||
AllCops: | ||
TargetRubyVersion: 2.6 | ||
NewCops: enable | ||
Exclude: | ||
- 'data/**/*' | ||
- 'vendor/**/*' | ||
|
||
Metrics/CollectionLiteralLength: | ||
Exclude: | ||
- 'lib/paygate/aes.rb' | ||
|
||
Naming/FileName: | ||
Exclude: | ||
- 'lib/paygate-ruby.rb' | ||
|
||
Naming/MethodParameterName: | ||
Exclude: | ||
- 'lib/paygate/aes.rb' | ||
- 'lib/paygate/aes_ctr.rb' | ||
|
||
RSpec/NotToNot: | ||
EnforcedStyle: to_not | ||
|
||
Style/Documentation: | ||
Enabled: false | ||
|
||
Style/ModuleFunction: | ||
EnforcedStyle: extend_self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This configuration was generated by | ||
# `rubocop --auto-gen-config` | ||
# on 2023-04-26 08:36:11 UTC using RuboCop version 1.50.0. | ||
# The point is for the user to remove these configuration records | ||
# one by one as the offenses are removed from the code base. | ||
# Note that changes in the inspected code, or installation of new | ||
# versions of RuboCop, may require this file to be generated again. | ||
|
||
# Offense count: 7 | ||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. | ||
Metrics/AbcSize: | ||
Max: 93 | ||
|
||
# Offense count: 1 | ||
# Configuration parameters: CountComments, CountAsOne. | ||
Metrics/ClassLength: | ||
Max: 113 | ||
|
||
# Offense count: 8 | ||
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. | ||
Metrics/MethodLength: | ||
Max: 35 | ||
|
||
# Offense count: 1 | ||
# Configuration parameters: CountComments, CountAsOne. | ||
Metrics/ModuleLength: | ||
Max: 123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'bundler/gem_tasks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,3 @@ | ||
require 'yaml' | ||
require 'paygate/version' | ||
require 'paygate/configuration' | ||
require 'paygate/aes' | ||
require 'paygate/aes_ctr' | ||
require 'paygate/member' | ||
require 'paygate/response' | ||
require 'paygate/transaction' | ||
require 'paygate/profile' | ||
require 'paygate/action_view/form_helper' if defined?(ActionView) | ||
# frozen_string_literal: true | ||
|
||
module Paygate | ||
CONFIG = YAML.load(File.read(File.expand_path('../data/config.yml', File.dirname(__FILE__)))).freeze | ||
LOCALES_MAP = CONFIG[:locales].freeze | ||
INTL_BRANDS_MAP = CONFIG[:intl_brands].freeze | ||
KOREA_BIN_NUMBERS = CONFIG[:korea_bin_numbers].freeze | ||
DEFAULT_CURRENCY = 'WON'.freeze | ||
DEFAULT_LOCALE = 'US'.freeze | ||
|
||
def mapped_currency(currency) | ||
return DEFAULT_CURRENCY unless currency.present? | ||
|
||
currency.to_s == 'KRW' ? 'WON' : currency.to_s | ||
end | ||
module_function :mapped_currency | ||
|
||
def mapped_locale(locale) | ||
locale.present? ? LOCALES_MAP[locale.to_s] : DEFAULT_LOCALE | ||
end | ||
module_function :mapped_locale | ||
|
||
class << self | ||
attr_writer :configuration | ||
end | ||
|
||
def self.configuration | ||
@configuration ||= Configuration.new | ||
end | ||
|
||
def self.configure | ||
yield configuration | ||
end | ||
end | ||
require 'paygate' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'yaml' | ||
require 'paygate/version' | ||
require 'paygate/configuration' | ||
require 'paygate/aes' | ||
require 'paygate/aes_ctr' | ||
require 'paygate/member' | ||
require 'paygate/response' | ||
require 'paygate/transaction' | ||
require 'paygate/profile' | ||
require 'paygate/action_view/form_helper' if defined?(ActionView) | ||
|
||
module Paygate | ||
extend self | ||
|
||
CONFIG = YAML.safe_load(File.read(File.expand_path('../data/config.yml', __dir__)), | ||
permitted_classes: [Symbol]).freeze | ||
LOCALES_MAP = CONFIG[:locales].freeze | ||
INTL_BRANDS_MAP = CONFIG[:intl_brands].freeze | ||
KOREA_BIN_NUMBERS = CONFIG[:korea_bin_numbers].freeze | ||
DEFAULT_CURRENCY = 'WON' | ||
DEFAULT_LOCALE = 'US' | ||
|
||
def mapped_currency(currency) | ||
currency = currency&.to_s | ||
return DEFAULT_CURRENCY if currency.nil? | ||
|
||
currency.to_s == 'KRW' ? 'WON' : currency.to_s | ||
end | ||
|
||
def mapped_locale(locale) | ||
LOCALES_MAP[locale&.to_s] || DEFAULT_LOCALE | ||
end | ||
|
||
def configuration | ||
@configuration ||= Configuration.new | ||
end | ||
|
||
def configure | ||
yield(configuration) | ||
end | ||
end |
Oops, something went wrong.