Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function registerStatusProvider(
diagnostics: Observable<[URL, sourcegraph.Diagnostic[]][]>,
diagnosticCollection: sourcegraph.DiagnosticCollection
): Unsubscribable {
const subscriptions = new Subscription()
subscriptions.add(
sourcegraph.status.registerStatusProvider('travis-ci', {
provideStatus: (scope): sourcegraph.Subscribable => {
// TODO!(sqs): dont ignore scope
return diagnostics.pipe(
switchMap<[URL, sourcegraph.Diagnostic[]][], Promise>(async diagnostics => ({
title: 'Travis CI',
state: {
completion: sourcegraph.CheckResult.Completed,
result: sourcegraph.CheckResult.Success,
message: 'All builds passing, all repository configuration valid and up-to-date',
},
sections: {
settings: {
kind: sourcegraph.MarkupKind.Markdown,
value: `Require all projects to configure Travis CI`,
},
notifications: {
export function registerDependencyRules(): Unsubscribable {
const subscriptions = new Subscription()
subscriptions.add(startDiagnostics())
subscriptions.add(
sourcegraph.status.registerStatusProvider('npm-dependency-security', createStatusProvider(diagnostics))
)
subscriptions.add(sourcegraph.languages.registerCodeActionProvider(['*'], createCodeActionProvider()))
return subscriptions
}
export function registerSampleStatusProviders(): Unsubscribable {
const subscriptions = new Subscription()
for (const status of STATUSES) {
subscriptions.add(
sourcegraph.status.registerStatusProvider(status.name, {
provideStatus: () => status,
})
)
}
return subscriptions
}