From b5f55979182615a88a6556e5c30bc410bf9758d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Avic=20Simmons?= Date: Fri, 23 Oct 2026 08:47:22 -0400 Subject: [PATCH] docs: fix 9 typos in code comments and an error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comment typos across the parsers (then/than, contans, juse, lease, though, it's/its, VB8 -> VP8 in the WebP header table, matching the 'VP8 '/'VP8L'/'VP8X' values the code switches on), plus 'Literal to large' -> 'Literal too large' in a JSONParserError message that JSONParser rescues internally. Signed-off-by: Léon Avic Simmons --- lib/care.rb | 2 +- lib/parsers/exif_parser.rb | 2 +- lib/parsers/jpeg_parser.rb | 2 +- lib/parsers/json_parser/validator.rb | 4 ++-- lib/parsers/mpeg_parser.rb | 2 +- lib/parsers/webp_parser.rb | 4 ++-- lib/remote_io.rb | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/care.rb b/lib/care.rb index 584cc57b..06c20e0d 100644 --- a/lib/care.rb +++ b/lib/care.rb @@ -115,7 +115,7 @@ def byteslice(io, at, n_bytes) else # We only have one page # Optimize a little. If we only have one page that we need to read from # - which is likely going to be the case *often* we can avoid allocating - # a new string for the joined pages and juse use the only page + # a new string for the joined pages and just use the only page # directly as the slab. Since it might contain a `nil` and we do # not join (which casts nils to strings) we take care of that too relevant_pages.first || '' diff --git a/lib/parsers/exif_parser.rb b/lib/parsers/exif_parser.rb index a349ca73..af20dada 100644 --- a/lib/parsers/exif_parser.rb +++ b/lib/parsers/exif_parser.rb @@ -159,7 +159,7 @@ def method_missing(*a) # The EXIF tags get appended to the file, so the ones coming _later_ # are more specific and potentially overwrite the earlier ones. Walk # through the frames in reverse (starting with one that comes last) - # and if it contans the requisite EXIF property, return the value + # and if it contains the requisite EXIF property, return the value # from that tag. @multiple_exif_results.reverse_each do |exif_tag_frame| value_of = exif_tag_frame.public_send(*a) diff --git a/lib/parsers/jpeg_parser.rb b/lib/parsers/jpeg_parser.rb index 6ed93ad5..7102b2fd 100644 --- a/lib/parsers/jpeg_parser.rb +++ b/lib/parsers/jpeg_parser.rb @@ -46,7 +46,7 @@ def scan # ambiguously capture things like JPEGs embedded in ID3 # tags of MP3s - these _are_ JPEGs but we care much # more about the top-level "wrapper" file, not about - # it's bits and bobs + # its bits and bobs return unless safe_read(@buf, 2) == JPEG_SOI_MARKER_HEAD markers_start_at = @buf.pos diff --git a/lib/parsers/json_parser/validator.rb b/lib/parsers/json_parser/validator.rb index d57c9378..7a6a31c4 100644 --- a/lib/parsers/json_parser/validator.rb +++ b/lib/parsers/json_parser/validator.rb @@ -17,7 +17,7 @@ class JSONParserError < StandardError end MAX_SAMPLE_SIZE = 1024 - MAX_LITERAL_SIZE = 30 # much larger then necessary. + MAX_LITERAL_SIZE = 30 # much larger than necessary. ESCAPE_CHAR = "\\" WHITESPACE_CHARS = [" ", "\t", "\n", "\r"] ENDING_VALUE_CHARS = [",", "]", "}"] @@ -271,7 +271,7 @@ def start_literal(c) end def close_literal(c) - raise JSONParserError, "Literal to large at #{@pos}" if @current_literal_size > MAX_LITERAL_SIZE + raise JSONParserError, "Literal too large at #{@pos}" if @current_literal_size > MAX_LITERAL_SIZE if whitespace?(c) || ENDING_VALUE_CHARS.include?(c) end_node diff --git a/lib/parsers/mpeg_parser.rb b/lib/parsers/mpeg_parser.rb index a4043ced..03851f95 100644 --- a/lib/parsers/mpeg_parser.rb +++ b/lib/parsers/mpeg_parser.rb @@ -36,7 +36,7 @@ def self.likely_match?(filename) def self.call(io) return unless matches_mpeg_header?(io) - # We are looping though the stream because there can be several sequence headers and some of them are not useful. + # We are looping through the stream because there can be several sequence headers and some of them are not useful. # If we detect that the header is not useful, then we look for the next one for SEEK_FOR_SEQUENCE_HEADER_TIMES_LIMIT # If we reach the EOF, then the mpg is likely to be corrupted and we return nil MAX_BLOCK_READS.times do diff --git a/lib/parsers/webp_parser.rb b/lib/parsers/webp_parser.rb index 5177f42b..6e255b6f 100644 --- a/lib/parsers/webp_parser.rb +++ b/lib/parsers/webp_parser.rb @@ -28,8 +28,8 @@ def call(io) # 0...3 | "RIFF" (Since WebP is based on the RIFF file container format). # 4...7 | The size of the file in bytes - 8 bytes. # 8...11 | "WEBP" (To signify that this is a WebP file). - # 12...15 | The VB8 variant in use ("VB8 ", "VP8L" or "VB8X") - # 16...19 | The length of the VB8 data in bytes (i.e. The size of the file - 20 bytes). + # 12...15 | The VP8 variant in use ("VP8 ", "VP8L" or "VP8X") + # 16...19 | The length of the VP8 data in bytes (i.e. The size of the file - 20 bytes). riff, webp, variant = safe_read(@buf, 20).unpack('A4x4A4A4') return unless riff == 'RIFF' && webp == 'WEBP' read_data(variant) diff --git a/lib/remote_io.rb b/lib/remote_io.rb index a583acfa..a43c0f5c 100644 --- a/lib/remote_io.rb +++ b/lib/remote_io.rb @@ -155,7 +155,7 @@ def request_range(range, uri = @uri, headers = @headers.clone, redirects = REDIR # We return `nil` if we tried to read past the end of the IO, # which satisfies the Ruby IO convention. The caller should deal with `nil` being the result of a read() # S3 will also handily _not_ supply us with the Content-Range of the actual resource, so we - # cannot hint size with this response - at lease not when working with S3 + # cannot hint size with this response - at least not when working with S3 nil when Net::HTTPServerError Measurometer.increment_counter('format_parser.remote_io.upstream50x_errors', 1)