From bbc3c2d7e776601249271da92e1c78bdfa95c89a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 11 Aug 2021 17:02:31 +0200 Subject: [PATCH] Add and apply Style/SingleLineMethods rubocop rule Single line methods are hard to read, at least with this syntax. The syntax used in Ruby 3.0 is accepted since Rubocop 1.7.0. --- .rubocop.yml | 3 +++ config/sitemap.rb | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 171999072..219a99574 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -517,6 +517,9 @@ Style/RedundantSelf: Style/SafeNavigation: Enabled: true +Style/SingleLineMethods: + Enabled: true + Style/SoleNestedConditional: Enabled: true diff --git a/config/sitemap.rb b/config/sitemap.rb index 8886fd7b3..24b0e8ce3 100644 --- a/config/sitemap.rb +++ b/config/sitemap.rb @@ -1,6 +1,9 @@ # not use compression class SitemapGenerator::FileAdapter - def gzip(stream, data); stream.write(data); stream.close end + def gzip(stream, data) + stream.write(data) + stream.close + end end SitemapGenerator::Sitemap.namer = SitemapGenerator::SimpleNamer.new(:sitemap, extension: ".xml")