Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 499112c

Browse files
Reformat the code and enable linting (#292)
PR-URL: #292
1 parent 675ef72 commit 499112c

18 files changed

+904
-801
lines changed

gulpfile.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,5 @@ gulp.task('watch', () => {
9898
return gulp.watch(sources, ['test.compile']);
9999
});
100100

101-
// TODO: Add the test.check-format and test.check-lint tests when the code
102-
// is in a state that is ready to be formatted.
103-
gulp.task('test', ['test.unit']);//, 'test.check-format', 'test.check-lint']);
101+
gulp.task('test', ['test.unit', 'test.check-format', 'test.check-lint']);
104102
gulp.task('default', ['compile']);

src.ts/agent/config.ts

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,33 @@ export interface DebugAgentConfig {
2323
* @memberof DebugAgentConfig
2424
* @default
2525
*/
26-
workingDirectory: string | null,
26+
workingDirectory: string|null;
2727

2828
/**
2929
* @property {?string} A user specified way of identifying the service
3030
* that the debug agent is monitoring.
3131
* @memberof DebugAgentConfig
3232
* @default
3333
*/
34-
description: string | null,
34+
description: string|null;
3535

3636
/**
3737
* @property {boolean} Whether or not it is permitted to evaluate expressions.
38-
* Locals and arguments are not displayed and watch expressions and conditions
39-
* are dissallowed when this is `false`.
38+
* Locals and arguments are not displayed and watch expressions and
39+
* conditions are dissallowed when this is `false`.
4040
* @memberof DebugAgentConfig
4141
* @default
4242
*/
43-
allowExpressions: boolean,
43+
allowExpressions: boolean;
4444

4545
/**
4646
* @property {object} Identifies the context of the running service -
4747
* [ServiceContext](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext?authuser=2).
4848
* This information is utilized in the UI to identify all the running
4949
* instances of your service. This is discovered automatically when your
50-
* application is running on Google Cloud Platform. You may optionally choose
51-
* to provide this information yourself to identify your service differently
52-
* from the default mechanism.
50+
* application is running on Google Cloud Platform. You may optionally
51+
* choose to provide this information yourself to identify your service
52+
* differently from the default mechanism.
5353
* @memberof DebugAgentConfig
5454
* @default
5555
*/
@@ -58,56 +58,57 @@ export interface DebugAgentConfig {
5858
* @property {?string} the service name
5959
* @default
6060
*/
61-
service: string | null,
61+
service: string | null;
6262

6363
/**
6464
* @property {?string} the service version
6565
* @default
6666
*/
67-
version: string | null,
67+
version: string | null;
6868

6969
/**
7070
* @property {?string} a unique deployment identifier. This is used
7171
* internally only.
7272
* @private
7373
*/
74-
minorVersion_: string | null
75-
},
74+
minorVersion_: string | null;
75+
};
7676

7777
/**
7878
* @property {?string} The path within your repository to the directory
79-
* containing the package.json for your deployed application. This should be
80-
* provided if your deployed application appears as a subdirectory of your
81-
* repository. Usually this is unnecessary, but may be useful in cases where
82-
* the debug agent is unable to resolve breakpoint locations unambiguously.
79+
* containing the package.json for your deployed application. This should
80+
* be provided if your deployed application appears as a subdirectory of
81+
* your repository. Usually this is unnecessary, but may be useful in
82+
* cases where the debug agent is unable to resolve breakpoint locations
83+
* unambiguously.
8384
* @memberof DebugAgentConfig
8485
* @default
8586
*/
86-
appPathRelativeToRepository: string | null,
87+
appPathRelativeToRepository: string|null;
8788

8889
/**
8990
* @property {number} agent log level 0-disabled, 1-error, 2-warn, 3-info,
9091
* 4-debug
9192
* @memberof DebugAgentConfig
9293
* @default
9394
*/
94-
logLevel: number,
95+
logLevel: number;
9596

9697
/**
9798
* @property {number} How frequently should the list of breakpoints be
9899
* refreshed from the cloud debug server.
99100
* @memberof DebugAgentConfig
100101
* @default
101102
*/
102-
breakpointUpdateIntervalSec: number,
103+
breakpointUpdateIntervalSec: number;
103104

104105
/**
105106
* @property {number} breakpoints and logpoints older than this number of
106107
* seconds will be expired on the server.
107108
* @memberof DebugAgentConfig
108109
* @default
109110
*/
110-
breakpointExpirationSec: number,
111+
breakpointExpirationSec: number;
111112

112113
/**
113114
* @property {object} configuration options on what is captured on a
@@ -120,48 +121,49 @@ export interface DebugAgentConfig {
120121
* belonging to node-core.
121122
* @default
122123
*/
123-
includeNodeModules: boolean,
124+
includeNodeModules: boolean;
124125

125126

126127
/**
127128
* @property {number} Maximum number of stack frames to capture data for.
128129
* The limit is aimed to reduce overall capture time.
129130
* @default
130131
*/
131-
maxFrames: number,
132+
maxFrames: number;
132133

133134
/**
134135
* @property {number} We collect locals and arguments on a few top frames.
135136
* For the rest only collect the source location
136137
* @default
137138
*/
138-
maxExpandFrames: number,
139+
maxExpandFrames: number;
139140

140141
/**
141142
* @property {number} To reduce the overall capture time, limit the number
142-
* of properties gathered on large objects. A value of 0 disables the limit.
143+
* of properties gathered on large objects. A value of 0 disables the
144+
* limit.
143145
* @default
144146
*/
145-
maxProperties: number,
147+
maxProperties: number;
146148

147149
/**
148150
* @property {number} Total 'size' of data to gather. This is NOT the
149-
* number of bytes of data that are sent over the wire, but instead a very
150-
* very coarse approximation based on the length of names and values of the
151-
* properties. This should be somewhat proportional to the amount of
152-
* processing needed to capture the data and subsequently the network
153-
* traffic. A value of 0 disables the limit.
151+
* number of bytes of data that are sent over the wire, but instead a
152+
* very very coarse approximation based on the length of names and
153+
* values of the properties. This should be somewhat proportional to the
154+
* amount of processing needed to capture the data and subsequently the
155+
* network traffic. A value of 0 disables the limit.
154156
* @default
155157
*/
156-
maxDataSize: number,
158+
maxDataSize: number;
157159

158160
/**
159161
* @property {number} To limit the size of the buffer, we truncate long
160162
* strings. A value of 0 disables truncation.
161163
* @default
162164
*/
163-
maxStringLength: number
164-
},
165+
maxStringLength: number;
166+
};
165167

