From 5e34a6787b91e97218b6b0c89cd1ae05484a93be Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Thu, 18 Apr 2024 17:24:46 +0800 Subject: [PATCH] Fix typos Found via `typos --format brief` --- guides/how_sprockets_works.md | 2 +- guides/source_maps.md | 2 +- lib/sprockets/asset.rb | 2 +- lib/sprockets/compressing.rb | 2 +- lib/sprockets/loader.rb | 2 +- lib/sprockets/path_dependency_utils.rb | 2 +- lib/sprockets/utils/gzip.rb | 4 ++-- test/test_asset.rb | 2 +- test/test_caching.rb | 2 +- test/test_dependency.rb | 2 +- test/test_environment.rb | 2 +- test/test_performance.rb | 16 ++++++++-------- test/test_server.rb | 2 +- test/test_uri_utils.rb | 4 ++-- 14 files changed, 23 insertions(+), 23 deletions(-) diff --git a/guides/how_sprockets_works.md b/guides/how_sprockets_works.md index f830adc79..95d9f2520 100644 --- a/guides/how_sprockets_works.md +++ b/guides/how_sprockets_works.md @@ -377,7 +377,7 @@ class NpmDirectiveProcessor < Sprockets::DirectiveProcessor pipeline: :self, load_paths: dirs ) - @dependecies.merge(deps) + @dependencies.merge(deps) @required << uri end end diff --git a/guides/source_maps.md b/guides/source_maps.md index e85f32253..8e220571a 100644 --- a/guides/source_maps.md +++ b/guides/source_maps.md @@ -302,7 +302,7 @@ digit.to_s(2) # or "000000" ``` -Whe then generate a `vl` by shifting the digit with the default value of `shift` which is 0 +When then generate a `vl` by shifting the digit with the default value of `shift` which is 0 ``` vlq += digit << shift diff --git a/lib/sprockets/asset.rb b/lib/sprockets/asset.rb index 439ebca54..cafd1f3fc 100644 --- a/lib/sprockets/asset.rb +++ b/lib/sprockets/asset.rb @@ -97,7 +97,7 @@ def source if @source @source else - # File is read everytime to avoid memory bloat of large binary files + # File is read every time to avoid memory bloat of large binary files File.binread(filename) end end diff --git a/lib/sprockets/compressing.rb b/lib/sprockets/compressing.rb index e4e0a40b0..e209f9878 100644 --- a/lib/sprockets/compressing.rb +++ b/lib/sprockets/compressing.rb @@ -106,7 +106,7 @@ def skip_gzip? # # environment.gzip = false # - # To enable set to a truthy value. By default zlib wil + # To enable set to a truthy value. By default zlib will # be used to gzip assets. If you have the Zopfli gem # installed you can specify the zopfli algorithm to be used # instead: diff --git a/lib/sprockets/loader.rb b/lib/sprockets/loader.rb index 5bd9b3598..85af08175 100644 --- a/lib/sprockets/loader.rb +++ b/lib/sprockets/loader.rb @@ -179,7 +179,7 @@ def load_from_unloaded(unloaded) processors_dep_uri = build_processors_uri(type, file_type, pipeline) dependencies = config[:dependencies] + [processors_dep_uri] - # Read into memory and process if theres a processor pipeline + # Read into memory and process if there's a processor pipeline if processors.any? result = call_processors(processors, { environment: self, diff --git a/lib/sprockets/path_dependency_utils.rb b/lib/sprockets/path_dependency_utils.rb index 138b14b31..2cab1e27d 100644 --- a/lib/sprockets/path_dependency_utils.rb +++ b/lib/sprockets/path_dependency_utils.rb @@ -18,7 +18,7 @@ module Sprockets # The returned dependency set can be passed to resolve_dependencies(deps) # to check if the returned result is still fresh. In this case, entry always # returns a single path, but multiple calls should accumulate dependencies - # into a single set thats saved off and checked later. + # into a single set that's saved off and checked later. # # resolve_dependencies(deps) # # => "\x01\x02\x03" diff --git a/lib/sprockets/utils/gzip.rb b/lib/sprockets/utils/gzip.rb index 3fd5228a6..478e35a63 100644 --- a/lib/sprockets/utils/gzip.rb +++ b/lib/sprockets/utils/gzip.rb @@ -49,7 +49,7 @@ def initialize(asset, archiver: ZlibArchiver) # What non-text mime types should we compress? This list comes from: # https://www.fastly.com/blog/new-gzip-settings-and-deciding-what-compress - COMPRESSABLE_MIME_TYPES = { + COMPRESSIBLE_MIME_TYPES = { "application/vnd.ms-fontobject" => true, "application/x-font-opentype" => true, "application/x-font-ttf" => true, @@ -71,7 +71,7 @@ def can_compress? # can be compressed. # # We also check against our list of non-text compressible mime types - @charset || COMPRESSABLE_MIME_TYPES.include?(@content_type) + @charset || COMPRESSIBLE_MIME_TYPES.include?(@content_type) end # Private: Opposite of `can_compress?`. diff --git a/test/test_asset.rb b/test/test_asset.rb index 6725e019f..bf0b31eec 100644 --- a/test/test_asset.rb +++ b/test/test_asset.rb @@ -1123,7 +1123,7 @@ def setup asset("project.js").digest_path end - test "multiple charset defintions are stripped from css bundle" do + test "multiple charset definitions are stripped from css bundle" do assert_equal "\n.foo {}\n\n.bar {}\n\n\n", asset("charset.css").to_s end diff --git a/test/test_caching.rb b/test/test_caching.rb index bc0818a18..2a324a69a 100644 --- a/test/test_caching.rb +++ b/test/test_caching.rb @@ -468,7 +468,7 @@ def has_relative_value?(elem) end - test "no absolute paths are retuned from cache" do + test "no absolute paths are returned from cache" do env1 = Sprockets::Environment.new(fixture_path('default')) do |env| env.append_path(".") env.cache = @cache diff --git a/test/test_dependency.rb b/test/test_dependency.rb index a94ac54ee..9df560dee 100644 --- a/test/test_dependency.rb +++ b/test/test_dependency.rb @@ -14,6 +14,6 @@ def teardown def test_env_dependency assert_equal @env.resolve_dependency('env:DEPENDENCY_TEST_VALUE'), 'Hello' - assert_nil @env.resolve_dependency('env:NONEXISTANT_DEPENDENCY_TEST_VALUE') + assert_nil @env.resolve_dependency('env:NONEXISTENT_DEPENDENCY_TEST_VALUE') end end diff --git a/test/test_environment.rb b/test/test_environment.rb index 08d5205ad..296e9e518 100644 --- a/test/test_environment.rb +++ b/test/test_environment.rb @@ -818,7 +818,7 @@ def setup end end - test "bundled asset cached if theres an error building it" do + test "bundled asset cached if there's an error building it" do @env.cache = nil filename = File.join(fixture_path("default"), "tmp.coffee") diff --git a/test/test_performance.rb b/test/test_performance.rb index 7950462da..1e1f2ffbd 100644 --- a/test/test_performance.rb +++ b/test/test_performance.rb @@ -23,13 +23,13 @@ def exist?(filename) end end -$dir_entires_calls = nil +$dir_entries_calls = nil class << Dir alias_method :original_entries, :entries def entries(dirname, **args) - if $dir_entires_calls - $dir_entires_calls[dirname.to_s] ||= [] - $dir_entires_calls[dirname.to_s] << caller + if $dir_entries_calls + $dir_entries_calls[dirname.to_s] ||= [] + $dir_entries_calls[dirname.to_s] << caller end original_entries(dirname, **args) end @@ -61,7 +61,7 @@ def setup def teardown $file_stat_calls = nil - $dir_entires_calls = nil + $dir_entries_calls = nil $processor_calls = nil $bundle_processor_calls = nil $cache_get_calls = nil @@ -463,7 +463,7 @@ def new_environment(path = fixture_path('default')) def reset_stats! $file_stat_calls = {} $file_exist_calls = {} - $dir_entires_calls = {} + $dir_entries_calls = {} $processor_calls = {} $bundle_processor_calls = {} $cache_get_calls = {} @@ -475,7 +475,7 @@ def assert_no_stat_calls assert_equal 0, callers.size, "File.stat(#{path.inspect}) called #{callers.size} times\n\n#{format_callers(callers)}" end - $dir_entires_calls.each do |path, callers| + $dir_entries_calls.each do |path, callers| assert_equal 0, callers.size, "Dir.entries(#{path.inspect}) called #{callers.size} times\n\n#{format_callers(callers)}" end end @@ -489,7 +489,7 @@ def assert_no_redundant_stat_calls assert_equal 1, callers.size, "File.exist?(#{path.inspect}) called #{callers.size} times\n\n#{format_callers(callers)}" end - $dir_entires_calls.each do |path, callers| + $dir_entries_calls.each do |path, callers| assert_equal 1, callers.size, "Dir.entries(#{path.inspect}) called #{callers.size} times\n\n#{format_callers(callers)}" end diff --git a/test/test_server.rb b/test/test_server.rb index f6689a209..d82d0b114 100644 --- a/test/test_server.rb +++ b/test/test_server.rb @@ -211,7 +211,7 @@ def app assert_equal 404, last_response.status end - test "if sources didnt change the server shouldnt rebundle" do + test "if sources didn't change the server shouldn't rebundle" do get "/assets/application.js" asset_before = @env["application.js"] assert asset_before diff --git a/test/test_uri_utils.rb b/test/test_uri_utils.rb index 8a9f7dbfc..395320aeb 100644 --- a/test/test_uri_utils.rb +++ b/test/test_uri_utils.rb @@ -123,7 +123,7 @@ def test_parse_query_params parse_asset_uri("file:///usr/local/var/github/app/assets/views/users.html?type=text/html;%20charset=utf-8") end - def test_asset_uri_raise_erorr_when_invalid_uri_scheme + def test_asset_uri_raise_error_when_invalid_uri_scheme assert_raises URI::InvalidURIError do parse_asset_uri("http:///usr/local/var/github/app/assets/javascripts/application.js") end @@ -183,7 +183,7 @@ def test_build_file_digest_uri end end - def test_file_digest_raise_erorr_when_invalid_uri_scheme + def test_file_digest_raise_error_when_invalid_uri_scheme assert_raises URI::InvalidURIError do parse_file_digest_uri("http:///usr/local/var/github/app/assets/javascripts/application.js") end