From cf8c3594636d8bb598d961aa24e25196c8ef85cf Mon Sep 17 00:00:00 2001 From: Toshimaru Date: Mon, 8 Jul 2024 08:19:00 +0900 Subject: [PATCH] ci: Add rubocop CI (#18) * ci: Add rubocop CI * Create .rubocop.yml * chore: Add metadata definition * Update `.rubocop.yml` * rubocop -a --- .github/workflows/ci.yml | 11 +++++++++++ .rubocop.yml | 28 ++++++++++++++++++++++++++++ jekyll-include_sass.gemspec | 9 +++++++-- test/jekyll/include_tag_test_base.rb | 4 ++-- 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 .rubocop.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee82a4a..f6cb2a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,3 +28,14 @@ jobs: bundler-cache: true - name: Run Test run: bundle exec rake + + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3 + bundler-cache: true + - name: Rubocop + run: bundle exec rubocop diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..346f51f --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,28 @@ +inherit_mode: + merge: + - Exclude + +AllCops: + TargetRubyVersion: 2.7 + NewCops: enable + SuggestExtensions: false + Exclude: + - 'gemfiles/*.gemfile' + +Style/FrozenStringLiteralComment: + Enabled: true + +Style/StringLiterals: + Enabled: false + +Layout/LineLength: + Enabled: false + +Naming/FileName: + Enabled: false + +Metrics/MethodLength: + Enabled: false + +Style/ClassAndModuleChildren: + Enabled: false diff --git a/jekyll-include_sass.gemspec b/jekyll-include_sass.gemspec index 5d98e81..85dc5d0 100644 --- a/jekyll-include_sass.gemspec +++ b/jekyll-include_sass.gemspec @@ -8,11 +8,16 @@ Gem::Specification.new do |spec| spec.authors = ["toshimaru"] spec.email = ["me@toshimaru.net"] - spec.summary = %q{Jekyll include_sass tag which aincludes and converts SASS/SCSS file. Useful for AMP HTML!} - spec.description = %q{Jekyll include_sass tag is a shorthand tag for including SASS/SCSS file inside head tag. It's useful when you don't want to reference external CSS, for example, in AMP.} + spec.summary = 'Jekyll include_sass tag which aincludes and converts SASS/SCSS file. Useful for AMP HTML!' + spec.description = "Jekyll include_sass tag is a shorthand tag for including SASS/SCSS file inside head tag. It's useful when you don't want to reference external CSS, for example, in AMP." spec.homepage = "https://github.com/toshimaru/jekyll-include_sass" spec.license = "MIT" + spec.metadata["homepage_uri"] = "https://github.com/toshimaru/jekyll-include_sass" + spec.metadata["source_code_uri"] = "https://github.com/toshimaru/jekyll-include_sass" + spec.metadata["changelog_uri"] = "https://github.com/toshimaru/jekyll-include_sass/releases" + spec.metadata['rubygems_mfa_required'] = 'true' + spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] diff --git a/test/jekyll/include_tag_test_base.rb b/test/jekyll/include_tag_test_base.rb index cb0110e..d23ddbb 100644 --- a/test/jekyll/include_tag_test_base.rb +++ b/test/jekyll/include_tag_test_base.rb @@ -57,8 +57,8 @@ def create_post(content, override = {}) def render_with(site, content, override = {}) converter = site.converters.find { |c| c.instance_of?(Jekyll::Converters::Markdown) } payload = { "highlighter_prefix" => converter.highlighter_prefix, - "highlighter_suffix" => converter.highlighter_suffix, }.merge(override) - info = { :registers => { :site => site } } + "highlighter_suffix" => converter.highlighter_suffix }.merge(override) + info = { registers: { site: site } } converter.convert( Liquid::Template.parse(content).render!(payload, info) )