From 24672c8d560dcbd38931b6e088e54849385bd404 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Tue, 14 Jul 2020 12:48:18 -0700 Subject: [PATCH] Enable FrozenStringLiteralComment and FrozenStringLiteralComment Making sure we freeze all the literals saves memory and it's going to become the default in future Ruby so we should get on board The encoding cop was previously disabled as it *added* the encoding comments. Now it removes them if they were setting utf-8 since that's the default on Ruby 2 and is totally pointless to set Signed-off-by: Tim Smith --- Gemfile | 1 + Rakefile | 1 + bin/chefstyle | 3 +-- chefstyle.gemspec | 2 +- config/chefstyle.yml | 16 ++++++++-------- lib/chefstyle.rb | 1 + lib/chefstyle/version.rb | 5 +++-- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 67a4cdf..f5788f3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true source "https://rubygems.org" # Specify your gem's dependencies in chefstyle.gemspec diff --git a/Rakefile b/Rakefile index c948ee6..f409242 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/gem_tasks" upstream = Gem::Specification.find_by_name("rubocop") diff --git a/bin/chefstyle b/bin/chefstyle index f22fa4e..49d051b 100755 --- a/bin/chefstyle +++ b/bin/chefstyle @@ -1,6 +1,5 @@ #!/usr/bin/env ruby -# -*- encoding: utf-8 -*- - +# frozen_string_literal: true $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w{.. lib}) require "chefstyle" diff --git a/chefstyle.gemspec b/chefstyle.gemspec index 2615c7c..082a45d 100644 --- a/chefstyle.gemspec +++ b/chefstyle.gemspec @@ -1,4 +1,4 @@ -# coding: utf-8 +# frozen_string_literal: true lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "chefstyle/version" diff --git a/config/chefstyle.yml b/config/chefstyle.yml index 2d06d97..724086e 100644 --- a/config/chefstyle.yml +++ b/config/chefstyle.yml @@ -482,14 +482,18 @@ Style/WhileUntilModifier: Style/WordArray: Enabled: true +# reduces memory usage +Style/FrozenStringLiteralComment: + Enabled: true + +# we are ruby > 2.0 only so we can remove encoding comments for utf-8 +Style/Encoding: + Enabled: true + # # Disabled Style # -# FIXME: we need to enable this -Style/FrozenStringLiteralComment: - Enabled: false - # As of this commit we have 686 modules and classes without docs. # This is a cop that we /should/ have enabled, but tactically we can't really enable. Style/Documentation: @@ -529,10 +533,6 @@ Style/FormatString: Style/IfUnlessModifier: Enabled: false -# we are ruby > 2.0 only so can disable the Encoding cop -Style/Encoding: - Enabled: false - # Dan is -1 on this one: https://github.com/chef/chef/pull/4526#issuecomment-179950045 Layout/IndentFirstHashElement: Enabled: false diff --git a/lib/chefstyle.rb b/lib/chefstyle.rb index e56ac22..fa6dd53 100644 --- a/lib/chefstyle.rb +++ b/lib/chefstyle.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_relative "chefstyle/version" # ensure the desired target version of RuboCop is gem activated diff --git a/lib/chefstyle/version.rb b/lib/chefstyle/version.rb index 8a8613f..a49ab78 100644 --- a/lib/chefstyle/version.rb +++ b/lib/chefstyle/version.rb @@ -1,4 +1,5 @@ +# frozen_string_literal: true module Chefstyle - VERSION = "1.1.3".freeze - RUBOCOP_VERSION = "0.87.1".freeze + VERSION = "1.1.3" + RUBOCOP_VERSION = "0.87.1" end