Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 0 additions & 51 deletions tools/code_format/check_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import argparse
import common
import difflib
import functools
import multiprocessing
import os
Expand Down Expand Up @@ -85,21 +84,6 @@
"./source/server/admin/prometheus_stats.cc", "./tools/clang_tools/api_booster/main.cc",
"./tools/clang_tools/api_booster/proto_cxx_utils.cc", "./source/common/common/version.cc")

# These triples (file1, file2, diff) represent two files, file1 and file2 that should maintain
# the diff diff. This is meant to keep these two files in sync.
CODEC_DIFFS = (("./source/common/http/http1/codec_impl.h",
"./source/common/http/http1/codec_impl_legacy.h",
"./tools/code_format/codec_diffs/http1_codec_impl_h"),
("./source/common/http/http1/codec_impl.cc",
"./source/common/http/http1/codec_impl_legacy.cc",
"./tools/code_format/codec_diffs/http1_codec_impl_cc"),
("./source/common/http/http2/codec_impl.h",
"./source/common/http/http2/codec_impl_legacy.h",
"./tools/code_format/codec_diffs/http2_codec_impl_h"),
("./source/common/http/http2/codec_impl.cc",
"./source/common/http/http2/codec_impl_legacy.cc",
"./tools/code_format/codec_diffs/http2_codec_impl_cc"))

# Only one C++ file should instantiate grpc_init
GRPC_INIT_ALLOWLIST = ("./source/common/grpc/google_grpc_context.cc")

Expand Down Expand Up @@ -548,38 +532,6 @@ def fixSourceLine(line, line_number):
return line


def codecDiffHelper(file1, file2, diff):
f1 = readLines(file1)
f2 = readLines(file2)

# Create diff between two files
code_diff = list(difflib.unified_diff(f1, f2, lineterm=""))
# Compare with golden diff.
golden_diff = readLines(diff)
# It is fairly ugly to diff a diff, so return a warning to sync codec changes
# and/or update golden_diff.
if code_diff != golden_diff:
error_message = "Codecs are not synced: %s does not match %s. Update codec implementations to sync and/or update the diff manually to:\n%s" % (
file1, file2, '\n'.join(code_diff))
# The following line will write the diff to the file diff if it does not match.
# Do not uncomment unless you know the change is safe!
# new_diff = pathlib.Path(diff)
#new_diff.open('w')
# new_diff.write_text('\n'.join(code_diff), encoding='utf-8')
return error_message


def checkCodecDiffs(error_messages):
try:
for triple in CODEC_DIFFS:
codec_diff = codecDiffHelper(*triple)
if codec_diff != None:
error_messages.append(codecDiffHelper(*triple))
return error_messages
except IOError: # for check format tests
return error_messages


# We want to look for a call to condvar.waitFor, but there's no strong pattern
# to the variable name of the condvar. If we just look for ".waitFor" we'll also
# pick up time_system_.waitFor(...), and we don't want to return true for that
Expand Down Expand Up @@ -1096,9 +1048,6 @@ def ownedDirectories(error_messages):
error_messages = []
owned_directories = ownedDirectories(error_messages)

# Check codec synchronization once per run.
checkCodecDiffs(error_messages)

if os.path.isfile(target_path):
error_messages += checkFormat("./" + target_path)
else:
Expand Down
35 changes: 0 additions & 35 deletions tools/code_format/codec_diffs/http1_codec_impl_cc

This file was deleted.

130 changes: 0 additions & 130 deletions tools/code_format/codec_diffs/http1_codec_impl_h

This file was deleted.

34 changes: 0 additions & 34 deletions tools/code_format/codec_diffs/http2_codec_impl_cc

This file was deleted.

77 changes: 0 additions & 77 deletions tools/code_format/codec_diffs/http2_codec_impl_h

This file was deleted.