166168
/**
167169
* @property {object} options affecting log points.
@@ -174,15 +176,15 @@ export interface DebugAgentConfig {
174176
* @memberof DebugAgentConfig
175177
* @default
176178
*/
177-
maxLogsPerSecond: number,
179+
maxLogsPerSecond: number;
178180

179181
/**
180182
* @property {number} Number of seconds to wait after the
181183
* `maxLogsPerSecond` rate is hit before logging resumes per logpoint.
182184
* @default
183185
*/
184-
logDelaySeconds: number
185-
},
186+
logDelaySeconds: number;
187+
};
186188

187189
/**
188190
* @property {object} These configuration options are for internal
@@ -191,25 +193,26 @@ export interface DebugAgentConfig {
191193
* @private
192194
*/
193195
internal: {
194-
registerDelayOnFetcherErrorSec: number,
195-
maxRegistrationRetryDelay: number
196-
},
196+
// TODO: Determine if clang-format can be configured to place
197+
// a newline between these two statements.
198+
registerDelayOnFetcherErrorSec: number; maxRegistrationRetryDelay: number;
199+
};
197200

198201
/**
199202
* @property {boolean} Used by tests to force loading of a new agent if one
200203
* exists already
201204
* @memberof DebugAgentConfig
202205
* @private
203206
*/
204-
forceNewAgent_: boolean,
207+
forceNewAgent_: boolean;
205208

206209
/**
207210
* @property {boolean} Uses by tests to cause the start() function to return
208211
* the debuglet.
209212
* @memberof DebugAgentConfig
210213
* @private
211214
*/
212-
testMode_: boolean
215+
testMode_: boolean;
213216
}
214217

215218
const defaultConfig: DebugAgentConfig = {
@@ -221,11 +224,7 @@ const defaultConfig: DebugAgentConfig = {
221224

222225
// FIXME(ofrobots): today we prioritize GAE_MODULE_NAME/GAE_MODULE_VERSION
223226
// over the user specified config. We should reverse that.
224-
serviceContext: {
225-
service: null,
226-
version: null,
227-
minorVersion_: null
228-
},
227+
serviceContext: {service: null, version: null, minorVersion_: null},
229228

230229
appPathRelativeToRepository: null,
231230
logLevel: 1,
@@ -241,10 +240,7 @@ const defaultConfig: DebugAgentConfig = {
241240
maxStringLength: 100
242241
},
243242

244-
log: {
245-
maxLogsPerSecond: 50,
246-
logDelaySeconds: 1
247-
},
243+
log: {maxLogsPerSecond: 50, logDelaySeconds: 1},
248244

249245
internal: {
250246
registerDelayOnFetcherErrorSec: 300, // 5 minutes.

src.ts/agent/debug-assert.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
import * as realAssert from 'assert';
1818

19-
const nop = _=>_;
19+
const nop = _ => _;
2020
const fakeAssert: any = nop;
2121
fakeAssert.deepEqual = fakeAssert.deepStrictEqual = fakeAssert.doesNotThrow =
2222
fakeAssert.equal = fakeAssert.fail = fakeAssert.ifError =
23-
fakeAssert.notDeepEqual = fakeAssert.notDeepStrictEqual =
24-
fakeAssert.notEqual = fakeAssert.notStrictEqual = fakeAssert.ok =
25-
fakeAssert.strictEqual = fakeAssert.throws =
26-
fakeAssert.AssertionError = nop;
23+
fakeAssert.notDeepEqual = fakeAssert.notDeepStrictEqual =
24+
fakeAssert.notEqual = fakeAssert.notStrictEqual = fakeAssert.ok =
25+
fakeAssert.strictEqual =
26+
fakeAssert.throws = fakeAssert.AssertionError = nop;
2727

2828
export function debugAssert(enableAssertions: boolean) {
2929
return enableAssertions ? realAssert : fakeAssert;
30-
};
30+
}

0 commit comments

Comments
 (0)