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

@@ -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