From 7361ee01e4e6e760ef41361f776d4c1ca57d7391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorian=20Mari=C3=A9?= Date: Thu, 4 Apr 2024 01:54:20 +0200 Subject: [PATCH] linting --- .github/dependabot.yml | 24 ++++++++++++------------ .rubocop.yml | 8 ++++++++ Gemfile | 1 + bin/rspec | 10 +++++++--- lib/template.rb | 6 +----- package.json | 3 +++ spec/spec_helper.rb | 2 ++ template-ruby.gemspec | 2 ++ 8 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 .rubocop.yml create mode 100644 package.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9e58267..8b92e40 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,15 +1,15 @@ --- version: 2 updates: -- directory: "/" - package-ecosystem: github-actions - schedule: - interval: daily -- directory: "/" - package-ecosystem: npm - schedule: - interval: daily -- directory: "/" - package-ecosystem: bundler - schedule: - interval: daily + - directory: "/" + package-ecosystem: github-actions + schedule: + interval: daily + - directory: "/" + package-ecosystem: npm + schedule: + interval: daily + - directory: "/" + package-ecosystem: bundler + schedule: + interval: daily diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..ded59b1 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,8 @@ +inherit_gem: + rubocop-rails-omakase: rubocop.yml + +Layout/SpaceInsideArrayLiteralBrackets: + Enabled: false + +Performance/UnfreezeString: + Enabled: false diff --git a/Gemfile b/Gemfile index 3d74c82..340ab34 100644 --- a/Gemfile +++ b/Gemfile @@ -8,3 +8,4 @@ ruby "3.3.0" gem "rspec" gem "ruby-prof" +gem "rubocop-rails-omakase" diff --git a/bin/rspec b/bin/rspec index cb53ebe..c42c1a9 100755 --- a/bin/rspec +++ b/bin/rspec @@ -13,11 +13,15 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) bundle_binstub = File.expand_path("bundle", __dir__) if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") + if File.read(bundle_binstub, 300).include?( + "This file was generated by Bundler" + ) load(bundle_binstub) else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + abort( + "Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again." + ) end end diff --git a/lib/template.rb b/lib/template.rb index c874337..cf286a0 100644 --- a/lib/template.rb +++ b/lib/template.rb @@ -35,11 +35,7 @@ def evaluate parsed = Template.parse(input) Node::Template.new(parsed).evaluate(context:, output:, error:) - if output.is_a?(StringIO) - output.string - else - "" - end + output.is_a?(StringIO) ? output.string : "" end end diff --git a/package.json b/package.json new file mode 100644 index 0000000..010bd79 --- /dev/null +++ b/package.json @@ -0,0 +1,3 @@ +{ + "license": "MIT" +} \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b3f31aa..8adf618 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + require "rspec" require_relative "../lib/template-ruby" diff --git a/template-ruby.gemspec b/template-ruby.gemspec index 4046980..ce6e394 100644 --- a/template-ruby.gemspec +++ b/template-ruby.gemspec @@ -20,4 +20,6 @@ Gem::Specification.new do |s| s.add_dependency "code-ruby", "~> 0" s.add_dependency "language-ruby", "~> 0" s.add_dependency "zeitwerk", "~> 2" + + s.required_ruby_version = ">= 3.3.0" end