Skip to content

Commit

Permalink
Fix typos (#3166)
Browse files Browse the repository at this point in the history
**What problem is this PR intended to solve?**
Fix typos found via `codespell -S test,tmp,ports,coverage,googletest -L
te,reencode,ocur` and `typos --format brief`

**Have you included adequate test coverage?**
Existing tests are sufficient.

**Does this change affect the behavior of either the C or the Java
implementations?**
Nope.
  • Loading branch information
flavorjones committed Apr 10, 2024
2 parents b78cf63 + 59b98f3 commit 8222c46
Show file tree
Hide file tree
Showing 28 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2178,7 +2178,7 @@ Repackaging of 1.5.1 with a gemspec that is compatible with older Rubies. [#631,
* `XML::Node#namespace=` takes nil as a parameter
* `XML::Node#xpath` returns things other than `NodeSet` objects. [#208]
* `XSLT::StyleSheet#transform` accepts hashes for parameters. [#223]
* Psuedo selectors inside `not()` work. [#205]
* Pseudo selectors inside `not()` work. [#205]
* `XML::Builder` doesn't break when nodes are unlinked. [#228] (vihai)
* Encoding can be forced on the SAX parser. [#204] (Eugene Pimenov)
* `XML::DocumentFragment` uses `XML::Node#parse` to determine children.
Expand All @@ -2202,7 +2202,7 @@ Repackaging of 1.5.1 with a gemspec that is compatible with older Rubies. [#631,
* Added fragment support to `Node#add_child`, `Node#add_next_sibling`, `Node#add_previous_sibling`, and `Node#replace`.
* `XML::Node#previous_element` implemented
* Rubinius support
* Ths CSS selector engine now supports `:has()`
* The CSS selector engine now supports `:has()`
* `XML::NodeSet#filter()` was added
* `XML::Node.next=` and .previous= are aliases for add_next_sibling and add_previous_sibling. [#183]

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The Nokogiri Core Contributors take security very seriously and investigate all reported vulnerabilities.

If you would like to report a vulnerablity or have a security concern regarding Nokogiri or how Nokogiri is using any of its underlying platform-specific libraries (such as libxml2 or xerces), please [report it via HackerOne](https://hackerone.com/nokogiri/reports/new).
If you would like to report a vulnerability or have a security concern regarding Nokogiri or how Nokogiri is using any of its underlying platform-specific libraries (such as libxml2 or xerces), please [report it via HackerOne](https://hackerone.com/nokogiri/reports/new).

Your report will be acknowledged within 24 hours, and you'll receive a more detailed response within 72 hours indicating next steps in handling your report.

Expand Down
4 changes: 2 additions & 2 deletions ext/java/nokogiri/Html4Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Html4Document extends XmlDocument

private static final String DEFAULT_CONTENT_TYPE = "html";
private static final String DEFAULT_PUBLIC_ID = "-//W3C//DTD HTML 4.01//EN";
private static final String DEFAULT_SYTEM_ID = "http://www.w3.org/TR/html4/strict.dtd";
private static final String DEFAULT_SYSTEM_ID = "http://www.w3.org/TR/html4/strict.dtd";

private String parsed_encoding = null;

Expand Down Expand Up @@ -88,7 +88,7 @@ public class Html4Document extends XmlDocument
getDocument(),
context.getRuntime().newString(DEFAULT_CONTENT_TYPE),
context.getRuntime().newString(DEFAULT_PUBLIC_ID),
context.getRuntime().newString(DEFAULT_SYTEM_ID));
context.getRuntime().newString(DEFAULT_SYSTEM_ID));
setInternalSubset(internalSubset);
}

Expand Down
4 changes: 2 additions & 2 deletions ext/java/nokogiri/NokogiriService.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class NokogiriService implements BasicLibraryService
}

private static Map<String, RubyClass>
populateNokogiriClassCahce(Ruby ruby)
populateNokogiriClassCache(Ruby ruby)
{
Map<String, RubyClass> nokogiriClassCache = new HashMap<String, RubyClass>();
nokogiriClassCache.put("Nokogiri::HTML4::Document", (RubyClass)ruby.getClassFromPath("Nokogiri::HTML4::Document"));
Expand Down Expand Up @@ -91,7 +91,7 @@ public class NokogiriService implements BasicLibraryService
createDocuments(ruby, xmlModule, htmlModule, xmlNode);
createSaxModule(ruby, xmlSaxModule, htmlSaxModule);
createXsltModule(ruby, xsltModule);
nokogiri.setInternalVariable("cache", populateNokogiriClassCahce(ruby));
nokogiri.setInternalVariable("cache", populateNokogiriClassCache(ruby));
}

private void
Expand Down
4 changes: 2 additions & 2 deletions ext/java/nokogiri/XmlNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public class XmlNode extends RubyObject
* args but not for an exact number. Any extra args will then be
* passed to 'initialize'. The way 'new' and this 'init' function
* interact means that subclasses cannot arbitrarily change the
* require aruments by defining an 'initialize' method. This is
* require arguments by defining an 'initialize' method. This is
* how the C libxml wrapper works also.
*
* As written it performs initialization for a new Element with
Expand Down Expand Up @@ -407,7 +407,7 @@ public class XmlNode extends RubyObject
/**
* This method should be called after a node has been adopted in a new
* document. This method will ensure that the node is renamed with the
* appriopriate NS uri. First the prefix of the node is extracted, then is
* appropriate NS uri. First the prefix of the node is extracted, then is
* used to lookup the namespace uri in the new document starting at the
* current node and traversing the ancestors. If the namespace uri wasn't
* empty (or null) all children and the node has attributes and/or children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public Void call() throws Exception {

/**
* This method shouldn't be called unless the parser has finished parsing or
* threw an exception while doing so, otherwise, there'll be the protential
* threw an exception while doing so, otherwise, there'll be the potential
* that the read method will block indefinitely.
*/
@Override
Expand Down
6 changes: 3 additions & 3 deletions ext/java/nokogiri/internals/NokogiriDomParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class NokogiriDomParser extends DOMParser
{
dtd.reset();
if (xInclude) {
setEntityResolver(new NokogiriXInlcudeEntityResolver(source));
setEntityResolver(new NokogiriXIncludeEntityResolver(source));
}
super.parse(source);
Document doc = getDocument();
Expand All @@ -77,11 +77,11 @@ public class NokogiriDomParser extends DOMParser
doc.setUserData(XmlDocument.DTD_RAW_DOCUMENT, dtd.getDocument(), null);
}

private static class NokogiriXInlcudeEntityResolver implements org.xml.sax.EntityResolver
private static class NokogiriXIncludeEntityResolver implements org.xml.sax.EntityResolver
{
InputSource source;
private
NokogiriXInlcudeEntityResolver(InputSource source)
NokogiriXIncludeEntityResolver(InputSource source)
{
this.source = source;
}
Expand Down
4 changes: 2 additions & 2 deletions ext/java/nokogiri/internals/ParserContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ public static class Options
}

/*
public static class NokogiriXInlcudeEntityResolver implements org.xml.sax.EntityResolver {
public static class NokogiriXIncludeEntityResolver implements org.xml.sax.EntityResolver {
InputSource source;
public NokogiriXInlcudeEntityResolver(InputSource source) {
public NokogiriXIncludeEntityResolver(InputSource source) {
this.source = source;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/java/nokogiri/internals/c14n/Canonicalizer11.java
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ static class XmlsStackElement
// that from the input buffer else if the input buffer consists
// only of ".." and if the output buffer does not contain only
// the root slash "/", then move the ".." to the output buffer
// else delte it.; otherwise,
// else delete it.; otherwise,
} else if (input.equals(".")) {
input = "";
printStep("2D", output, input);
Expand Down
2 changes: 1 addition & 1 deletion ext/java/nokogiri/internals/c14n/CanonicalizerBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi
//private Set<Node> xpathNodeSet;
/**
* The node to be skipped/excluded from the DOM tree
* in subtree canonicalizations.
* in subtree canonicalization.
*/
private Node excludeNode;
private OutputStream writer = new ByteArrayOutputStream();
Expand Down
8 changes: 4 additions & 4 deletions ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public class NameSpaceSymbTable
initialMap.put(XMLNS, ne);
}

/**The map betwen prefix-> entry table. */
/**The map between prefix-> entry table. */
private SymbMap symb;

/**The stacks for removing the definitions when doing pop.*/
private List<SymbMap> level;
private boolean cloned = true;

/**
* Default constractor
* Default constructor
**/
public
NameSpaceSymbTable()
Expand Down Expand Up @@ -173,14 +173,14 @@ public class NameSpaceSymbTable
symb.put(prefix, entry);
entry.rendered = true;
entry.lastrendered = entry.uri;
// Return the node for outputing.
// Return the node for outputting.
return entry.n;
}

/**
* Gets a definition without mark it as render.
* For render in exclusive c14n the namespaces in the include prefixes.
* @param prefix The prefix whose definition is neaded.
* @param prefix The prefix whose definition is needed.
* @return the attr to render, null if there is no need to render
**/
public Attr
Expand Down
10 changes: 5 additions & 5 deletions ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public class DOM2DTM extends DTMDefaultBaseIterators
// sequence. The lastTextNode value will be set to the last node in the
// contiguous sequence, and -- AFTER the DTM addNode -- can be used to
// advance next over this whole block. Should be simpler than special-casing
// the above loop for "Was the logically-preceeding sibling a text node".
// the above loop for "Was the logically-preceding sibling a text node".
//
// Finally, a DTM node should be considered a CDATASection only if all the
// contiguous text it covers is CDATASections. The first Text should
Expand Down Expand Up @@ -1188,7 +1188,7 @@ else if (PROCESSING_INSTRUCTION_NODE == nexttype) {
getNodeValue(int nodeHandle)
{
// The _type(nodeHandle) call was taking the lion's share of our
// time, and was wrong anyway since it wasn't coverting handle to
// time, and was wrong anyway since it wasn't converting handle to
// identity. Inlined it.
int type = _exptype(makeNodeIdentity(nodeHandle));
type = (NULL != type) ? getNodeType(nodeHandle) : NULL;
Expand Down Expand Up @@ -1436,7 +1436,7 @@ else if (PROCESSING_INSTRUCTION_NODE == nexttype) {
/** Bind an IncrementalSAXSource to this DTM. NOT RELEVANT for DOM2DTM, since
* we're wrapped around an existing DOM.
*
* @param source The IncrementalSAXSource that we want to recieve events from
* @param source The IncrementalSAXSource that we want to receive events from
* on demand.
*/
public void
Expand All @@ -1450,7 +1450,7 @@ else if (PROCESSING_INSTRUCTION_NODE == nexttype) {
*
* @return null if this model doesn't respond to SAX events,
* "this" if the DTM object has a built-in SAX ContentHandler,
* the IncrmentalSAXSource if we're bound to one and should receive
* the IncrementalSAXSource if we're bound to one and should receive
* the SAX stream via it for incremental build purposes...
* */
public org.xml.sax.ContentHandler
Expand All @@ -1462,7 +1462,7 @@ else if (PROCESSING_INSTRUCTION_NODE == nexttype) {
/**
* Return this DTM's lexical handler.
*
* %REVIEW% Should this return null if constrution already done/begun?
* %REVIEW% Should this return null if construction already done/begun?
*
* @return null if this model doesn't respond to lexical SAX events,
* "this" if the DTM object has a built-in SAX ContentHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) {
* <code>Node</code> references returned by the implementation reference
* the same object. When two <code>Node</code> references are references
* to the same object, even if through a proxy, the references may be
* used completely interchangably, such that all attributes have the
* used completely interchangeably, such that all attributes have the
* same values and calling the same DOM method on either reference
* always has exactly the same effect.
* @param other The node to test against.
Expand Down Expand Up @@ -688,7 +688,7 @@ else if (!getBaseURI().equals(((NodeImpl) arg).getBaseURI())) {
public String
getTextContent() throws DOMException
{
return getNodeValue(); // overriden in some subclasses
return getNodeValue(); // overridden in some subclasses
}

/**
Expand Down
4 changes: 2 additions & 2 deletions ext/nokogiri/html4_element_description.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ implied_start_tag_eh(VALUE self)
* call-seq:
* name
*
* Get the tag name for this ElemementDescription
* Get the tag name for this ElementDescription
*/
static VALUE
name(VALUE self)
Expand All @@ -261,7 +261,7 @@ name(VALUE self)
* call-seq:
* [](tag_name)
*
* Get ElemementDescription for +tag_name+
* Get ElementDescription for +tag_name+
*/
static VALUE
get_description(VALUE klass, VALUE tag_name)
Expand Down
4 changes: 2 additions & 2 deletions gumbo-parser/src/nokogiri_gumbo.h
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ extern const GumboOptions kGumboDefaultOptions;
*/
typedef enum {
/**
* Indicates that parsing completed successfuly. The resulting tree
* Indicates that parsing completed successfully. The resulting tree
* will be a complete document.
*/
GUMBO_STATUS_OK,
Expand Down Expand Up @@ -841,7 +841,7 @@ typedef struct GumboInternalOutput {
GumboVector /* GumboError */ errors;

/**
* True if the parser encounted an error.
* True if the parser encountered an error.
*
* This can be true and `errors` an empty `GumboVector` if the `max_errors`
* option was set to 0.
Expand Down
2 changes: 1 addition & 1 deletion gumbo-parser/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -4513,7 +4513,7 @@ static void handle_in_foreign_content(GumboParser* parser, GumboToken* token) {
if (i == 0)
return;
// We can't call handle_token directly because the current node is still in
// a foriegn namespace, so it would re-enter this and result in infinite
// a foreign namespace, so it would re-enter this and result in infinite
// recursion.
handle_html_content(parser, token);
}
Expand Down
2 changes: 1 addition & 1 deletion gumbo-parser/src/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ static void reset_token_start_point(GumboTokenizerState* tokenizer) {

// Sets the tag buffer original text and start point to the current iterator
// position. This is necessary because attribute names & values may have
// whitespace preceeding them, and so we can't assume that the actual token
// whitespace preceding them, and so we can't assume that the actual token
// starting point was the end of the last tag buffer usage.
static void reset_tag_buffer_start_point(GumboParser* parser) {
GumboTokenizerState* tokenizer = parser->_tokenizer_state;
Expand Down
2 changes: 1 addition & 1 deletion lib/nokogiri/css/parser_extras.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def cache_on?
!Thread.current[CACHE_SWITCH_NAME]
end

# Set a thread-local boolean to turn cacheing on and off. Truthy values turn the cache on, falsey values turn the cache off.
# Set a thread-local boolean to turn caching on and off. Truthy values turn the cache on, falsey values turn the cache off.
def set_cache(value) # rubocop:disable Naming/AccessorMethodName
Thread.current[CACHE_SWITCH_NAME] = !value
end
Expand Down
2 changes: 1 addition & 1 deletion lib/nokogiri/xml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module XML
class << self
###
# Parse an XML document using the Nokogiri::XML::Reader API. See
# Nokogiri::XML::Reader for mor information
# Nokogiri::XML::Reader for more information
def Reader(string_or_io, url = nil, encoding = nil, options = ParseOptions::STRICT)
options = Nokogiri::XML::ParseOptions.new(options) if Integer === options
yield options if block_given?
Expand Down
2 changes: 1 addition & 1 deletion lib/nokogiri/xml/node_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def reverse
end

###
# Return a nicely formated string representation
# Return a nicely formatted string representation
def inspect
"[#{map(&:inspect).join(", ")}]"
end
Expand Down
2 changes: 1 addition & 1 deletion test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def initialize_nokogiri_test_gc_level
GC.compact
rescue NotImplementedError
@@gc_level = "normal"
warn("#{__FILE__}:#{__LINE__}: GC compaction not suppport by platform")
warn("#{__FILE__}:#{__LINE__}: GC compaction not supported by platform")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/html4/sax/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_parse_file_nil_argument
end
end

def test_parse_file_non_existant
def test_parse_file_non_existent
assert_raises(Errno::ENOENT) do
@parser.parse_file("there_is_no_reasonable_way_this_file_exists")
end
Expand Down
4 changes: 2 additions & 2 deletions test/html4/test_comments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class TestComment < Nokogiri::TestCase
# https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-opened-comment
#
# This error occurs if the parser encounters the "<!" code point
# sequence that is not immidiately followed by two U+002D (-)
# sequence that is not immediately followed by two U+002D (-)
# code points and that is not the start of a DOCTYPE or a CDATA
# section. All content that follows the "<!" code point sequence
# up to a U+003E (>) code point (if present) or to the end of
Expand Down Expand Up @@ -248,7 +248,7 @@ class TestComment < Nokogiri::TestCase
#
# This error occurs if the parser encounters a nested comment
# (e.g., <!-- <!-- nested --> -->). Such a comment will be
# closed by the first occuring "-->" code point sequence and
# closed by the first occurring "-->" code point sequence and
# everything that follows will be treated as markup.
describe "nested comment" do
let(:html) { "<html><body><div id=under-test><!-- outer <!-- inner --><div id=do-i-exist></div>--></div></body></html>" }
Expand Down
2 changes: 1 addition & 1 deletion test/html4/test_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def test_GH_1042
table = html.xpath("//table")[1]
trs = table.xpath("tr").drop(1)

# the jruby inplementation of drop uses dup() on the IRubyObject (which
# the jruby implementation of drop uses dup() on the IRubyObject (which
# is NOT the same dup() method on the ruby Object) which produces a
# shallow clone. a shallow of valid XMLNode triggers several
# NullPointerException on inspect() since loads of invariants
Expand Down
2 changes: 1 addition & 1 deletion test/test_gem_platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TestGemPlatform < Nokogiri::TestCase
# [1]: https://arstechnica.com/gadgets/2020/06/this-is-apples-roadmap-for-moving-the-first-macs-away-from-intel/
#
# There seems to be a lot of uncertainty right now, so I'm writing
# some tests to express my expectations, and we're gonig to
# some tests to express my expectations, and we're going to
# conservatively use `x86_64-darwin` as the platform name for the
# native gem.
let(:darwin_gem_platform) { Gem::Platform.new("x86_64-darwin") }
Expand Down
2 changes: 1 addition & 1 deletion test/xml/test_entity_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def setup
end
assert_equal(expected, doc.errors.map(&:to_s))
end
# TODO: can we retreive a resource pointing to localhost when NONET is set to true ?
# TODO: can we retrieve a resource pointing to localhost when NONET is set to true ?
end

class TestSaxEntityReference < Nokogiri::SAX::TestCase
Expand Down
2 changes: 1 addition & 1 deletion test/xml/test_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ def test_serialize_with_block
assert_equal(xml.serialize(nil, conf), string)
end

def test_hold_refence_to_subnode
def test_hold_reference_to_subnode
doc = Nokogiri::XML(<<~XML)
<root>
<a>
Expand Down

0 comments on commit 8222c46

Please sign in to comment.