Enforce Style/FrozenStringLiteralComment. (#6265)

Merge pull request 6265
This commit is contained in:
Parker Moore 2017-08-03 21:27:32 -04:00 committed by jekyllbot
parent f9f05e3f75
commit 7cf5f51ca2
133 changed files with 264 additions and 12 deletions

View File

@ -9,6 +9,7 @@ AllCops:
- benchmark/**/*
- script/**/*
- vendor/**/*
- tmp/**/*
Layout/AlignArray:
Enabled: false
Layout/AlignHash:
@ -99,6 +100,9 @@ Style/BracesAroundHashParameters:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always
Style/Documentation:
Enabled: false
Exclude:

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
source "https://rubygems.org"
gemspec :name => "jekyll"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "rubygems"
require "rake"
require "rdoc"

View File

@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
STDOUT.sync = true
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
Before do
FileUtils.rm_rf(Paths.test_dir) if Paths.test_dir.exist?
FileUtils.mkdir_p(Paths.test_dir) unless Paths.test_dir.directory?

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "fileutils"
require "colorator"
require "cucumber/formatter/console"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "fileutils"
require "jekyll"
require "time"
@ -107,7 +109,8 @@ def run_in_shell(*args)
File.write(Paths.status_file, p.exitstatus)
File.open(Paths.output_file, "wb") do |f|
f.puts "$ " << args.join(" ")
f.print "$ "
f.puts args.join(" ")
f.puts output
f.puts "EXIT STATUS: #{p.exitstatus}"
end

View File

@ -1,4 +1,5 @@
# coding: utf-8
# frozen_string_literal: true
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
$LOAD_PATH.unshift __dir__ # For use/testing when no gem is installed
# Require all of the Ruby files in the given directory.
@ -162,8 +164,9 @@ module Jekyll
def sanitized_path(base_directory, questionable_path)
return base_directory if base_directory.eql?(questionable_path)
questionable_path.insert(0, "/") if questionable_path.start_with?("~")
clean_path = File.expand_path(questionable_path, "/")
clean_path = questionable_path.dup
clean_path.insert(0, "/") if clean_path.start_with?("~")
clean_path = File.expand_path(clean_path, "/")
return clean_path if clean_path.eql?(base_directory)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "set"
module Jekyll

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Collection
attr_reader :site, :label, :metadata

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Command
class << self

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Commands
class Build < Command

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Commands
class Clean < Command

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "addressable/uri"
module Jekyll

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Commands
class Help < Command

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "erb"
module Jekyll

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "erb"
class Jekyll::Commands::NewTheme < Jekyll::Command

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Commands
class Serve < Command

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "webrick"
module Jekyll

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
class Configuration < Hash

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Converter < Plugin
# Public: Get or set the highlighter prefix. When an argument is specified,

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Converters
class Identity < Converter

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Converters
class Markdown < Converter

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Converters
class Markdown

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Jekyll::Converters::Markdown::RedcarpetParser
module CommonMethods
def add_code_tags(code, lang)
@ -48,9 +50,7 @@ class Jekyll::Converters::Markdown::RedcarpetParser
def block_code(code, lang)
code = "<pre>#{super}</pre>"
output = "<div class=\"highlight\">"
output << add_code_tags(code, lang)
output << "</div>"
"<div class=\"highlight\">#{add_code_tags(code, lang)}</div>"
end
protected

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Kramdown::Parser::SmartyPants < Kramdown::Parser::Kramdown
def initialize(source, options)
super

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
require "set"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Deprecator
extend self

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
class Document

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
module Drops

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
module Drops

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
module Drops

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
module Drops

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
module Drops

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
module Drops

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Drops
class StaticFileDrop < Drop

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
module Drops

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
module Drops

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class EntryFilter
attr_reader :site

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Errors
FatalException = Class.new(::RuntimeError)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Excerpt
extend Forwardable
@ -117,7 +119,7 @@ module Jekyll
if tail.empty?
head
else
"" << head << "\n\n" << tail.scan(%r!^ {0,3}\[[^\]]+\]:.+$!).join("\n")
head.to_s.dup << "\n\n" << tail.scan(%r!^ {0,3}\[[^\]]+\]:.+$!).join("\n")
end
end
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module External
class << self

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "addressable/uri"
require "json"
require "date"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Filters
module GroupingFilters

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "addressable/uri"
module Jekyll

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
# This class handles custom defaults for YAML frontmatter settings.
# These are set in _config.yml and apply both to internal use (e.g. layout)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
Generator = Class.new(Plugin)
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Hooks
DEFAULT_PRIORITY = 20

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Layout
include Convertible

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module LiquidExtensions

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "jekyll/liquid_renderer/file"
require "jekyll/liquid_renderer/table"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class LiquidRenderer
class File

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class LiquidRenderer::Table
def initialize(stats)
@ -13,7 +15,7 @@ module Jekyll
private
def generate_table(data, widths)
str = "\n"
str = String.new("\n")
table_head = data.shift
str << generate_row(table_head, widths)
@ -28,7 +30,7 @@ module Jekyll
end
def generate_table_head_border(row_data, widths)
str = ""
str = String.new("")
row_data.each_index do |cell_index|
str << "-" * widths[cell_index]
@ -40,7 +42,7 @@ module Jekyll
end
def generate_row(row_data, widths)
str = ""
str = String.new("")
row_data.each_with_index do |cell_data, cell_index|
str << if cell_index.zero?

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class LogAdapter
attr_reader :writer, :messages

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Page
include Convertible

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Plugin
PRIORITIES = {

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class PluginManager
attr_reader :site

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Publisher
def initialize(site)

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
require "csv"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class CollectionReader
SPECIAL_COLLECTIONS = %w(posts data).freeze

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class DataReader
attr_reader :site, :content

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class LayoutReader
attr_reader :site

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class PageReader
attr_reader :site, :dir, :unfiltered_content

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class PostReader
attr_reader :site, :unfiltered_content

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class StaticFileReader
attr_reader :site, :dir, :unfiltered_content

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class ThemeAssetsReader
attr_reader :site

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Regenerator
attr_reader :site, :metadata, :cache

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class RelatedPosts
class << self

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
class Renderer

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
require "csv"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class StaticFile
attr_reader :relative_path, :extname, :name, :data

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Stevenson < ::Logger
def initialize

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Tags
class HighlightBlock < Liquid::Block

View File

@ -1,4 +1,5 @@
# encoding: UTF-8
# frozen_string_literal: true
module Jekyll
module Tags

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Tags
class Link < Liquid::Tag

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Tags
class PostComparer

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Theme
extend Forwardable

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Jekyll::ThemeBuilder
SCAFFOLD_DIRECTORIES = %w(
assets _layouts _includes _sass

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "addressable/uri"
# Public: Methods that generate a URL for a resource such as a Post or a Page.
@ -93,7 +95,7 @@ module Jekyll
def generate_url_from_drop(template)
template.gsub(%r!:([a-z_]+)!) do |match|
pool = possible_keys(match.sub(":".freeze, "".freeze))
pool = possible_keys(match.sub(":", ""))
winner = pool.find { |key| @placeholders.key?(key) }
if winner.nil?

View File

@ -1,4 +1,6 @@
# frozen_string_literal: true
module Jekyll
module Utils
extend self
@ -247,6 +249,8 @@ module Jekyll
#
# Returns the updated permalink template
def add_permalink_suffix(template, permalink_style)
template = template.dup
case permalink_style
when :pretty
template << "/"
@ -256,6 +260,7 @@ module Jekyll
template << "/" if permalink_style.to_s.end_with?("/")
template << ":output_ext" if permalink_style.to_s.end_with?(":output_ext")
end
template
end
@ -296,7 +301,7 @@ module Jekyll
def merged_file_read_opts(site, opts)
merged = (site ? site.file_read_opts : {}).merge(opts)
if merged["encoding"] && !merged["encoding"].start_with?("bom|")
merged["encoding"].insert(0, "bom|")
merged["encoding"] = "bom|#{merged["encoding"]}"
end
merged
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "open3"
module Jekyll

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Utils
module Platforms

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
module Utils
module WinTZ

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
VERSION = "3.5.1".freeze
end

View File

@ -1,2 +1,4 @@
# frozen_string_literal: true
source "https://rubygems.org"
gemspec

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
#############################################################################
#
# Packaging tasks for jekyll-docs

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
#############################################################################
#
# Packaging tasks

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
#############################################################################
#
# Site tasks - https://jekyllrb.com

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = "test-dependency-theme"
s.version = "0.1.0"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = "test-theme"
s.version = "0.1.0"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
$stdout.puts "# -------------------------------------------------------------"
$stdout.puts "# SPECS AND TESTS ARE RUNNING WITH WARNINGS OFF."
$stdout.puts "# SEE: https://github.com/Shopify/liquid/issues/730"

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "simplecov"
SimpleCov.profiles.define "gem" do

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Jekyll
class Dummy < Generator
priority :high

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "helper"
class TestAnsi < JekyllUnitTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "helper"
class TestCleaner < JekyllUnitTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "helper"
class TestCoffeeScript < JekyllUnitTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "helper"
class TestCollections < JekyllUnitTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "helper"
class TestCommand < JekyllUnitTest

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require "webrick"
require "mercenary"
require "helper"

Some files were not shown because too many files have changed in this diff Show More