Skip to content

Commit

Permalink
Enable Style/Encoding cop
Browse files Browse the repository at this point in the history
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.

This also enables the frozen string literal comment cop for this repo so
we can start the process of getting ready to enable that.

Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Jul 14, 2020
1 parent 1bb8489 commit 38363b8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Style/FrozenStringLiteralComment:
Enabled: true
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
10 changes: 5 additions & 5 deletions config/chefstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,15 @@ Style/WhileUntilModifier:
Style/WordArray:
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
# reduces memory usage, but isn't a simple autocorrect so we need to do this one project at a time
Style/FrozenStringLiteralComment:
Enabled: false

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 38363b8

Please sign in to comment.