Skip to content

Commit febd09b

Browse files
committed
fix: run lint
1 parent 99ec765 commit febd09b

File tree

10 files changed

+56
-44
lines changed

10 files changed

+56
-44
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ jobs:
403403
name: Profiling Node Unit Tests
404404
needs: [job_get_metadata, job_build]
405405
runs-on: ubuntu-latest
406+
timeout-minutes: 5
406407
steps:
407408
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
408409
uses: actions/checkout@v4
@@ -1061,6 +1062,7 @@ jobs:
10611062
needs: [job_get_metadata, job_build]
10621063
runs-on: ${{ matrix.os }}
10631064
container: ${{ matrix.container }}
1065+
timeout-minutes: 10
10641066
strategy:
10651067
fail-fast: false
10661068
matrix:

MIGRATION.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ If you are using the `Hub` right now, see the following table on how to migrate
6666

6767
## Deprecate `client.setupIntegrations()`
6868

69-
Instead, use the new `client.init()` method. You should probably not use this directly and instead use `Sentry.init()`, which calls this under the hood. But if you have a special use case that requires that, you can call `client.init()` instead now.
69+
Instead, use the new `client.init()` method. You should probably not use this directly and instead use `Sentry.init()`,
70+
which calls this under the hood. But if you have a special use case that requires that, you can call `client.init()`
71+
instead now.
7072

7173
## Deprecate `scope.getSpan()` and `scope.setSpan()`
7274

packages/profiling-node/bindings/cpu_profiler.cc

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
#include <unordered_map>
1313

1414
static const uint8_t kMaxStackDepth(128);
15-
static const float kSamplingFrequency(99.0); // 99 to avoid lockstep sampling
15+
static const float kSamplingFrequency(99.0); // 99 to avoid lockstep sampling
1616
static const float kSamplingHz(1 / kSamplingFrequency);
1717
static const int kSamplingInterval(kSamplingHz * 1e6);
18-
static const v8::CpuProfilingNamingMode kNamingMode(
19-
v8::CpuProfilingNamingMode::kDebugNaming);
20-
static const v8::CpuProfilingLoggingMode kDefaultLoggingMode(
21-
v8::CpuProfilingLoggingMode::kEagerLogging);
18+
static const v8::CpuProfilingNamingMode
19+
kNamingMode(v8::CpuProfilingNamingMode::kDebugNaming);
20+
static const v8::CpuProfilingLoggingMode
21+
kDefaultLoggingMode(v8::CpuProfilingLoggingMode::kEagerLogging);
2222

2323
// Allow users to override the default logging mode via env variable. This is
2424
// useful because sometimes the flow of the profiled program can be to execute
@@ -57,7 +57,7 @@ enum class ProfileStatus {
5757
};
5858

