Skip to content

Commit

Permalink
Fix minor typos (protocolbuffers#17682)
Browse files Browse the repository at this point in the history
Just thought I'd contribute some typo fixes that keep tripping up CI/CD checks in my projects. Nothing controversial (hopefully), just 174 simple fixes.

Use the following command to get a quick and dirty summary of the specific corrections made:
```shell
git diff HEAD^! --word-diff-regex='\w+' -U0 \
  | grep -E '\[\-.*\-\]\{\+.*\+\}' \
  | sed -r 's/.*\[\-(.*)\-\]\{\+(.*)\+\}.*/\1 \2/' \
  | sort | uniq -c | sort -n
```

FWIW, the top typos are:
* trimed → trimmed (37)
* substract → subtract (7)
* qualifed → qualified (7)
* extesion → extension (6)
* mising → missing (5)
* btye → byte (4)
* likey → likely (4)
* candicate → candidate (3)
* decriptor → descriptor (3)
* inherting → inheriting (3)
* colletion → collection (3)
* caluclated → calculated (3)
* unititialized → uninitialized (3)
* implemting → implementing (3)
* binrary → binary (3)
* descripor → descriptor (3)
* negitive → negative (3)

Closes protocolbuffers#17682

COPYBARA_INTEGRATE_REVIEW=protocolbuffers#17682 from NathanBaulch:typos d41762d
PiperOrigin-RevId: 677074418
  • Loading branch information
NathanBaulch authored and copybara-github committed Sep 21, 2024
1 parent d829ca0 commit e4cbc79
Show file tree
Hide file tree
Showing 81 changed files with 167 additions and 167 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ruby_runtime("system_ruby")

register_toolchains("@system_ruby//:toolchain")

# Follwing are just needed to run conformance tests, not really needed to support them via MODULE.bazel
# Following are just needed to run conformance tests, not really needed to support them via MODULE.bazel

# For testing runtime against old gencode from a previous major version.
http_archive(
Expand Down
2 changes: 1 addition & 1 deletion bazel/private/upb_proto_library_internal/aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def upb_proto_aspect_impl(
`cc_info` field. The aspect will ensure that each compilation action can compile and link
against this provider's cc_info for all proto_library() deps.
dep_cc_provider: For aspects that depend on other aspects, this is the provider of the aspect
that we depend on. The aspect wil be able to include the header files from this provider.
that we depend on. The aspect will be able to include the header files from this provider.
file_provider: A provider that this aspect will attach to the target to expose the source
files generated by this aspect. These files are primarily useful for returning in
DefaultInfo(), so users who build the upb_*proto_library() rule directly can view the
Expand Down
4 changes: 2 additions & 2 deletions conformance/ConformanceJava.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void writeLittleEndianIntToStdout(int val) throws Exception {
}

private enum BinaryDecoderType {
BTYE_STRING_DECODER,
BYTE_STRING_DECODER,
BYTE_ARRAY_DECODER,
ARRAY_BYTE_BUFFER_DECODER,
READONLY_ARRAY_BYTE_BUFFER_DECODER,
Expand All @@ -84,7 +84,7 @@ public T decode(
ByteString bytes, BinaryDecoderType type, Parser<T> parser, ExtensionRegistry extensions)
throws InvalidProtocolBufferException {
switch (type) {
case BTYE_STRING_DECODER:
case BYTE_STRING_DECODER:
case BYTE_ARRAY_DECODER:
return parser.parseFrom(bytes, extensions);
case ARRAY_BYTE_BUFFER_DECODER:
Expand Down
4 changes: 2 additions & 2 deletions conformance/ConformanceJavaLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void writeLittleEndianIntToStdout(int val) throws Exception {
}

private enum BinaryDecoderType {
BTYE_STRING_DECODER,
BYTE_STRING_DECODER,
BYTE_ARRAY_DECODER,
ARRAY_BYTE_BUFFER_DECODER,
READONLY_ARRAY_BYTE_BUFFER_DECODER,
Expand All @@ -84,7 +84,7 @@ public T decode(
ExtensionRegistryLite extensions)
throws InvalidProtocolBufferException {
switch (type) {
case BTYE_STRING_DECODER:
case BYTE_STRING_DECODER:
case BYTE_ARRAY_DECODER:
return parser.parseFrom(bytes, extensions);
case ARRAY_BYTE_BUFFER_DECODER:
Expand Down
2 changes: 1 addition & 1 deletion conformance/conformance_test_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void UsageError() {
" output files.\n\n");
fprintf(stderr, " --test <test_name> Only run\n");
fprintf(stderr,
" the specified test. Mulitple tests\n"
" the specified test. Multiple tests\n"
" can be specified by repeating the \n"
" flag.\n\n");
fprintf(stderr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private static void AssertIsDeprecated(MemberInfo member)
}

[Test]
public void TestDepreatedPrimitiveValue()
public void TestDeprecatedPrimitiveValue()
{
AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty("DeprecatedInt32"));
}
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private static void AssertIsDeprecated(MemberInfo member)
}

[Test]
public void TestDepreatedPrimitiveValue() =>
public void TestDeprecatedPrimitiveValue() =>
AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty(nameof(TestDeprecatedFields.DeprecatedInt32)));

[Test]
Expand Down
4 changes: 2 additions & 2 deletions csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ internal MethodDescriptor(MethodDescriptorProto proto, FileDescriptor file,
internal void CrossLink()
{
IDescriptor lookup = File.DescriptorPool.LookupSymbol(Proto.InputType, this);
if (lookup is not MessageDescriptor inpoutType)
if (lookup is not MessageDescriptor inputType)
{
throw new DescriptorValidationException(this, "\"" + Proto.InputType + "\" is not a message type.");
}
InputType = inpoutType;
InputType = inputType;

lookup = File.DescriptorPool.LookupSymbol(Proto.OutputType, this);
if (lookup is not MessageDescriptor outputType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ public static final class Output extends OutputStream {
// Implementation note.
// The public methods of this class must be synchronized. ByteStrings
// are guaranteed to be immutable. Without some sort of locking, it could
// be possible for one thread to call toByteSring(), while another thread
// be possible for one thread to call toByteString(), while another thread
// is still modifying the underlying byte array.

private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ public static int computeUInt32SizeNoTag(final int value) {
This code is ported from the C++ varint implementation.
Implementation notes:
To calcuate varint size, we want to count the number of 7 bit chunks required. Rather than using
To calculate varint size, we want to count the number of 7 bit chunks required. Rather than using
division by 7 to accomplish this, we use multiplication by 9/64. This has a number of important
properties:
* It's roughly 1/7.111111. This makes the 0 bits set case have the same value as the 7 bits set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ public T parsePartialFrom(
throws InvalidProtocolBufferException {
T result = instance.newMutableInstance();
try {
// TODO: Try to make input with type CodedInpuStream.ArrayDecoder use
// TODO: Try to make input with type CodedInputStream.ArrayDecoder use
// fast path.
Schema<T> schema = Protobuf.getInstance().schemaFor(result);
schema.mergeFrom(result, CodedInputStreamReader.forCodedInput(input), extensionRegistry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private static String versionString(int major, int minor, int patch, String suff

private static boolean checkDisabled() {
// Check the environmental variable, and temporarily disable validation if it's set to true.
String disableFlag = java.lang.System.getenv("TEMORARILY_DISABLE_PROTOBUF_VERSION_CHECK");
String disableFlag = java.lang.System.getenv("TEMPORARILY_DISABLE_PROTOBUF_VERSION_CHECK");
if ((disableFlag != null && disableFlag.equals("true"))) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ private static void testEncodingOfString(OutputType outputType, char c, int leng
Coder coder = outputType.newCoder(testAllTypes.getSerializedSize());
testAllTypes.writeTo(coder.stream());
coder.stream().flush();
assertWithMessage("OuputType: " + outputType)
assertWithMessage("OutputType: " + outputType)
.that(fullString)
.isEqualTo(TestAllTypes.parseFrom(coder.toByteArray()).getOptionalString());
}
Expand Down
6 changes: 3 additions & 3 deletions java/core/src/test/java/com/google/protobuf/MessageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public void testBuildNestedPartial() throws Exception {
}

@Test
public void testParseUnititialized() throws Exception {
public void testParseUninitialized() throws Exception {
try {
TestRequired.parseFrom(ByteString.EMPTY);
assertWithMessage("Should have thrown an exception.").fail();
Expand All @@ -254,7 +254,7 @@ public void testParseUnititialized() throws Exception {
}

@Test
public void testParseNestedUnititialized() throws Exception {
public void testParseNestedUninitialized() throws Exception {
ByteString data =
TestRequiredForeign.newBuilder()
.setOptionalMessage(TEST_REQUIRED_UNINITIALIZED)
Expand Down Expand Up @@ -301,7 +301,7 @@ public void testDynamicBuildPartial() throws Exception {
}

@Test
public void testDynamicParseUnititialized() throws Exception {
public void testDynamicParseUninitialized() throws Exception {
try {
Descriptors.Descriptor descriptor = TestRequired.getDescriptor();
DynamicMessage.parseFrom(descriptor, ByteString.EMPTY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void versionValidation_olderRuntimeVersionDisallowed() {
}

@Test
public void versionValidation_differentVesionSuffixDisallowed() {
public void versionValidation_differentVersionSuffixDisallowed() {
String gencodeSuffix = "-test";
RuntimeVersion.ProtobufRuntimeVersionException thrown =
assertThrows(
Expand Down
2 changes: 1 addition & 1 deletion java/test/linkage-monitor-check-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</description>
<properties>
<!--
This verison is ok to kept old. Linkage Monitor overrides this
This version is ok to kept old. Linkage Monitor overrides this
version when checking linakage errors
-->
<protobuf.version>3.23.2</protobuf.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void testUnion_usingVarArgs() throws Exception {
}

@Test
public void testSubstract() throws Exception {
public void testSubtract() throws Exception {
// Only test a simple case here and expect
// {@link FieldMaskTreeTest#testRemoveFieldPath} to cover all scenarios.
FieldMask mask1 = FieldMaskUtil.fromString("foo,bar.baz,bar.quz");
Expand All @@ -234,7 +234,7 @@ public void testSubstract() throws Exception {
}

@Test
public void testSubstract_usingVarArgs() throws Exception {
public void testSubtract_usingVarArgs() throws Exception {
FieldMask mask1 = FieldMaskUtil.fromString("foo,bar.baz,bar.quz.bar");
FieldMask mask2 = FieldMaskUtil.fromString("foo.bar,bar.baz.quz");
FieldMask mask3 = FieldMaskUtil.fromString("bar.quz");
Expand Down
6 changes: 3 additions & 3 deletions objectivec/DevTools/pddm.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,8 @@ def TryAppend(self, line, line_num):
self.Append(line)
return (True, False)

def BindMacroCollection(self, macro_colletion):
if not macro_colletion:
def BindMacroCollection(self, macro_collection):
if not macro_collection:
return
if self._import_resolver is None:
raise PDDMError('Got an IMPORT-DEFINES without a resolver (line %d):'
Expand All @@ -541,7 +541,7 @@ def BindMacroCollection(self, macro_colletion):
imported_src_file = SourceFile(imported_file, self._import_resolver)
imported_src_file._ParseFile()
for section in imported_src_file._sections:
section.BindMacroCollection(macro_colletion)
section.BindMacroCollection(macro_collection)
except PDDMError as e:
raise PDDMError('%s\n...while importing defines:\n'
' Line %d: %s' %
Expand Down
2 changes: 1 addition & 1 deletion objectivec/GPBAny.pbobjc.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion objectivec/GPBDescriptor.m
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ - (instancetype)initWithExtensionDescription:(GPBExtensionDescription *)desc
@"Internal error: If a MessageSet extension is set, the data type must be a message.");
NSAssert((desc->options & GPBExtensionRepeated) == 0,
@"Internal Error: MessageSet extension can't be repeated.");
// NOTE: Could also check that the exteneded class is a MessageSet, but that would force the
// NOTE: Could also check that the extended class is a MessageSet, but that would force the
// ObjC runtime to start up that class and that isn't desirable here.
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion objectivec/GPBDuration.pbobjc.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion objectivec/GPBMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ CF_EXTERN_C_END

/**
* Merges in the data from an `GPBUnknownFields`, meaning the data from the unknown fields gets
* re-parsed so any known fields will be propertly set.
* re-parsed so any known fields will be properly set.
*
* If the intent is to *replace* the message's unknown fields, call `-clearUnknownFields` first.
*
Expand Down
2 changes: 1 addition & 1 deletion objectivec/GPBTimestamp.pbobjc.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion objectivec/Tests/GPBCodedInputStreamTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ - (void)testBytesToEndGroup {
[self assertReadByteToEndGroupFails:bytes(35, 25, 0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56,
0x34)]; // truncated fixed64

// Mising end group
// Missing end group
[self assertReadByteToEndGroupFails:bytes(35)];
[self assertReadByteToEndGroupFails:bytes(35, 8, 1)];
[self assertReadByteToEndGroupFails:bytes(35, 43)];
Expand Down
2 changes: 1 addition & 1 deletion objectivec/Tests/GPBCodedOutputStreamTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ - (void)testCFStringGetCStringPtrAndStringsWithNullChars {
// This test exists to verify that CFStrings with embedded NULLs still expose
// their raw buffer if they are backed by UTF8 storage. If this fails, the
// quick/direct access paths in GPBCodedOutputStream that depend on
// CFStringGetCStringPtr need to be re-evalutated (maybe just removed).
// CFStringGetCStringPtr need to be re-evaluated (maybe just removed).
// And yes, we do get NULLs in strings from some servers.

char zeroTest[] = "\0Test\0String";
Expand Down
12 changes: 6 additions & 6 deletions objectivec/Tests/GPBMessageTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1735,14 +1735,14 @@ - (void)testCopyWithAutocreatedExtension {
// Mutable copy shouldn't copy autocreated extensions.
TestAllExtensions *message = [TestAllExtensions message];
GPBExtensionDescriptor *optionalGroupExtension = [UnittestRoot optionalGroupExtension];
GPBExtensionDescriptor *optionalNestedMessageExtesion =
GPBExtensionDescriptor *optionalNestedMessageExtension =
[UnittestRoot optionalNestedMessageExtension];
TestAllTypes_OptionalGroup *optionalGroup = [message getExtension:optionalGroupExtension];
optionalGroup.a = 42;
XCTAssertNotNil(optionalGroup);
XCTAssertNotNil([message getExtension:optionalNestedMessageExtesion]);
XCTAssertNotNil([message getExtension:optionalNestedMessageExtension]);
XCTAssertTrue([message hasExtension:optionalGroupExtension]);
XCTAssertFalse([message hasExtension:optionalNestedMessageExtesion]);
XCTAssertFalse([message hasExtension:optionalNestedMessageExtension]);

TestAllExtensions *message2 = [[message copy] autorelease];

Expand All @@ -1754,11 +1754,11 @@ - (void)testCopyWithAutocreatedExtension {
XCTAssertNotEqual([message getExtension:optionalGroupExtension],
[message2 getExtension:optionalGroupExtension]);

XCTAssertFalse([message2 hasExtension:optionalNestedMessageExtesion]);
XCTAssertFalse([message2 hasExtension:optionalNestedMessageExtension]);
// Intentionally doing a pointer comparison (auto creation should be
// different)
XCTAssertNotEqual([message getExtension:optionalNestedMessageExtesion],
[message2 getExtension:optionalNestedMessageExtesion]);
XCTAssertNotEqual([message getExtension:optionalNestedMessageExtension],
[message2 getExtension:optionalNestedMessageExtension]);
}

- (void)testClearMessageAutocreatedExtension {
Expand Down
2 changes: 1 addition & 1 deletion objectivec/Tests/GPBUnknownFieldSetTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ - (void)testParsingNestingGroupData {
0x34)
error:NULL]); // truncated fixed64

// Mising end group
// Missing end group
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35) error:NULL]);
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 8, 1) error:NULL]);
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 43) error:NULL]);
Expand Down
2 changes: 1 addition & 1 deletion objectivec/Tests/GPBUnknownFieldsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ - (void)testParsingNestingGroupData {
0x34)
error:NULL]); // truncated fixed64

// Mising end group
// Missing end group
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35) error:NULL]);
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 8, 1) error:NULL]);
XCTAssertNil([TestEmptyMessage parseFromData:DataFromBytes(35, 43) error:NULL]);
Expand Down
2 changes: 1 addition & 1 deletion objectivec/Tests/unittest_objc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ message BoolOnlyMessage {
// of #imports. Within the WKTs, references to each other are just path
// based imports, but when reference from another proto file, they should be
// conditional to support the framework import style.
message WKTRefereceMessage {
message WKTReferenceMessage {
optional google.protobuf.Any an_any = 1;
}

Expand Down
14 changes: 7 additions & 7 deletions php/src/Google/Protobuf/Internal/AnyBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public function unpack()
throw new \Exception(
"Type url needs to be type.googleapis.com/fully-qulified");
}
$fully_qualifed_name =
$fully_qualified_name =
substr($this->type_url, $url_prifix_len);

// Create message according to fully qualified name.
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByProtoName($fully_qualifed_name);
$desc = $pool->getDescriptorByProtoName($fully_qualified_name);
if (is_null($desc)) {
throw new \Exception("Class ".$fully_qualifed_name
throw new \Exception("Class ".$fully_qualified_name
." hasn't been added to descriptor pool");
}
$klass = $desc->getClass();
Expand Down Expand Up @@ -66,8 +66,8 @@ public function pack($msg)
// Set type url.
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName(get_class($msg));
$fully_qualifed_name = $desc->getFullName();
$this->type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualifed_name;
$fully_qualified_name = $desc->getFullName();
$this->type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualified_name;
}

/**
Expand All @@ -79,8 +79,8 @@ public function is($klass)
{
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
$desc = $pool->getDescriptorByClassName($klass);
$fully_qualifed_name = $desc->getFullName();
$type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualifed_name;
$fully_qualified_name = $desc->getFullName();
$type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualified_name;
return $this->type_url === $type_url;
}
}
2 changes: 1 addition & 1 deletion php/tests/GeneratedClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ public function testMessagesAndEnumsWithPhpNamespace()
$this->assertSame(TestNamespace\NestedEnum::ZERO, $m->getNestedEnum());
}

public function testMesssagesAndEnumsWithEmptyPhpNamespace()
public function testMessagesAndEnumsWithEmptyPhpNamespace()
{
$m = new TestEmptyNamespace();
$n = new TestEmptyNamespace\NestedMessage();
Expand Down
Loading

0 comments on commit e4cbc79

Please sign in to comment.