Skip to content

Commit 7529fe9

Browse files
committed
Fix c8 ignore comment formatting by adding periods
Ensure all c8 ignore comments end with periods for consistency with established code style guidelines.
1 parent 35f58dd commit 7529fe9

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/decode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function decodePurlComponent(comp: string, encodedComponent: string): string {
1010
try {
1111
return decodeComponent(encodedComponent)
1212
} catch {
13-
/* c8 ignore next -- Intentionally empty. Invalid encoding will throw below. */
13+
/* c8 ignore next -- Intentionally empty, invalid encoding will throw below. */
1414
}
1515
throw new PurlError(`unable to decode "${comp}" component`)
1616
}

src/package-url.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ class PackageURL {
308308
// Split the remainder once from left on ':'.
309309
const colonIndex = purlStr.indexOf(':')
310310
// Use WHATWG URL to split up the purl string.
311-
/* c8 ignore next 3 -- Comment lines don't need coverage */
311+
/* c8 ignore next 3 -- Comment lines don't need coverage. */
312312
// - Split the purl string once from right on '#'
313313
// - Split the remainder once from right on '?'
314314
// - Split the remainder once from left on ':'
@@ -324,7 +324,7 @@ class PackageURL {
324324
const afterColon = purlStr.slice(colonIndex + 1)
325325
const trimmedAfterColon = trimLeadingSlashes(afterColon)
326326
url = new URL(`${beforeColon}:${trimmedAfterColon}`)
327-
/* c8 ignore next 4 -- V8 coverage sees multiple branch paths in ternary that can't all be tested */
327+
/* c8 ignore next 4 -- V8 coverage sees multiple branch paths in ternary that can't all be tested. */
328328
maybeUrlWithAuth =
329329
afterColon.length === trimmedAfterColon.length
330330
? url
@@ -336,10 +336,10 @@ class PackageURL {
336336
}
337337
}
338338
// The scheme is a constant with the value "pkg".
339-
/* c8 ignore next -- Tested: colonIndex === -1 (url undefined) case, but V8 can't see both branches */
339+
/* c8 ignore next -- Tested: colonIndex === -1 (url undefined) case, but V8 can't see both branches. */
340340
if (url?.protocol !== 'pkg:') {
341341
throw new PurlError('missing required "pkg" scheme component')
342-
/* c8 ignore next -- Unreachable code after throw */
342+
/* c8 ignore next -- Unreachable code after throw. */
343343
}
344344
// A purl must NOT contain a URL Authority i.e. there is no support for
345345
// username, password, host and port components.
@@ -362,7 +362,7 @@ class PackageURL {
362362

363363
let rawVersion: string | undefined
364364
// Both branches of this ternary are tested, but V8 reports phantom branch combinations
365-
/* c8 ignore start -- npm vs non-npm path logic both tested but V8 sees extra branches */
365+
/* c8 ignore start -- npm vs non-npm path logic both tested but V8 sees extra branches. */
366366
let atSignIndex =
367367
rawType === 'npm'
368368
? // Deviate from the specification to handle a special npm purl type case for
@@ -419,7 +419,7 @@ class PackageURL {
419419
const value = decodePurlComponent('qualifiers', pairs.at(1) ?? '')
420420
// Use URLSearchParams#append to preserve plus signs.
421421
// https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams#preserving_plus_signs
422-
/* c8 ignore next -- URLSearchParams.append has internal V8 branches we can't control */
422+
/* c8 ignore next -- URLSearchParams.append has internal V8 branches we can't control. */
423423
searchParams.append(pairs[0]!, value)
424424
}
425425
// Split the remainder once from right on '?'.

src/purl-type.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ const PurlType = createHelpersNamespaceObject(
408408
if (throws) {
409409
// Tested: validation returns false in non-throw mode
410410
// V8 coverage can't see both throw and return false paths in same test
411-
/* c8 ignore next 3 -- Throw path tested separately from return false path */
411+
/* c8 ignore next 3 -- Throw path tested separately from return false path. */
412412
throw new PurlError(
413413
`npm "namespace" and "name" components can not collectively be more than 214 characters`,
414414
)
@@ -435,7 +435,7 @@ const PurlType = createHelpersNamespaceObject(
435435
if (throws) {
436436
// Tested: validation returns false in non-throw mode
437437
// V8 coverage can't see both throw and return false paths in same test
438-
/* c8 ignore next 3 -- Throw path tested separately from return false path */
438+
/* c8 ignore next 3 -- Throw path tested separately from return false path. */
439439
throw new PurlError(
440440
'npm "name" component can not be a core module name',
441441
)
@@ -467,7 +467,7 @@ const PurlType = createHelpersNamespaceObject(
467467
if (throws) {
468468
// Tested: validation returns false in non-throw mode
469469
// V8 coverage can't see both throw and return false paths in same test
470-
/* c8 ignore next 3 -- Throw path tested separately from return false path */
470+
/* c8 ignore next 3 -- Throw path tested separately from return false path. */
471471
throw new PurlError(
472472
'pub "name" component may only contain [a-z0-9_] characters'
473473
)

src/validate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function validateType(type: unknown, throws: boolean): boolean {
184184
) {
185185
if (throws) {
186186
throw new PurlError(`type "${type}" contains an illegal character`)
187-
/* c8 ignore next -- Unreachable code after throw */
187+
/* c8 ignore next -- Unreachable code after throw. */
188188
}
189189
return false
190190
}

0 commit comments

Comments
 (0)