Files
renovate/lib/modules/datasource/flutter-version/index.ts
T
Sebastian Poxhofer a473e73b3e fix(linters): forbid inert counts in v8 coverage-ignore comments (#45287)
Adds a custom oxlint rule renovate/v8-ignore-no-count that flags the
count form '/* v8 ignore next <N> */'. The count is not honored by
vitest's ast-v8-to-istanbul hint parser, which captures only the
keyword (if/else/next/file); 'next' always exempts exactly the next
AST node. Trailing counts therefore suggest a line range that is never
applied and mislead readers.

The rule is autofixable (drops the count, preserving actual behavior)
and has been applied to all existing occurrences.
2026-08-22 11:25:31 +00:00

72 lines
2.3 KiB
TypeScript

import { regEx } from '../../../util/regex.ts';
import { asTimestamp } from '../../../util/timestamp.ts';
import { id as semverId } from '../../versioning/semver/index.ts';
import { Datasource } from '../datasource.ts';
import type { GetReleasesConfig, ReleaseResult } from '../types.ts';
import { FlutterResponse } from './schema.ts';
export const stableVersionRegex = regEx(/^\d+\.\d+\.\d+$/);
export class FlutterVersionDatasource extends Datasource {
static readonly id = 'flutter-version';
constructor() {
super(FlutterVersionDatasource.id);
}
override readonly customRegistrySupport = false;
override readonly defaultRegistryUrls = ['https://storage.googleapis.com'];
override readonly caching = true;
override readonly defaultVersioning = semverId;
override readonly releaseTimestampSupport = true;
override readonly releaseTimestampNote =
'The release timestamp is determined from the `release_date` field in the results.';
override readonly sourceUrlSupport = 'package';
override readonly sourceUrlNote =
'We use the URL: https://github.com/flutter/flutter.';
async getReleases({
registryUrl,
}: GetReleasesConfig): Promise<ReleaseResult | null> {
/* v8 ignore next -- should never happen */
if (!registryUrl) {
return null;
}
const result: ReleaseResult = {
homepage: 'https://flutter.dev',
sourceUrl: 'https://github.com/flutter/flutter',
registryUrl,
releases: [],
};
try {
const resp = (
await this.http.getJson(
`${registryUrl}/flutter_infra_release/releases/releases_linux.json`,
FlutterResponse,
)
).body;
result.releases = resp.releases
// The API response contains a stable version being released as a non-stable
// release. And so we filter out these releases here.
.filter(({ version, channel }) => {
if (stableVersionRegex.test(version)) {
return channel === 'stable';
}
return true;
})
.map(({ version, release_date, channel }) => ({
version,
releaseTimestamp: asTimestamp(release_date),
isStable: channel === 'stable',
}));
return result.releases.length ? result : null;
} catch (err) {
this.handleGenericErrors(err);
}
}
}