From 06b5aef27d973cc6e2202491fd38c51b21e00fc6 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Mon, 15 Nov 2021 20:01:41 +0530 Subject: [PATCH 1/5] Bump RuboCop to `v1.18.x` via `rubocop-jekyll` --- .github/workflows/ci.yml | 11 ++++++++--- .rubocop.yml | 32 +++++++++++++++++++++++++++++++- .rubocop_todo.yml | 27 +++++++++++---------------- jekyll-sitemap.gemspec | 4 ++-- script/fmt | 2 +- 5 files changed, 53 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b4f2ee..d2e2f55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,13 +10,18 @@ on: jobs: ci: - name: "Unit Tests (Ruby ${{ matrix.ruby_version }})" + name: ${{ matrix.job_name }} runs-on: "ubuntu-latest" strategy: fail-fast: false matrix: - ruby_version: - - "2.4" + include: + - job_name: "Style Check (Ruby ${{ matrix.ruby_version }})" + step_name: Run RuboCop + script_file: fmt + ruby_version: "2.5" steps: - name: Checkout Repository uses: actions/checkout@v2 + - name: ${{ matrix.job_name }} + run: bash script/${{ matrix.script_file }} diff --git a/.rubocop.yml b/.rubocop.yml index 8b27e81..f7fcfa6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,6 +5,36 @@ inherit_gem: rubocop-jekyll: .rubocop.yml AllCops: - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.5 + SuggestExtensions: false Exclude: - vendor/**/* + +Layout/LineEndStringConcatenationIndentation: + Enabled: true + +Lint/Debugger: + Exclude: + - script/console +Lint/EmptyInPattern: + Enabled: false + +Naming/InclusiveLanguage: + Enabled: false +Naming/MemoizedInstanceVariableName: + Exclude: + - lib/jekyll-feed/page-without-a-file.rb + +Performance/MapCompact: + Enabled: true +Performance/RedundantEqualityComparisonBlock: + Enabled: true +Performance/RedundantSplitRegexpArgument: + Enabled: true + +Style/InPatternThen: + Enabled: false +Style/MultilineInPatternThen: + Enabled: false +Style/QuotedSymbols: + Enabled: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3503a7f..c20d034 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,26 +1,21 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2018-12-06 11:55:46 +0100 using RuboCop version 0.61.1. +# on 2021-11-15 14:30:50 UTC using RuboCop version 1.18.4. # 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: 1 -Lint/Debugger: - Exclude: - - 'script/console' +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 138 -# Offense count: 3 -# Configuration parameters: CountComments, Max, ExcludedMethods. -# ExcludedMethods: refine -Metrics/BlockLength: +# Offense count: 4 +# Configuration parameters: AllowedMethods. +# AllowedMethods: enums +Lint/ConstantDefinitionInBlock: Exclude: - - 'spec/jekyll-sitemap_spec.rb' - - 'spec/test_jekyll-last-modified-at.rb' - -# Offense count: 17 -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Metrics/LineLength: - Max: 154 + - 'spec/spec_helper.rb' diff --git a/jekyll-sitemap.gemspec b/jekyll-sitemap.gemspec index 2b6e72b..4448404 100644 --- a/jekyll-sitemap.gemspec +++ b/jekyll-sitemap.gemspec @@ -16,12 +16,12 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r!^(test|spec|features)/!) spec.require_paths = ["lib"] - spec.required_ruby_version = ">= 2.4.0" + spec.required_ruby_version = ">= 2.5.0" spec.add_dependency "jekyll", ">= 3.7", "< 5.0" spec.add_development_dependency "bundler" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 3.0" - spec.add_development_dependency "rubocop-jekyll", "~> 0.4" + spec.add_development_dependency "rubocop-jekyll", "~> 0.12.0" end diff --git a/script/fmt b/script/fmt index c5351ec..913591a 100755 --- a/script/fmt +++ b/script/fmt @@ -1,7 +1,7 @@ #!/bin/bash set -e -echo "Rubocop $(bundle exec rubocop --version)" +echo "RuboCop $(bundle exec rubocop --version)" bundle exec rubocop -D -E $@ success=$? if ((success != 0)); then From 3f584693cc469e00783a841a9c3654b50d1d96a2 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Mon, 15 Nov 2021 20:19:11 +0530 Subject: [PATCH 2/5] Fix CI workflow job name --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2e2f55..9daaf1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,13 +10,13 @@ on: jobs: ci: - name: ${{ matrix.job_name }} + name: "${{ matrix.job_name }} (Ruby ${{ matrix.ruby_version }})" runs-on: "ubuntu-latest" strategy: fail-fast: false matrix: include: - - job_name: "Style Check (Ruby ${{ matrix.ruby_version }})" + - job_name: "Style Check" step_name: Run RuboCop script_file: fmt ruby_version: "2.5" From 5927558842cd12b20fa69d2240fcde640b63c5e1 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Mon, 15 Nov 2021 20:22:32 +0530 Subject: [PATCH 3/5] Set up Ruby in CI Workflow --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9daaf1a..e31718a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,5 +23,10 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v2 + - name: "Set Up Ruby ${{ matrix.ruby_version }}" + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + bundler-cache: true - name: ${{ matrix.job_name }} run: bash script/${{ matrix.script_file }} From c8b72e143d8e1aa9824dc008fb3b3680f5945200 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Mon, 15 Nov 2021 20:28:31 +0530 Subject: [PATCH 4/5] Fix workflow step-name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e31718a..cf55b1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,5 +28,5 @@ jobs: with: ruby-version: ${{ matrix.ruby_version }} bundler-cache: true - - name: ${{ matrix.job_name }} + - name: ${{ matrix.step_name }} run: bash script/${{ matrix.script_file }} From 90ceec7f340117a6be78497b10edfc5a866ef6d8 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Wed, 17 Nov 2021 20:24:34 +0530 Subject: [PATCH 5/5] Add workflow job to check code style --- .github/workflows/ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0127cb..66c7d42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,3 +38,20 @@ jobs: run: bash script/test - name: Test Gem Build run: bundle exec gem build jekyll-sitemap.gemspec + + style_check: + name: "Style Check (Ruby ${{ matrix.ruby_version }})" + runs-on: "ubuntu-latest" + matrix: + ruby_version: + - 2.5 + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: "Set Up Ruby ${{ matrix.ruby_version }}" + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + bundler-cache: true + - name: Run RuboCop + run: bash script/fmt