diff --git a/.rubocop.yml b/.rubocop.yml index eb1ade1..5ddd210 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,5 @@ +require: rubocop-performance + AllCops: Include: - 'lib/**/*' @@ -18,7 +20,7 @@ AllCops: - '**/*.rake' - '**/.rb' DisplayCopNames: true - TargetRubyVersion: 2.2 + TargetRubyVersion: 2.4 # Preferred codebase style --------------------------------------------- Layout/ExtraSpacing: @@ -39,7 +41,7 @@ Layout/SpaceInsideBlockBraces: Layout/SpaceInsideHashLiteralBraces: EnforcedStyle: no_space -Layout/AlignParameters: +Layout/ParameterAlignment: EnforcedStyle: with_fixed_indentation Style/EmptyElse: @@ -127,3 +129,9 @@ Lint/DuplicateMethods: Naming/HeredocDelimiterNaming: Enabled: false +Style/FrozenStringLiteralComment: + Enabled: false + +Metrics/AbcSize: + Enabled: false + diff --git a/.travis.yml b/.travis.yml index 8b0dbfe..2b2a145 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,8 @@ language: rvm: # - '2.0' # - '2.1' NOTE: For ruby <2.3,rubocop Offense : adapters/*charts.rb:11:9: C: Style/ModuleFunction: Use module_function instead of extend self. - - '2.2' + # - '2.2' - Not checking because of so many rubocop conflicts with + # new ruby versions - '2.3.0' - '2.4.0' - '2.5.3' diff --git a/Gemfile b/Gemfile index 10aeb75..c898a8e 100644 --- a/Gemfile +++ b/Gemfile @@ -17,4 +17,5 @@ group :test do gem 'rspec' gem 'simplecov', require: false gem 'simplecov-console', require: false + gem 'rubocop-performance' end diff --git a/lib/daru/view.rb b/lib/daru/view.rb index aadcabd..6f6c88e 100644 --- a/lib/daru/view.rb +++ b/lib/daru/view.rb @@ -46,7 +46,7 @@ def plotting_library=(lib) begin load_lib_in_iruby lib.to_s if defined? IRuby rescue NameError - return + # nothing to return end end @@ -68,7 +68,7 @@ def table_library=(lib) begin load_lib_in_iruby lib.to_s if defined? IRuby rescue NameError - return + # nothing to return end end @@ -142,13 +142,13 @@ def load_libs_in_iruby(libraries=[]) # Load the dependent JS files in IRuby notebook. Those JS will help in # plotting the charts in IRuby cell. def load_lib_in_iruby(library) - if library.match('highcharts') + if library.match?('highcharts') library = 'LazyHighCharts' Object.const_get(library).init_iruby - elsif library.match('googlecharts') + elsif library.match?('googlecharts') library = 'GoogleVisualr' Object.const_get(library).init_iruby - elsif library.match('datatables') + elsif library.match?('datatables') library = 'DataTables' Object.const_get(library).init_iruby else diff --git a/lib/daru/view/constants.rb b/lib/daru/view/constants.rb index 69a413b..9f01b4b 100644 --- a/lib/daru/view/constants.rb +++ b/lib/daru/view/constants.rb @@ -20,10 +20,10 @@ HIGHCHARTS_DEPENDENCIES_CSS = ['highcharts.css'].freeze # Dependent GoogleCharts JS constants for IRuby notebook -GOOGLECHARTS_DEPENDENCIES_IRUBY = ['google_visualr.js', 'loader.js'].freeze +GOOGLECHARTS_DEPENDENCIES_IRUBY = ['loader.js'].freeze # Dependent GoogleCharts JS constants for web frameworks -GOOGLECHARTS_DEPENDENCIES_WEB = ['google_visualr.js', 'loader.js', 'jspdf.min.js'].freeze +GOOGLECHARTS_DEPENDENCIES_WEB = ['loader.js', 'jspdf.min.js'].freeze # Regex pattern to match a valid URL PATTERN_URL = Regexp.new( diff --git a/lib/daru/view/version.rb b/lib/daru/view/version.rb index 60f16b3..0080a8b 100644 --- a/lib/daru/view/version.rb +++ b/lib/daru/view/version.rb @@ -1,5 +1,5 @@ module Daru module View - VERSION = '0.2.5'.freeze + VERSION = '0.2.6'.freeze end end diff --git a/spec/plot_list_spec.rb b/spec/plot_list_spec.rb index 0ea2a8a..a2f530e 100644 --- a/spec/plot_list_spec.rb +++ b/spec/plot_list_spec.rb @@ -77,7 +77,9 @@ content = File.read(path) expect(content).to match(/html/i) expect(content).to match(/loader.js/i) - expect(content).to match(/google_visualr.js/) + # PR: #157 - need to find out why this js is deprecated in + # google chart official site + # expect(content).to match(/google_visualr.js/) expect(content).to match(/highstock.js/) expect(content).to match(/require.min.js/) expect(content).to match(/