Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a5311bd

Browse filesBrowse files
gengjiawenMylesBorins
authored andcommitted
tools: add clang-tidy rule in src
PR-URL: #26840 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent f8e8059 commit a5311bd
Copy full SHA for a5311bd

File tree

Expand file treeCollapse file tree

6 files changed

+43
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+43
-12
lines changed
Open diff view settings
Collapse file

‎src/.clang-tidy‎

Copy file name to clipboard
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
Checks: '-*,
3+
# modernize-use-auto,
4+
# modernize-use-equals-delete,
5+
modernize-deprecated-headers,
6+
modernize-make-unique,
7+
modernize-make-shared,
8+
modernize-redundant-void-arg,
9+
modernize-replace-random-shuffle,
10+
modernize-shrink-to-fit,
11+
modernize-use-bool-literals,
12+
modernize-use-emplace,
13+
modernize-use-equals-default,
14+
modernize-use-nullptr,
15+
modernize-use-override,
16+
performance-faster-string-find,
17+
# performance-unnecessary-value-param, see https://github.com/nodejs/node/pull/26042
18+
readability-delete-null-pointer, '
19+
WarningsAsErrors: ''
20+
HeaderFilterRegex: ''
21+
AnalyzeTemporaryDtors: false
22+
FormatStyle: none
23+
User: nodejs/cpp
24+
CheckOptions:
25+
- key: google-readability-braces-around-statements.ShortStatementLines
26+
value: 1
27+
...
Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ struct AllocatedBuffer {
589589
class AsyncRequest : public MemoryRetainer {
590590
public:
591591
AsyncRequest() = default;
592-
~AsyncRequest();
592+
~AsyncRequest() override;
593593

594594
AsyncRequest(const AsyncRequest&) = delete;
595595
AsyncRequest& operator=(const AsyncRequest&) = delete;
@@ -907,7 +907,7 @@ class Environment : public MemoryRetainer {
907907
const std::vector<std::string>& exec_args,
908908
Flags flags = Flags(),
909909
uint64_t thread_id = kNoThreadId);
910-
~Environment();
910+
~Environment() override;
911911

912912
void InitializeLibuv(bool start_profiler_idle_notifier);
913913
inline const std::vector<std::string>& exec_argv();
@@ -1376,7 +1376,8 @@ class Environment : public MemoryRetainer {
13761376
bool http_parser_buffer_in_use_ = false;
13771377
std::unique_ptr<http2::Http2State> http2_state_;
13781378

1379-
bool debug_enabled_[static_cast<int>(DebugCategory::CATEGORY_COUNT)] = {0};
1379+
bool debug_enabled_[static_cast<int>(DebugCategory::CATEGORY_COUNT)] = {
1380+
false};
13801381

13811382
AliasedFloat64Array fs_stats_field_array_;
13821383
AliasedBigUint64Array fs_stats_field_bigint_array_;
Collapse file

‎src/fs_event_wrap.cc‎

Copy file name to clipboardExpand all lines: src/fs_event_wrap.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class FSEventWrap: public HandleWrap {
6464
static const encoding kDefaultEncoding = UTF8;
6565

6666
FSEventWrap(Environment* env, Local<Object> object);
67-
~FSEventWrap() = default;
67+
~FSEventWrap() override = default;
6868

6969
static void OnEvent(uv_fs_event_t* handle, const char* filename, int events,
7070
int status);
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
877877
}
878878

879879
if (will_start_new_arg) {
880-
env_argv.push_back(std::string(1, c));
880+
env_argv.emplace_back(std::string(1, c));
881881
will_start_new_arg = false;
882882
} else {
883883
env_argv.back() += c;
Collapse file

‎src/node_main_instance.cc‎

Copy file name to clipboardExpand all lines: src/node_main_instance.cc
+9-6Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <memory>
2+
13
#include "node_main_instance.h"
24
#include "node_internals.h"
35
#include "node_options-inl.h"
@@ -34,7 +36,8 @@ NodeMainInstance::NodeMainInstance(Isolate* isolate,
3436
isolate_data_(nullptr),
3537
owns_isolate_(false),
3638
deserialize_mode_(false) {
37-
isolate_data_.reset(new IsolateData(isolate_, event_loop, platform, nullptr));
39+
isolate_data_ =
40+
std::make_unique<IsolateData>(isolate_, event_loop, platform, nullptr);
3841

3942
IsolateSettings misc;
4043
SetIsolateMiscHandlers(isolate_, misc);
@@ -76,11 +79,11 @@ NodeMainInstance::NodeMainInstance(
7679
deserialize_mode_ = per_isolate_data_indexes != nullptr;
7780
// If the indexes are not nullptr, we are not deserializing
7881
CHECK_IMPLIES(deserialize_mode_, params->external_references != nullptr);
79-
isolate_data_.reset(new IsolateData(isolate_,
80-
event_loop,
81-
platform,
82-
array_buffer_allocator_.get(),
83-
per_isolate_data_indexes));
82+
isolate_data_ = std::make_unique<IsolateData>(isolate_,
83+
event_loop,
84+
platform,
85+
array_buffer_allocator_.get(),
86+
per_isolate_data_indexes);
8487
IsolateSettings s;
8588
SetIsolateMiscHandlers(isolate_, s);
8689
if (!deserialize_mode_) {
Collapse file

‎src/tracing/traced_value.h‎

Copy file name to clipboardExpand all lines: src/tracing/traced_value.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace tracing {
1818

1919
class TracedValue : public v8::ConvertableToTraceFormat {
2020
public:
21-
~TracedValue() = default;
21+
~TracedValue() override = default;
2222

2323
static std::unique_ptr<TracedValue> Create();
2424
static std::unique_ptr<TracedValue> CreateArray();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.