Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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: {
kind: sourcegraph.MarkupKind.Markdown,
value: `Notify **@sourcegraph/devops** of changes to Travis CI configuration`,
},
},
diagnostics: diagnosticCollection,
})),
startWith({
hover: { markdown: { text: string }; range: sourcegraph.Range }
}>({
doc,
query,
position,
})
if (!lsifObj) {
return undefined
}
return {
value: {
contents: {
value: lsifObj.hover.markdown.text,
kind: sourcegraph.MarkupKind.Markdown,
},
range: lsifObj.hover.range,
},
}
}
message: 'Running ESLint...',
}
: {
completion: sourcegraph.CheckCompletion.Completed,
result:
diagnostics.length > 0
? sourcegraph.CheckResult.Failure
: sourcegraph.CheckResult.Success,
message:
diagnostics.length > 0
? 'ESLint problems found'
: 'Code is compliant with ESLint',
},
sections: {
settings: {
kind: sourcegraph.MarkupKind.Markdown,
value: `
- Use \`eslint@6.0.1\`
- Check for new, recommended ESLint rules
- Ignore projects with only JavaScript files`,
},
/*notifications: {
kind: sourcegraph.MarkupKind.Markdown,
value: `
- Fail changesets that add code not checked by ESLint
- Notify **@felixfbecker** of new ESLint rules`,
},*/
},
}
return info
})
),
result:
diagnostics.length > 0
? sourcegraph.CheckResult.Failure
: sourcegraph.CheckResult.Success,
message:
diagnostics.length > 0
? 'Unapproved npm dependencies found'
: 'All in-use npm dependencies are approved',
},
sections: {
settings: {
kind: sourcegraph.MarkupKind.Markdown,
value: `Require explicit approval for all npm dependencies`,
},
notifications: {
kind: sourcegraph.MarkupKind.Markdown,
value: `Fail changesets that add unapproved npm dependencies`,
},
},
notifications: sortBy(Array.from(deps.entries()), 0)
.filter(([, depStatus]) => depStatus !== DependencyStatus.Allowed)
.map(([depName, depStatus]) => ({
title:
depStatus === DependencyStatus.Unreviewed
? `Unreviewed npm dependency in use: ${depName}`
: `Forbidden npm dependency in use: ${depName}`,
type:
depStatus === DependencyStatus.Unreviewed
? sourcegraph.NotificationType.Warning
: sourcegraph.NotificationType.Error,
})),
}
map(diagnostics => {
const info: sourcegraph.CheckInformation = {
description: {
kind: sourcegraph.MarkupKind.Markdown,
value: 'Checks code using ESLint, an open-source JavaScript linting utility.',
},
state:
diagnostics === LOADING
? {
completion: sourcegraph.CheckCompletion.InProgress,
message: 'Running ESLint...',
}
: {
completion: sourcegraph.CheckCompletion.Completed,
result:
diagnostics.length > 0
? sourcegraph.CheckResult.Failure
: sourcegraph.CheckResult.Success,
message:
diagnostics.length > 0
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: {
kind: sourcegraph.MarkupKind.Markdown,
value: `Notify **@sourcegraph/devops** of changes to Travis CI configuration`,
},
},
diagnostics: diagnosticCollection,
})),
startWith({
const commands = new ExtCommands(proxy('commands'))
handleRequests(connection, 'commands', commands)
const storage = new ExtStorage(proxy('storage'))
handleRequests(connection, 'storage', storage)
const api: typeof sourcegraph = {
URI,
Position,
Range,
Selection,
Location,
MarkupKind: {
PlainText: sourcegraph.MarkupKind.PlainText,
Markdown: sourcegraph.MarkupKind.Markdown,
},
app: {
get activeWindow(): sourcegraph.Window | undefined {
return windows.getActive()
},
get windows(): sourcegraph.Window[] {
return windows.getAll()
},
createPanelView: id => views.createPanelView(id),
},
workspace: {
get textDocuments(): sourcegraph.TextDocument[] {
return documents.getAll()
},
map(diagnostics => {
const info: sourcegraph.CheckInformation = {
description: {
kind: sourcegraph.MarkupKind.Markdown,
value:
'Checks for code duplication using [**jscpd**](https://github.com/kucherenko/jscpd), a copy-paste detector with support for 150+ languages.',
},
state:
diagnostics === LOADING
? {
completion: sourcegraph.CheckCompletion.InProgress,
message: 'Running jscpd...',
}
: {
completion: sourcegraph.CheckCompletion.Completed,
result:
diagnostics.length > 0
? sourcegraph.CheckResult.Failure
: sourcegraph.CheckResult.Success,
message:
? {
completion: sourcegraph.CheckCompletion.InProgress,
message: 'Running jscpd...',
}
: {
completion: sourcegraph.CheckCompletion.Completed,
result:
diagnostics.length > 0
? sourcegraph.CheckResult.Failure
: sourcegraph.CheckResult.Success,
message:
diagnostics.length > 0 ? 'Duplicated code found' : 'No duplicated code found',
},
sections: {
settings: {
kind: sourcegraph.MarkupKind.Markdown,
value: `
- Use \`jscpd@2.0.15\`
- Ignore test code
- Ignore vendored code`,
},
},
}
return info
})
),
const search = new ExtSearch(proxy('search'))
handleRequests(connection, 'search', search)
const commands = new ExtCommands(proxy('commands'))
handleRequests(connection, 'commands', commands)
return {
URI,
Position,
Range,
Selection,
Location,
MarkupKind: {
PlainText: sourcegraph.MarkupKind.PlainText,
Markdown: sourcegraph.MarkupKind.Markdown,
},
app: {
get activeWindow(): sourcegraph.Window | undefined {
return windows.getActive()
},
get windows(): sourcegraph.Window[] {
return windows.getAll()
},
createPanelView: id => views.createPanelView(id),
},
workspace: {
get textDocuments(): sourcegraph.TextDocument[] {
return documents.getAll()
},