summaryrefslogtreecommitdiff
path: root/test/addons-napi
diff options
context:
space:
mode:
authorDaniel Bevenius <daniel.bevenius@gmail.com>2017-11-28 18:04:49 +0100
committerGibson Fahnestock <gibfahn@gmail.com>2018-01-03 23:27:43 +0000
commit47322e67c43f5b03df02023efb2209ee1e6eb3cd (patch)
tree3b5ab075063c47bf67a3d9b8fd2ddbfe371139d3 /test/addons-napi
parente61344a9e9f14b553fd5e49637a15d232a5b74d0 (diff)
downloadnode-new-47322e67c43f5b03df02023efb2209ee1e6eb3cd.tar.gz
tools: add cpplint rule for NULL usage
This commit is a suggestion for adding a rule for NULL usages in the code base. This will currently report a number of errors which could be ignored using // NOLINT (readability/null_usage) PR-URL: https://github.com/nodejs/node/pull/17373 Backport-PR-URL: https://github.com/nodejs/node/pull/17873 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'test/addons-napi')
-rw-r--r--test/addons-napi/7_factory_wrap/binding.cc1
-rw-r--r--test/addons-napi/test_make_callback/binding.cc2
-rw-r--r--test/addons-napi/test_make_callback_recurse/binding.cc2
3 files changed, 5 insertions, 0 deletions
diff --git a/test/addons-napi/7_factory_wrap/binding.cc b/test/addons-napi/7_factory_wrap/binding.cc
index c8fca4d536..d981324578 100644
--- a/test/addons-napi/7_factory_wrap/binding.cc
+++ b/test/addons-napi/7_factory_wrap/binding.cc
@@ -16,6 +16,7 @@ napi_value Init(napi_env env, napi_value exports) {
NAPI_CALL(env, MyObject::Init(env));
NAPI_CALL(env,
+ // NOLINTNEXTLINE (readability/null_usage)
napi_create_function(env, "exports", -1, CreateObject, NULL, &exports));
return exports;
}
diff --git a/test/addons-napi/test_make_callback/binding.cc b/test/addons-napi/test_make_callback/binding.cc
index 4b0537ca07..952dfcc1cb 100644
--- a/test/addons-napi/test_make_callback/binding.cc
+++ b/test/addons-napi/test_make_callback/binding.cc
@@ -8,6 +8,7 @@ napi_value MakeCallback(napi_env env, napi_callback_info info) {
const int kMaxArgs = 10;
size_t argc = kMaxArgs;
napi_value args[kMaxArgs];
+ // NOLINTNEXTLINE (readability/null_usage)
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL));
NAPI_ASSERT(env, argc > 0, "Wrong number of arguments");
@@ -47,6 +48,7 @@ napi_value MakeCallback(napi_env env, napi_callback_info info) {
napi_value Init(napi_env env, napi_value exports) {
napi_value fn;
NAPI_CALL(env, napi_create_function(
+ // NOLINTNEXTLINE (readability/null_usage)
env, NULL, NAPI_AUTO_LENGTH, MakeCallback, NULL, &fn));
NAPI_CALL(env, napi_set_named_property(env, exports, "makeCallback", fn));
return exports;
diff --git a/test/addons-napi/test_make_callback_recurse/binding.cc b/test/addons-napi/test_make_callback_recurse/binding.cc
index 714e44773d..b99c583d31 100644
--- a/test/addons-napi/test_make_callback_recurse/binding.cc
+++ b/test/addons-napi/test_make_callback_recurse/binding.cc
@@ -7,6 +7,7 @@ namespace {
napi_value MakeCallback(napi_env env, napi_callback_info info) {
size_t argc = 2;
napi_value args[2];
+ // NOLINTNEXTLINE (readability/null_usage)
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL));
napi_value recv = args[0];
@@ -21,6 +22,7 @@ napi_value MakeCallback(napi_env env, napi_callback_info info) {
napi_value Init(napi_env env, napi_value exports) {
napi_value fn;
NAPI_CALL(env, napi_create_function(
+ // NOLINTNEXTLINE (readability/null_usage)
env, NULL, NAPI_AUTO_LENGTH, MakeCallback, NULL, &fn));
NAPI_CALL(env, napi_set_named_property(env, exports, "makeCallback", fn));
return exports;