Skip to content

Commit

Permalink
Enable FrozenStringLiteralComment and FrozenStringLiteralComment
Browse files Browse the repository at this point in the history
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 <tsmith@chef.io>
  • Loading branch information
tas50 committed Jul 14, 2020
1 parent 1bb8489 commit 24672c8
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
source "https://rubygems.org"

# Specify your gem's dependencies in chefstyle.gemspec
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "bundler/gem_tasks"

upstream = Gem::Specification.find_by_name("rubocop")
Expand Down
3 changes: 1 addition & 2 deletions bin/chefstyle
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion chefstyle.gemspec
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
16 changes: 8 additions & 8 deletions config/chefstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/chefstyle.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "chefstyle/version"

# ensure the desired target version of RuboCop is gem activated
Expand Down
5 changes: 3 additions & 2 deletions lib/chefstyle/version.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 24672c8

Please sign in to comment.