5959
class MeasurementsTicker {
60-
private:
60+
private:
6161
uv_timer_t timer;
6262
uint64_t period_ms;
6363
std::unordered_map<std::string,
@@ -69,7 +69,7 @@ class MeasurementsTicker {
6969
v8::HeapStatistics heap_stats;
7070
uv_cpu_info_t cpu_stats;
7171

72-
public:
72+
public:
7373
MeasurementsTicker(uv_loop_t *loop)
7474
: period_ms(100), isolate(v8::Isolate::GetCurrent()) {
7575
uv_timer_init(loop, &timer);
@@ -218,7 +218,7 @@ void MeasurementsTicker::remove_cpu_listener(
218218
};
219219

220220
class Profiler {
221-
public:
221+
public:
222222
std::unordered_map<std::string, SentryProfile *> active_profiles;
223223

224224
MeasurementsTicker measurements_ticker;
@@ -231,7 +231,7 @@ class Profiler {
231231
};
232232

233233
class SentryProfile {
234-
private:
234+
private:
235235
uint64_t started_at;
236236
uint16_t heap_write_index = 0;
237237
uint16_t cpu_write_index = 0;
@@ -248,7 +248,7 @@ class SentryProfile {
248248
ProfileStatus status = ProfileStatus::kNotStarted;
249249
std::string id;
250250

251-
public:
251+
public:
252252
explicit SentryProfile(const char *id)
253253
: started_at(uv_hrtime()),
254254
memory_sampler_cb([this](uint64_t ts, v8::HeapStatistics &stats) {
@@ -280,8 +280,7 @@ class SentryProfile {
280280
return false;
281281
}),
282282

283-
status(ProfileStatus::kNotStarted),
284-
id(id) {
283+
status(ProfileStatus::kNotStarted), id(id) {
285284
heap_stats_ts.reserve(300);
286285
heap_stats_usage.reserve(300);
287286
cpu_stats_ts.reserve(300);
@@ -453,10 +452,10 @@ static napi_value GetFrameModuleWrapped(napi_env env, napi_callback_info info) {
453452
return napi_module;
454453
}
455454

456-
napi_value CreateFrameNode(
457-
const napi_env &env, const v8::CpuProfileNode &node,
458-
std::unordered_map<std::string, std::string> &module_cache,
459-
napi_value &resources) {
455+
napi_value
456+
CreateFrameNode(const napi_env &env, const v8::CpuProfileNode &node,
457+
std::unordered_map<std::string, std::string> &module_cache,
458+
napi_value &resources) {
460459
napi_value js_node;
461460
napi_create_object(env, &js_node);
462461

@@ -664,10 +663,11 @@ static void GetSamples(const napi_env &env, const v8::CpuProfile *profile,
664663
}
665664
}
666665

667-
static napi_value TranslateMeasurementsDouble(
668-
const napi_env &env, const char *unit, const uint16_t size,
669-
const std::vector<double> &values,
670-
const std::vector<uint64_t> &timestamps) {
666+
static napi_value
667+
TranslateMeasurementsDouble(const napi_env &env, const char *unit,
668+
const uint16_t size,
669+
const std::vector<double> &values,
670+
const std::vector<uint64_t> &timestamps) {
671671
if (size > values.size() || size > timestamps.size()) {
672672
napi_throw_range_error(env, "NAPI_ERROR",
673673
"CPU measurement size is larger than the number of "
@@ -718,10 +718,10 @@ static napi_value TranslateMeasurementsDouble(
718718
return measurement;
719719
}
720720

721-
static napi_value TranslateMeasurements(
722-
const napi_env &env, const char *unit, const uint16_t size,
723-
const std::vector<uint64_t> &values,
724-
const std::vector<uint64_t> &timestamps) {
721+
static napi_value
722+
TranslateMeasurements(const napi_env &env, const char *unit,
723+
const uint16_t size, const std::vector<uint64_t> &values,
724+
const std::vector<uint64_t> &timestamps) {
725725
if (size > values.size() || size > timestamps.size()) {
726726
napi_throw_range_error(env, "NAPI_ERROR",
727727
"Memory measurement size is larger than the number "
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const child_process = require('child_process');
2+
3+
const args = ['--Werror', '-i', '--style=file', 'bindings/cpu_profiler.cc'];
4+
const cmd = `./node_modules/.bin/clang-format ${args.join(' ')}`;
5+
6+
child_process.execSync(cmd);
7+
8+
// eslint-disable-next-line no-console
9+
console.log('clang-format: done, checking tree...');
10+
11+
const diff = child_process.execSync('git status --short').toString();
12+
13+
if (diff) {
14+
// eslint-disable-next-line no-console
15+
console.error('clang-format: check failed ❌');
16+
process.exit(1);
17+
}
18+
19+
// eslint-disable-next-line no-console
20+
console.log('clang-format: check passed ✅');

packages/profiling-node/clang-format.mjs

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/profiling-node/src/hubextensions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export function __PRIVATE__wrapStartTransactionWithProfiling(startTransaction: S
160160
const transaction: Transaction = startTransaction.call(this, transactionContext, customSamplingContext);
161161

162162
// Client is required if we want to profile
163+
// eslint-disable-next-line deprecation/deprecation
163164
const client = this.getClient() as NodeClient | undefined;
164165
if (!client) {
165166
return transaction;

packages/profiling-node/src/integration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class ProfilingIntegration implements Integration {
5656
*/
5757
public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {
5858
this.getCurrentHub = getCurrentHub;
59+
// eslint-disable-next-line deprecation/deprecation
5960
const client = this.getCurrentHub().getClient() as NodeClient;
6061

6162
if (client && typeof client.on === 'function') {
@@ -202,6 +203,7 @@ export class ProfilingIntegration implements Integration {
202203
// If either of them is not available, we remove the profile from the transaction event.
203204
// and forward it to the next event processor.
204205
const hub = this.getCurrentHub();
206+
// eslint-disable-next-line deprecation/deprecation
205207
const client = hub.getClient();
206208
if (!client) {
207209
if (isDebugBuild()) {

packages/profiling-node/src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ export function applyDebugMetadata(resource_paths: ReadonlyArray<string>): Debug
461461
}
462462

463463
const hub = Sentry.getCurrentHub();
464+
// eslint-disable-next-line deprecation/deprecation
464465
const client = hub.getClient();
465466
const options = client && client.getOptions();
466467

packages/profiling-node/test/hubextensions.hub.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function makeClientWithoutHooks(): [NodeClient, Transport] {
2626
integrations: [integration],
2727
transport: _opts => transport,
2828
});
29+
// eslint-disable-next-line deprecation/deprecation
2930
client.setupIntegrations = () => {
3031
integration.setupOnce(
3132
cb => {
@@ -59,6 +60,7 @@ function makeClientWithHooks(): [NodeClient, Transport] {
5960
}),
6061
});
6162

63+
// eslint-disable-next-line deprecation/deprecation
6264
client.setupIntegrations = () => {
6365
integration.setupOnce(
6466
cb => {

packages/profiling-node/test/index.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function makeClientWithoutHooks(): [NodeClient, MockTransport] {
3636
integrations: [integration],
3737
transport: () => transport,
3838
});
39+
// eslint-disable-next-line deprecation/deprecation
3940
client.setupIntegrations = () => {
4041
integration.setupOnce(
4142
cb => {

0 commit comments

Comments
 (0)