From 8279083960a478b9566d94f69e707b254d593d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 2 Sep 2020 22:11:21 +0200 Subject: [PATCH 1/5] Show what's wrong when `gem build` spec fails --- spec/gemspec_spec.lint.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/gemspec_spec.lint.rb b/spec/gemspec_spec.lint.rb index f5a75b6d..801cbea5 100644 --- a/spec/gemspec_spec.lint.rb +++ b/spec/gemspec_spec.lint.rb @@ -13,7 +13,7 @@ end it "has no warnings" do - expect(build[1]).not_to include("WARNING") + expect(build[1]).not_to include("WARNING"), build[1] end it "succeeds" do From 7a1428e77c09ffd089f708be35498d9e0135fbb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 2 Sep 2020 22:12:28 +0200 Subject: [PATCH 2/5] Fix `gem build` warning about unbounded dep --- Gemfile.lock | 2 +- arbre.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 794286d0..5d6dedff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: arbre (1.3.0) activesupport (>= 3.0.0, < 6.1) - ruby2_keywords (>= 0.0.2) + ruby2_keywords (>= 0.0.2, < 1.0) GEM remote: http://rubygems.org/ diff --git a/arbre.gemspec b/arbre.gemspec index 6e54ce69..0d8d44e9 100644 --- a/arbre.gemspec +++ b/arbre.gemspec @@ -22,5 +22,5 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.5' s.add_dependency("activesupport", ">= 3.0.0", "< 6.1") - s.add_dependency("ruby2_keywords", ">= 0.0.2") + s.add_dependency("ruby2_keywords", ">= 0.0.2", "< 1.0") end From 021e1ed57d1d32b067be4ae2e11973517bbf10d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 2 Sep 2020 22:43:24 +0200 Subject: [PATCH 3/5] Fix a jruby warning about unrelated default gemspec with deprecated attributes Newer rubygems no longer reads all gemspecs on startup and thus no longer warns. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4ab2ec86..0936e655 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby sudo: false before_install: - - gem update --system 3.1.3 + - gem update --system 3.2.0.rc.1 - gem install bundler:2.1.4 rvm: - 2.5.8 From 0b988f3bc6a3285b69530bfb06323d88ddb775f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 4 Sep 2020 13:27:27 +0200 Subject: [PATCH 4/5] Ignore `jruby-openssl` warnings We can get rid of this when `jruby-openssl 0.10.5` is released. --- spec/gemspec_spec.lint.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/spec/gemspec_spec.lint.rb b/spec/gemspec_spec.lint.rb index 801cbea5..dc9f4874 100644 --- a/spec/gemspec_spec.lint.rb +++ b/spec/gemspec_spec.lint.rb @@ -13,7 +13,21 @@ end it "has no warnings" do - expect(build[1]).not_to include("WARNING"), build[1] + output = build[1] + + if RUBY_ENGINE == "jruby" + annoying_jruby_warnings = [ + /WARNING: An illegal reflective access operation has occurred/, + /WARNING: Illegal reflective access by org.jruby.ext.openssl.SecurityHelper \(file:.*\/jopenssl\.jar\) to field java\.security\.MessageDigest\.provider/, + /WARNING: Please consider reporting this to the maintainers of org\.jruby\.ext\.openssl\.SecurityHelper/, + /WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations/, + /WARNING: All illegal access operations will be denied in a future release/ + ] + + output = output.split("\n").reject { |line| annoying_jruby_warnings.any? { |warning| warning.match?(line) } }.join("\n") + end + + expect(output).not_to include("WARNING"), output end it "succeeds" do From 98342a7033727ffc22fc15d697e58590b6853ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 2 Sep 2020 22:12:47 +0200 Subject: [PATCH 5/5] Run lint specs by default --- tasks/lint.rake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tasks/lint.rake b/tasks/lint.rake index 7d5a3c27..a2712829 100644 --- a/tasks/lint.rake +++ b/tasks/lint.rake @@ -57,7 +57,7 @@ require 'rubocop/rake_task' RuboCop::RakeTask.new desc "Lints ActiveAdmin code base" -task lint: ["rubocop", "lint:missing_trailing_carriage_return"] +task lint: ["rubocop", "lint:missing_trailing_carriage_return", "lint:rspec"] namespace :lint do desc "Check for missing trailing new lines" @@ -66,4 +66,16 @@ namespace :lint do MissingTrailingCarriageReturn.new.run end + + desc "RSpec specs for linting project files" + task :rspec do + puts "Linting project files..." + + sh( + "bundle", + "exec", + "rspec", + *Dir.glob("spec/*.lint.rb") + ) + end end