From 0783f5b1b102046cc8dae23634e8ab27227a9def Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Mon, 25 Nov 2019 12:53:50 -0500 Subject: [PATCH] add magic comment for frozen string literals to all files related to #118 --- concourse/tasks/rake-test/run.sh | 2 ++ lib/loofah.rb | 1 + lib/loofah/elements.rb | 1 + lib/loofah/helpers.rb | 1 + lib/loofah/html/document.rb | 1 + lib/loofah/html/document_fragment.rb | 1 + lib/loofah/html5/libxml2_workarounds.rb | 1 + lib/loofah/html5/safelist.rb | 1 + lib/loofah/html5/scrub.rb | 1 + lib/loofah/instance_methods.rb | 1 + lib/loofah/metahelpers.rb | 1 + lib/loofah/scrubber.rb | 1 + lib/loofah/scrubbers.rb | 1 + lib/loofah/xml/document.rb | 1 + lib/loofah/xml/document_fragment.rb | 1 + 15 files changed, 16 insertions(+) diff --git a/concourse/tasks/rake-test/run.sh b/concourse/tasks/rake-test/run.sh index 8b751200..9dc1103e 100755 --- a/concourse/tasks/rake-test/run.sh +++ b/concourse/tasks/rake-test/run.sh @@ -4,7 +4,9 @@ set -e -x -u pushd loofah + # TODO: remove this once fefc629 (2019-11-25) is far enough in the past export RUBYOPT="--enable-frozen-string-literal --debug=frozen-string-literal" + bundle install bundle exec rake test diff --git a/lib/loofah.rb b/lib/loofah.rb index a25dbf9f..37338efd 100644 --- a/lib/loofah.rb +++ b/lib/loofah.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__))) require "nokogiri" diff --git a/lib/loofah/elements.rb b/lib/loofah/elements.rb index 6e76c660..abfbe33b 100644 --- a/lib/loofah/elements.rb +++ b/lib/loofah/elements.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'set' module Loofah diff --git a/lib/loofah/helpers.rb b/lib/loofah/helpers.rb index 4cdfa3a3..d8928ded 100644 --- a/lib/loofah/helpers.rb +++ b/lib/loofah/helpers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Loofah module Helpers class << self diff --git a/lib/loofah/html/document.rb b/lib/loofah/html/document.rb index 9eef099f..8b887e3e 100644 --- a/lib/loofah/html/document.rb +++ b/lib/loofah/html/document.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Loofah module HTML # :nodoc: # diff --git a/lib/loofah/html/document_fragment.rb b/lib/loofah/html/document_fragment.rb index 25f16b56..359dffc8 100644 --- a/lib/loofah/html/document_fragment.rb +++ b/lib/loofah/html/document_fragment.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Loofah module HTML # :nodoc: # diff --git a/lib/loofah/html5/libxml2_workarounds.rb b/lib/loofah/html5/libxml2_workarounds.rb index fc3fb244..a867cdd8 100644 --- a/lib/loofah/html5/libxml2_workarounds.rb +++ b/lib/loofah/html5/libxml2_workarounds.rb @@ -1,4 +1,5 @@ # coding: utf-8 +# frozen_string_literal: true require 'set' module Loofah diff --git a/lib/loofah/html5/safelist.rb b/lib/loofah/html5/safelist.rb index f9f423c7..f0a0dcbc 100644 --- a/lib/loofah/html5/safelist.rb +++ b/lib/loofah/html5/safelist.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "set" module Loofah diff --git a/lib/loofah/html5/scrub.rb b/lib/loofah/html5/scrub.rb index de4295e1..aff28009 100644 --- a/lib/loofah/html5/scrub.rb +++ b/lib/loofah/html5/scrub.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'cgi' require 'crass' diff --git a/lib/loofah/instance_methods.rb b/lib/loofah/instance_methods.rb index c6366425..1a3249d0 100644 --- a/lib/loofah/instance_methods.rb +++ b/lib/loofah/instance_methods.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Loofah # # Mixes +scrub!+ into Document, DocumentFragment, Node and NodeSet. diff --git a/lib/loofah/metahelpers.rb b/lib/loofah/metahelpers.rb index 9949c77f..5eac24fe 100644 --- a/lib/loofah/metahelpers.rb +++ b/lib/loofah/metahelpers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Loofah module MetaHelpers # :nodoc: def self.add_downcased_set_members_to_all_set_constants mojule diff --git a/lib/loofah/scrubber.rb b/lib/loofah/scrubber.rb index 1137d58b..962850ca 100644 --- a/lib/loofah/scrubber.rb +++ b/lib/loofah/scrubber.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Loofah # # A RuntimeError raised when Loofah could not find an appropriate scrubber. diff --git a/lib/loofah/scrubbers.rb b/lib/loofah/scrubbers.rb index c6cba196..cce2fa02 100644 --- a/lib/loofah/scrubbers.rb +++ b/lib/loofah/scrubbers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Loofah # # Loofah provides some built-in scrubbers for sanitizing with diff --git a/lib/loofah/xml/document.rb b/lib/loofah/xml/document.rb index bcc14389..9f00851f 100644 --- a/lib/loofah/xml/document.rb +++ b/lib/loofah/xml/document.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Loofah module XML # :nodoc: # diff --git a/lib/loofah/xml/document_fragment.rb b/lib/loofah/xml/document_fragment.rb index 113b6bab..56b76731 100644 --- a/lib/loofah/xml/document_fragment.rb +++ b/lib/loofah/xml/document_fragment.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Loofah module XML # :nodoc: #