Skip to content

Commit

Permalink
add spell check tool (#662)
Browse files Browse the repository at this point in the history
* add spell check tool

* add spell check tool

* add skipped files from third_party and move spelling check tool to tools/spelling

* add skip files

* move check location

* move check location
  • Loading branch information
TAOXUY authored Jul 31, 2019
1 parent b8cd21c commit f87cabe
Show file tree
Hide file tree
Showing 28 changed files with 160 additions and 44 deletions.
2 changes: 1 addition & 1 deletion script/e2e-kube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ if [[ ("${ESP_ROLLOUT_STRATEGY}" == "managed") && ("${BACKEND}" == "bookstore")
# Here wait for 200 seconds.
for l in {1..20}
do
echo "Wait for the new config to propogate: ${l}"
echo "Wait for the new config to propagate: ${l}"
check_http_service "${HOST}/shelves" 200
sleep 10
done
Expand Down
2 changes: 1 addition & 1 deletion script/presubmits
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function build_and_test() {
}

# For now, asan doesn't work for "t" tests Nginx has some global memory not freed,
# TODO: find a way to supress these memory leaks from Nginx.
# TODO: find a way to suppress these memory leaks from Nginx.
function test_asan() {
local message='Running asan unit-tests, integration tests & NGINX tests'
local error='Asan Unit, Integration, NGINX, start_esp tests failed'
Expand Down
2 changes: 1 addition & 1 deletion script/release-qualify
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function count_stress_failures() {

RQ_TESTS+=(${DIR})

# the ! -path ... exludes the root directory which is otherwise
# the ! -path ... excludes the root directory which is otherwise
# included in the result
done 3< <(find "${LOGS}/${SHA}" ! -path "${LOGS}/${SHA}" -type f -name 'long-run-test*.log')

Expand Down
4 changes: 4 additions & 0 deletions script/robot-style
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. ${ROOT}/script/all-utilities || { echo "Cannot load Bash utilities" ; exit 1 ; }



CLANG_FORMAT="$(which clang-format-7)"

pushd ${ROOT} > /dev/null
Expand All @@ -44,4 +46,6 @@ if [[ "${#CHANGED_FILES}" -ne 0 ]]; then
exit 1
fi

. ${ROOT}/tools/spelling/check_spelling.sh check || { echo "Find spelling error" ; exit 1 ; }

popd
2 changes: 1 addition & 1 deletion script/validate_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
gflags.DEFINE_boolean(
'detail',
False,
'Prints detailled output.'
'Prints detailed output.'
)

class Error(Exception):
Expand Down
2 changes: 1 addition & 1 deletion src/api_manager/auth/lib/json_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace auth {
// Gets given JSON property by key name.
const grpc_json *GetProperty(const grpc_json *json, const char *key);

// Gets the primitive value of the json with given path, seperated by ".".
// Gets the primitive value of the json with given path, separated by ".".
bool GetPrimitiveFieldValue(const std::string &json,
const std::string &payload_path,
std::string *payload_value);
Expand Down
8 changes: 4 additions & 4 deletions src/api_manager/auth/service_account_token.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ServiceAccountToken {
return access_token_.is_valid(duration);
}

// JWT token calcualted from client auth secret are audience dependent.
// JWT token calculated from client auth secret are audience dependent.
enum JWT_TOKEN_TYPE {
JWT_TOKEN_FOR_SERVICE_CONTROL = 0,
JWT_TOKEN_FOR_CLOUD_TRACING,
Expand All @@ -87,13 +87,13 @@ class ServiceAccountToken {
const std::string& GetAuthToken() const { return access_token_.token(); }

// Gets the auth token to access Google services.
// If client auth secret is specified, use it to calcualte JWT token.
// If client auth secret is specified, use it to calculate JWT token.
// Otherwise, use the access token fetched from metadata server.
const std::string& GetAuthToken(JWT_TOKEN_TYPE type);

// Gets the auth token to access Google services. This method accepts an
// audience parameter to set when generating JWT token.
// If client auth secret is specified, use it to calcualte JWT token.
// If client auth secret is specified, use it to calculate JWT token.
// Otherwise, use the access token fetched from metadata server.
const std::string& GetAuthToken(JWT_TOKEN_TYPE type,
const std::string& audience);
Expand Down Expand Up @@ -146,7 +146,7 @@ class ServiceAccountToken {
// The client auth secret which can be used to generate JWT auth token.
std::string client_auth_secret_;

// JWT tokens calcualted from client auth secrect.
// JWT tokens calculated from client auth secrect.
JwtTokenInfo jwt_tokens_[JWT_TOKEN_TYPE_MAX];

// GCE service account access token fetched from GCE metadata server.
Expand Down
4 changes: 2 additions & 2 deletions src/api_manager/check_security_rules_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class CheckSecurityRulesTest : public ::testing::Test {
std::string ruleset_test_url_;
};

// Cache first miss then hit. In this case, "yes" is cached on miss and returnd
// Cache first miss then hit. In this case, "yes" is cached on miss and returned
// on hit.
TEST_F(CheckSecurityRulesTest, CheckAuthzCacheMissThenHitPositive) {
std::string service_config = std::string(kServiceName) + kProducerProjectId +
Expand Down Expand Up @@ -419,7 +419,7 @@ TEST_F(CheckSecurityRulesTest, CheckAuthzCacheMissThenHitPositive) {
});
}

// Cache first miss then hit. In this case, "no" is cached on miss and returnd
// Cache first miss then hit. In this case, "no" is cached on miss and returned
// on hit.
TEST_F(CheckSecurityRulesTest, CheckAuthzCacheMissThenHitNegative) {
std::string service_config = std::string(kServiceName) + kProducerProjectId +
Expand Down
18 changes: 9 additions & 9 deletions src/api_manager/config_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ TEST_F(ConfigManagerServiceNameConfigIdTest, RepeatedTrigger) {
}

TEST_F(ConfigManagerServiceNameConfigIdTest, RolloutMultipleServiceConfig) {
std::function<void(HTTPRequest * req)> hanlder = [this](HTTPRequest* req) {
std::function<void(HTTPRequest * req)> handler = [this](HTTPRequest* req) {
std::map<std::string, std::string> data = {
{"https://servicemanagement.googleapis.com/v1/services/"
"service_name_from_metadata/configs/2017-05-01r0",
Expand All @@ -412,8 +412,8 @@ TEST_F(ConfigManagerServiceNameConfigIdTest, RolloutMultipleServiceConfig) {
req->url());
req->OnComplete(Status::OK, {}, kRolloutsResponseMultipleServiceConfig);
}))
.WillOnce(Invoke(hanlder))
.WillOnce(Invoke(hanlder));
.WillOnce(Invoke(handler))
.WillOnce(Invoke(handler));

int sequence = 0;

Expand Down Expand Up @@ -442,7 +442,7 @@ TEST_F(ConfigManagerServiceNameConfigIdTest, RolloutMultipleServiceConfig) {

TEST_F(ConfigManagerServiceNameConfigIdTest,
RolloutMultipleServiceConfigPartiallyFailedThenSucceededNextTimerEvent) {
std::function<void(HTTPRequest * req)> first_hanlder =
std::function<void(HTTPRequest * req)> first_handler =
[this](HTTPRequest* req) {
std::map<std::string, std::string> data = {
{"https://servicemanagement.googleapis.com/v1/services/"
Expand All @@ -456,7 +456,7 @@ TEST_F(ConfigManagerServiceNameConfigIdTest,
}
};

std::function<void(HTTPRequest * req)> second_hanlder =
std::function<void(HTTPRequest * req)> second_handler =
[this](HTTPRequest* req) {
std::map<std::string, std::string> data = {
{"https://servicemanagement.googleapis.com/v1/services/"
Expand All @@ -481,17 +481,17 @@ TEST_F(ConfigManagerServiceNameConfigIdTest,
req->url());
req->OnComplete(Status::OK, {}, kRolloutsResponseMultipleServiceConfig);
}))
.WillOnce(Invoke(first_hanlder))
.WillOnce(Invoke(first_hanlder))
.WillOnce(Invoke(first_handler))
.WillOnce(Invoke(first_handler))
.WillOnce(Invoke([this](HTTPRequest* req) {
EXPECT_EQ(
"https://servicemanagement.googleapis.com/v1/services/"
"service_name_from_metadata/rollouts?filter=status=SUCCESS",
req->url());
req->OnComplete(Status::OK, {}, kRolloutsResponseMultipleServiceConfig);
}))
.WillOnce(Invoke(second_hanlder))
.WillOnce(Invoke(second_hanlder));
.WillOnce(Invoke(second_handler))
.WillOnce(Invoke(second_handler));

int sequence = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/api_manager/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -681,11 +681,11 @@ TEST(Config, RpcMethodsWithHttpRulesAndVariableBindings) {
rules {
selector: "Bookstore.CreateBook"
parameters {
name: "system_paramter"
name: "system_parameter"
url_query_parameter: "sys"
}
parameters {
name: "system_paramter"
name: "system_parameter"
url_query_parameter: "system"
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/api_manager/firebase_rules/firebase_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ Status FirebaseRequest::CheckFuncCallArgs(const FunctionCall &func) {
if (std::string(func.args(1).string_value()).empty()) {
return Status(
Code::INVALID_ARGUMENT,
func.function() + " argument 2 [HTTP METHOD] cannot be emtpy");
func.function() + " argument 2 [HTTP METHOD] cannot be empty");
}

return Status::OK;
Expand Down
4 changes: 2 additions & 2 deletions src/api_manager/firebase_rules/firebase_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct HttpRequest {

// A FirebaseRequest object understands the various http requests that need
// to be generated as a part of the TestRuleset request and response cycle.
// Here is the intented use of this code:
// Here is the intended use of this code:
// FirebaseRequest request(...);
// while(!request.is_done()) {
// std::string url, method, body;
Expand Down Expand Up @@ -179,7 +179,7 @@ class FirebaseRequest {
// defined HTTP endpoint. If next_request points to firebase_http_request_,
// upon receiving a response, UpdateResponse will convert the response to
// TestRulesetResponse and process the response. If next_request_ points
// to external_http_request_, then the reponse provided via UpdateResponse
// to external_http_request_, then the response provided via UpdateResponse
// is converted into a protobuf::Value. This value is initialized to nullptr
// and will be nullptr once is_done_ is set to true.
HttpRequest *next_request_;
Expand Down
4 changes: 2 additions & 2 deletions src/api_manager/http_template.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class Parser {
void PostProcessVariables() {
for (auto &var : variables_) {
if (var.has_wildcard_path) {
// if the variable contains a '**', store the end_positon
// if the variable contains a '**', store the end_position
// relative to the end, such that -1 corresponds to the end
// of the path. As we only support fixed path after '**',
// this will allow the matcher code to reconstruct the variable
Expand All @@ -337,7 +337,7 @@ class Parser {

if (!verb_.empty()) {
// a custom verb will add an additional segment, so
// the end_postion needs a -1
// the end_position needs a -1
--var.end_segment;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/api_manager/proto/server_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ message ServerConfig {
// The attributes from the metadata server
MetadataAttributes metadata_attributes = 15;

// The overriden compute platform to be reported.
// The overridden compute platform to be reported.
string compute_platform_override = 16;

// The SSL credential for gRPC backend.
Expand Down
2 changes: 1 addition & 1 deletion src/api_manager/service_control/aggregated.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class Aggregated : public Interface {
template <class ResponseType>
void HandleResponse(const ResponseType& response);

// the sevice config.
// the service config.
const ::google::api::Service* service_;
// the server config.
const proto::ServerConfig* server_config_;
Expand Down
2 changes: 1 addition & 1 deletion src/api_manager/service_control/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct CheckRequestInfo : public OperationInfo {
std::string ios_bundle_id;
};

// Stores the information substracted from the check response.
// Stores the information subtracted from the check response.
struct CheckResponseInfo {
// If the request have a valid api key.
bool is_api_key_valid;
Expand Down
2 changes: 1 addition & 1 deletion src/grpc/message_serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bool GrpcMessageSerializer::NextInternal(const unsigned char** data,
messages_.front().first->data.raw.slice_buffer.count) {
// The current buffer has been consumed, destroy it if needed
if (messages_.front().second) {
// Destroy it if the ownership was transfered to GrpcMessageSerializer
// Destroy it if the ownership was transferred to GrpcMessageSerializer
grpc_byte_buffer_destroy(messages_.front().first);
}
messages_.pop_front();
Expand Down
2 changes: 1 addition & 1 deletion src/nginx/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ bool ngx_esp_parse_message_from_json(const std::string &json,

// Reads server config from a string. Returns true if successful, otherwise
// returns false.
// NOTE: This is similiar to ReadConfigFromString() in
// NOTE: This is similar to ReadConfigFromString() in
// src/api_manager/config.cc. We are repeating it here to avoid additional
// dependencies. If there are more utilities like this to be duplicated,
// we should think of a place for utilities that are common for
Expand Down
2 changes: 1 addition & 1 deletion src/nginx/http.cc
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ Status initialize_request(ngx_pool_t *request_pool,

// The main and server configuration contexts we use are from the HTTP module.
// The local configuration context is built from scratch at our module
// initialization and is roughly equivelent in function to an empty location
// initialization and is roughly equivalent in function to an empty location
// configuration block.
r->main_conf = http_cctx->main_conf;
r->srv_conf = http_cctx->srv_conf;
Expand Down
2 changes: 1 addition & 1 deletion src/nginx/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ ngx_uint_t ngx_esp_count_active_connections(ngx_cycle_t *cycle) {

// Attempts to shut down ESP, returns true if ESP is ready to exit.
bool ngx_esp_attempt_shutdown(ngx_cycle_t *cycle) {
// The states ESP needs to go throught before it is ready to exit:
// The states ESP needs to go thought before it is ready to exit:
// 1) Waits all current requests to be done before closing ESP service
// control. This wait should not be long since when exit_handler
// is called, all listen ports have been closed.
Expand Down
2 changes: 1 addition & 1 deletion src/nginx/request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ::google::api_manager::protocol::Protocol NgxEspRequest::GetBackendProtocol() {
}

std::string NgxEspRequest::GetClientIP() {
// use remote_addr varaible to get client_ip.
// use remote_addr variable to get client_ip.
ngx_esp_main_conf_t *mc = reinterpret_cast<ngx_esp_main_conf_t *>(
ngx_http_get_module_main_conf(r_, ngx_esp_module));
if (mc->remote_addr_variable_index != NGX_ERROR) {
Expand Down
2 changes: 1 addition & 1 deletion src/nginx/zero_copy_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class NgxRequestZeroCopyInputStream

private:
// Advances to the next buffer. Returns true if successful; otherwise returns
// false (if no buffer is available or if an error occured).
// false (if no buffer is available or if an error occurred).
bool NextBuffer();

// The request
Expand Down
2 changes: 1 addition & 1 deletion start_esp/start_esp.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ def make_argparser():
# The server_config dir to save server configs
parser.add_argument('--server_config_dir',
default=SERVER_CONF_DIR,
help='''Sets the folder for writting server config file.
help='''Sets the folder for writing server config file.
The server config file is passed to ESP in Nginx config.
If you are using your own nginx config,
please be sure its server_config path matches this one.
Expand Down
12 changes: 6 additions & 6 deletions start_esp/trusted-ca-certificates.crt
Original file line number Diff line number Diff line change
Expand Up @@ -6067,8 +6067,8 @@ BDNEJkpEBx9zoINBKeCSBrzVAer+vK9x6yAfCl0NoClezuRBUVWWwx+0MaWj81Pq/8KchnLPNkxW
WgYyfl6rSqHOp+ufpIwquSSLuLXzBk2myn2Z+/ZV6q5Iee4mWdMfDFMV92JR+YQNlmxesQjmWQgr
JikKwYNAcw==
-----END CERTIFICATE-----
# Issuer: C=BR, O=ICP-Brasil, OU=Instituto Nacional de Tecnologia da Informacao - ITI, CN=Autoridade Certificadora Raiz Brasileira v1
# Subject: C=BR, O=ICP-Brasil, OU=Instituto Nacional de Tecnologia da Informacao - ITI, CN=Autoridade Certificadora Raiz Brasileira v1
# Issuer: C=BR, O=ICP-Brasil, OU=Institution Nacional de Tecnologia da Informacao - ITI, CN=Autoridade Certificadora Raiz Brasileira v1
# Subject: C=BR, O=ICP-Brasil, OU=Institution Nacional de Tecnologia da Informacao - ITI, CN=Autoridade Certificadora Raiz Brasileira v1
# SHA256 Fingerprint: CB:D8:ED:38:D4:A2:D6:77:D4:53:D7:0D:D8:89:0A:F4:F6:37:4C:BA:62:99:94:3F:1A:B3:A6:93:6C:6F:D7:95
-----BEGIN CERTIFICATE-----
MIIEgDCCA2igAwIBAgIBATANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UEBhMCQlIxEzARBgNVBAoT
Expand All @@ -6093,8 +6093,8 @@ moAlpVKeOQ7tOvR4B1/VKHoKSvXQw2f3jFgXbwoAoyYQtGAiOkpIpdrgqYTeQ9ufQ6c/KARHki/3
52R1IdJPgc6qPmQO4w6tVZp+lJs0wdCuaU4eo9mzh1facMJafYfN+b833u1WNfe3Ig5Pkrg/CN+c
nphe8m+5+pss+M1F2HKyIA==
-----END CERTIFICATE-----
# Issuer: C=BR, O=ICP-Brasil, OU=Instituto Nacional de Tecnologia da Informacao - ITI, CN=Autoridade Certificadora Raiz Brasileira v2
# Subject: C=BR, O=ICP-Brasil, OU=Instituto Nacional de Tecnologia da Informacao - ITI, CN=Autoridade Certificadora Raiz Brasileira v2
# Issuer: C=BR, O=ICP-Brasil, OU=Institution Nacional de Tecnologia da Informacao - ITI, CN=Autoridade Certificadora Raiz Brasileira v2
# Subject: C=BR, O=ICP-Brasil, OU=Institution Nacional de Tecnologia da Informacao - ITI, CN=Autoridade Certificadora Raiz Brasileira v2
# SHA256 Fingerprint: FB:47:D9:2A:99:09:FD:4F:A9:BE:C0:27:37:54:3E:1F:35:14:CE:D7:47:40:7A:8D:9C:FA:39:7B:09:15:06:7C
-----BEGIN CERTIFICATE-----
MIIGoTCCBImgAwIBAgIBATANBgkqhkiG9w0BAQ0FADCBlzELMAkGA1UEBhMCQlIxEzARBgNVBAoT
Expand Down Expand Up @@ -8911,8 +8911,8 @@ N8NWpNemGoAebDNyzVb7X+Xd3DBb7rhMs99asJEk4o0cMQ8pswcghdZ2yj66d4v49VCFDU82cWtV
EglAOwMVOP7ll3hLKB24gLuOsvrgsh3CeIkps44M7ABfTke1ncvcTcLIdcg+UEbYfN+GyvVxKpQK
bVdveOry1+XjV1R3W2KX1+yRzkJz3pBKv4IcldkZSND8mycZ+4nz5hATRNkCu8VfY29lmzE=
-----END CERTIFICATE-----
# Issuer: C=UY, O=ADMINISTRACION NACIONAL DE CORREOS, OU=SERVICIOS ELECTRONICOS, CN=Correo Uruguayo - Root CA
# Subject: C=UY, O=ADMINISTRACION NACIONAL DE CORREOS, OU=SERVICIOS ELECTRONICOS, CN=Correo Uruguayo - Root CA
# Issuer: C=UY, O=ADMINISTRACION NACIONAL DE CORREOS, OU=SERVICIOS ELECTRONICS, CN=Correo Uruguayo - Root CA
# Subject: C=UY, O=ADMINISTRACION NACIONAL DE CORREOS, OU=SERVICIOS ELECTRONICS, CN=Correo Uruguayo - Root CA
# SHA256 Fingerprint: 46:27:32:85:61:5D:96:E5:2D:A9:FC:2E:D8:C0:36:F1:0A:F3:D9:F6:28:0F:8D:28:87:06:C5:2B:20:11:B4:DA
-----BEGIN CERTIFICATE-----
MIIGGjCCBAKgAwIBAgIQAMoieQgjKvD1griF02Pd8TANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQG
Expand Down
2 changes: 1 addition & 1 deletion test/client/wrk_script.lua.temp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- WRK script template
-- Parameters:
-- OUT: output file for JSON summary
-- ERR: error reponse file prefix per thread
-- ERR: error response file prefix per thread
-- HTTP_METHOD: request method
-- REQUEST_BODY_FILE: request body file name

Expand Down
Loading

0 comments on commit f87cabe

Please sign in to comment.