From faf9029af1252211b521c3d3dea95f65879781af Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Wed, 23 Oct 2024 14:26:39 -0400 Subject: [PATCH] add fronzen string comment --- Appraisals | 2 ++ Gemfile | 2 ++ Rakefile | 2 ++ ancestry.gemspec | 2 ++ gemfiles/gemfile_52.gemfile | 1 + gemfiles/gemfile_60.gemfile | 1 + gemfiles/gemfile_61.gemfile | 1 + gemfiles/gemfile_70.gemfile | 1 + gemfiles/gemfile_71.gemfile | 1 + gemfiles/gemfile_72.gemfile | 1 + lib/ancestry.rb | 2 ++ lib/ancestry/class_methods.rb | 2 ++ lib/ancestry/exceptions.rb | 4 +++- lib/ancestry/has_ancestry.rb | 2 ++ lib/ancestry/instance_methods.rb | 2 ++ lib/ancestry/materialized_path.rb | 2 ++ lib/ancestry/materialized_path2.rb | 2 ++ lib/ancestry/materialized_path_pg.rb | 2 ++ lib/ancestry/version.rb | 2 ++ test/concerns/arrangement_test.rb | 2 ++ test/concerns/build_ancestry_test.rb | 2 ++ test/concerns/counter_cache_test.rb | 2 ++ test/concerns/db_test.rb | 2 ++ test/concerns/default_scopes_test.rb | 2 ++ test/concerns/depth_caching_test.rb | 2 ++ test/concerns/depth_constraints_test.rb | 2 ++ test/concerns/has_ancestry_test.rb | 2 ++ test/concerns/hooks_test.rb | 2 ++ test/concerns/integrity_checking_and_restoration_test.rb | 2 ++ test/concerns/materialized_path2_test.rb | 2 ++ test/concerns/materialized_path_test.rb | 2 ++ test/concerns/orphan_strategies_test.rb | 2 ++ test/concerns/relations_test.rb | 2 ++ test/concerns/scopes_test.rb | 2 ++ test/concerns/setter_test.rb | 2 ++ test/concerns/sort_by_ancestry_test.rb | 2 ++ test/concerns/sti_support_test.rb | 2 ++ test/concerns/touching_test.rb | 2 ++ test/concerns/tree_navigation_test.rb | 2 ++ test/concerns/tree_predicate_test.rb | 2 ++ test/environment.rb | 3 +++ test/test_helpers.rb | 2 ++ 42 files changed, 80 insertions(+), 1 deletion(-) diff --git a/Appraisals b/Appraisals index 2883b0b9..d6a967cc 100644 --- a/Appraisals +++ b/Appraisals @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # on a mac using: # bundle config --global build.mysql2 "--with-mysql-dir=$(brew --prefix mysql)" diff --git a/Gemfile b/Gemfile index aa081768..d68c3d03 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' gemspec diff --git a/Rakefile b/Rakefile index 72610ff3..acbde054 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'bundler/setup' require 'bundler/gem_tasks' require 'rake/testtask' diff --git a/ancestry.gemspec b/ancestry.gemspec index 3345d8ed..d2c9b880 100644 --- a/ancestry.gemspec +++ b/ancestry.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) require 'ancestry/version' diff --git a/gemfiles/gemfile_52.gemfile b/gemfiles/gemfile_52.gemfile index eb715511..2d658258 100644 --- a/gemfiles/gemfile_52.gemfile +++ b/gemfiles/gemfile_52.gemfile @@ -1,4 +1,5 @@ # This file was generated by Appraisal +# frozen_string_literal: true source "https://rubygems.org" diff --git a/gemfiles/gemfile_60.gemfile b/gemfiles/gemfile_60.gemfile index f0d662f0..b2e11095 100644 --- a/gemfiles/gemfile_60.gemfile +++ b/gemfiles/gemfile_60.gemfile @@ -1,4 +1,5 @@ # This file was generated by Appraisal +# frozen_string_literal: true source "https://rubygems.org" diff --git a/gemfiles/gemfile_61.gemfile b/gemfiles/gemfile_61.gemfile index 6a2913a1..539c700c 100644 --- a/gemfiles/gemfile_61.gemfile +++ b/gemfiles/gemfile_61.gemfile @@ -1,4 +1,5 @@ # This file was generated by Appraisal +# frozen_string_literal: true source "https://rubygems.org" diff --git a/gemfiles/gemfile_70.gemfile b/gemfiles/gemfile_70.gemfile index a938375d..89796880 100644 --- a/gemfiles/gemfile_70.gemfile +++ b/gemfiles/gemfile_70.gemfile @@ -1,4 +1,5 @@ # This file was generated by Appraisal +# frozen_string_literal: true source "https://rubygems.org" diff --git a/gemfiles/gemfile_71.gemfile b/gemfiles/gemfile_71.gemfile index b077766d..32caf094 100644 --- a/gemfiles/gemfile_71.gemfile +++ b/gemfiles/gemfile_71.gemfile @@ -1,4 +1,5 @@ # This file was generated by Appraisal +# frozen_string_literal: true source "https://rubygems.org" diff --git a/gemfiles/gemfile_72.gemfile b/gemfiles/gemfile_72.gemfile index 60890b37..c9d589eb 100644 --- a/gemfiles/gemfile_72.gemfile +++ b/gemfiles/gemfile_72.gemfile @@ -1,4 +1,5 @@ # This file was generated by Appraisal +# frozen_string_literal: true source "https://rubygems.org" diff --git a/lib/ancestry.rb b/lib/ancestry.rb index e5cd2c61..d71a59b9 100644 --- a/lib/ancestry.rb +++ b/lib/ancestry.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative 'ancestry/version' require_relative 'ancestry/class_methods' require_relative 'ancestry/instance_methods' diff --git a/lib/ancestry/class_methods.rb b/lib/ancestry/class_methods.rb index 4042d587..2033eaf4 100644 --- a/lib/ancestry/class_methods.rb +++ b/lib/ancestry/class_methods.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ancestry module ClassMethods # Fetch tree node if necessary diff --git a/lib/ancestry/exceptions.rb b/lib/ancestry/exceptions.rb index 9088d8e6..e2efd5d3 100644 --- a/lib/ancestry/exceptions.rb +++ b/lib/ancestry/exceptions.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + module Ancestry class AncestryException < RuntimeError end class AncestryIntegrityException < AncestryException end -end \ No newline at end of file +end diff --git a/lib/ancestry/has_ancestry.rb b/lib/ancestry/has_ancestry.rb index 8806cfce..b64013d1 100644 --- a/lib/ancestry/has_ancestry.rb +++ b/lib/ancestry/has_ancestry.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ancestry module HasAncestry def has_ancestry options = {} diff --git a/lib/ancestry/instance_methods.rb b/lib/ancestry/instance_methods.rb index 8d898093..8241a288 100644 --- a/lib/ancestry/instance_methods.rb +++ b/lib/ancestry/instance_methods.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ancestry module InstanceMethods # Validate that the ancestors don't include itself diff --git a/lib/ancestry/materialized_path.rb b/lib/ancestry/materialized_path.rb index d53854af..3bf864ae 100644 --- a/lib/ancestry/materialized_path.rb +++ b/lib/ancestry/materialized_path.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ancestry # store ancestry as grandparent_id/parent_id # root a=nil,id=1 children=id,id/% == 1, 1/% diff --git a/lib/ancestry/materialized_path2.rb b/lib/ancestry/materialized_path2.rb index 46887852..58874962 100644 --- a/lib/ancestry/materialized_path2.rb +++ b/lib/ancestry/materialized_path2.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ancestry # store ancestry as /grandparent_id/parent_id/ # root: a=/,id=1 children=#{a}#{id}/% == /1/% diff --git a/lib/ancestry/materialized_path_pg.rb b/lib/ancestry/materialized_path_pg.rb index 5cb35030..2fb7e6e8 100644 --- a/lib/ancestry/materialized_path_pg.rb +++ b/lib/ancestry/materialized_path_pg.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ancestry module MaterializedPathPg # Update descendants with new ancestry (after update) diff --git a/lib/ancestry/version.rb b/lib/ancestry/version.rb index 08fbe39a..3e757431 100644 --- a/lib/ancestry/version.rb +++ b/lib/ancestry/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Ancestry VERSION = '5.0.0' end diff --git a/test/concerns/arrangement_test.rb b/test/concerns/arrangement_test.rb index 8257334c..fb967160 100644 --- a/test/concerns/arrangement_test.rb +++ b/test/concerns/arrangement_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class ArrangementTest < ActiveSupport::TestCase diff --git a/test/concerns/build_ancestry_test.rb b/test/concerns/build_ancestry_test.rb index f1d14e81..62879438 100644 --- a/test/concerns/build_ancestry_test.rb +++ b/test/concerns/build_ancestry_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class BuildAncestryTest < ActiveSupport::TestCase diff --git a/test/concerns/counter_cache_test.rb b/test/concerns/counter_cache_test.rb index 2093332c..a32fc34c 100644 --- a/test/concerns/counter_cache_test.rb +++ b/test/concerns/counter_cache_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class CounterCacheTest < ActiveSupport::TestCase diff --git a/test/concerns/db_test.rb b/test/concerns/db_test.rb index fe2001c8..67878bd8 100644 --- a/test/concerns/db_test.rb +++ b/test/concerns/db_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class DbTest < ActiveSupport::TestCase diff --git a/test/concerns/default_scopes_test.rb b/test/concerns/default_scopes_test.rb index 4abfa383..965ed585 100644 --- a/test/concerns/default_scopes_test.rb +++ b/test/concerns/default_scopes_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class DefaultScopesTest < ActiveSupport::TestCase diff --git a/test/concerns/depth_caching_test.rb b/test/concerns/depth_caching_test.rb index 61a9158a..2519450f 100644 --- a/test/concerns/depth_caching_test.rb +++ b/test/concerns/depth_caching_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class DepthCachingTest < ActiveSupport::TestCase diff --git a/test/concerns/depth_constraints_test.rb b/test/concerns/depth_constraints_test.rb index 86912a5c..95a2c6b8 100644 --- a/test/concerns/depth_constraints_test.rb +++ b/test/concerns/depth_constraints_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class DepthConstraintsTest < ActiveSupport::TestCase diff --git a/test/concerns/has_ancestry_test.rb b/test/concerns/has_ancestry_test.rb index 01cc7e7f..2bd3bf47 100644 --- a/test/concerns/has_ancestry_test.rb +++ b/test/concerns/has_ancestry_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class HasAncestryTreeTest < ActiveSupport::TestCase diff --git a/test/concerns/hooks_test.rb b/test/concerns/hooks_test.rb index 465b6068..d16c50c9 100644 --- a/test/concerns/hooks_test.rb +++ b/test/concerns/hooks_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class ArrangementTest < ActiveSupport::TestCase diff --git a/test/concerns/integrity_checking_and_restoration_test.rb b/test/concerns/integrity_checking_and_restoration_test.rb index 2b8071f9..5586f21e 100644 --- a/test/concerns/integrity_checking_and_restoration_test.rb +++ b/test/concerns/integrity_checking_and_restoration_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class IntegrityCheckingAndRestaurationTest < ActiveSupport::TestCase diff --git a/test/concerns/materialized_path2_test.rb b/test/concerns/materialized_path2_test.rb index 83a1ce98..aa566267 100644 --- a/test/concerns/materialized_path2_test.rb +++ b/test/concerns/materialized_path2_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class MaterializedPath2Test < ActiveSupport::TestCase diff --git a/test/concerns/materialized_path_test.rb b/test/concerns/materialized_path_test.rb index 328f7d12..7179321a 100644 --- a/test/concerns/materialized_path_test.rb +++ b/test/concerns/materialized_path_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class MaterializedPathTest < ActiveSupport::TestCase diff --git a/test/concerns/orphan_strategies_test.rb b/test/concerns/orphan_strategies_test.rb index 19147681..73a31d88 100644 --- a/test/concerns/orphan_strategies_test.rb +++ b/test/concerns/orphan_strategies_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class OphanStrategiesTest < ActiveSupport::TestCase diff --git a/test/concerns/relations_test.rb b/test/concerns/relations_test.rb index 0aa3a8aa..30f3f891 100644 --- a/test/concerns/relations_test.rb +++ b/test/concerns/relations_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class RelationsTest < ActiveSupport::TestCase diff --git a/test/concerns/scopes_test.rb b/test/concerns/scopes_test.rb index 8efb7875..a765bafa 100644 --- a/test/concerns/scopes_test.rb +++ b/test/concerns/scopes_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' # all class nodes used to look up objects belong here diff --git a/test/concerns/setter_test.rb b/test/concerns/setter_test.rb index cc1e8479..adfccbb6 100644 --- a/test/concerns/setter_test.rb +++ b/test/concerns/setter_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class IntegrityCheckingAndRestaurationTest < ActiveSupport::TestCase diff --git a/test/concerns/sort_by_ancestry_test.rb b/test/concerns/sort_by_ancestry_test.rb index 768d2809..6124cc35 100644 --- a/test/concerns/sort_by_ancestry_test.rb +++ b/test/concerns/sort_by_ancestry_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class SortByAncestryTest < ActiveSupport::TestCase diff --git a/test/concerns/sti_support_test.rb b/test/concerns/sti_support_test.rb index 2911e81c..3b297820 100644 --- a/test/concerns/sti_support_test.rb +++ b/test/concerns/sti_support_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class StiSupportTest < ActiveSupport::TestCase diff --git a/test/concerns/touching_test.rb b/test/concerns/touching_test.rb index be18e746..4f2d121a 100644 --- a/test/concerns/touching_test.rb +++ b/test/concerns/touching_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class TouchingTest < ActiveSupport::TestCase diff --git a/test/concerns/tree_navigation_test.rb b/test/concerns/tree_navigation_test.rb index ad8b2afc..8539b09f 100644 --- a/test/concerns/tree_navigation_test.rb +++ b/test/concerns/tree_navigation_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' # this is testing attribute getters diff --git a/test/concerns/tree_predicate_test.rb b/test/concerns/tree_predicate_test.rb index c57d6304..d2502646 100644 --- a/test/concerns/tree_predicate_test.rb +++ b/test/concerns/tree_predicate_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative '../environment' class TreePredicateTest < ActiveSupport::TestCase diff --git a/test/environment.rb b/test/environment.rb index dc3e848e..ed1c58ca 100644 --- a/test/environment.rb +++ b/test/environment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rubygems' require 'bundler/setup' @@ -194,6 +196,7 @@ def self.materialized_path2? return @materialized_path2 if defined?(@materialized_path2) @materialized_path2 = (ENV["FORMAT"] == "materialized_path2") end + private def self.db_type diff --git a/test/test_helpers.rb b/test/test_helpers.rb index 61caee1c..74b9a405 100644 --- a/test/test_helpers.rb +++ b/test/test_helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module TestHelpers def assert_ancestry(node, value, child: :skip, db: :value) column_name = node.class.ancestry_column