Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isBug =
danger.github.issue.labels.some((l) => l.name === "bug") ||
danger.github.pr.title.includes("fix") ||
danger.github.pr.title.includes("bug")
if (!hasLabels) {
message("What labels should we add to this PR?")
}
// Fails if the description is too short.
if (!danger.github.pr.body || danger.github.pr.body.length < 10) {
fail(":grey_question: This pull request needs a description.")
}
if (hasLibChanges && !hasLibTestChanges && (isEnhancement || isBug)) {
message("This PR may require new test cases")
}
// Warns if the PR title contains [WIP]
const isWIP = danger.github.pr.title.includes("WIP")
if (isWIP) {
const title = ":construction_worker: Work In Progress"
const idea =
"This PR appears to be a work in progress, and may not be ready to be merged yet."
warn(`${title} - <i>${idea}</i>`)
}
}
if (hasLibChanges && !hasREADMEChanges) {
warn("This pull request updates the library. Should the docs be updated?")
}
/*
Copyright (c) 2018-2019 Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
// @flow
const {message} = require('danger');
message('hello world');
function checkForMilestone() {
// @ts-ignore
if (danger.github.pr.milestone) {
// @ts-ignore
let milestone: Milestone = danger.github.pr.milestone
message(
// @ts-ignore
`You can expect the changes in this PR to be published on ${formatDate(
new Date(milestone.due_on)
)}`
)
} else {
warn(`@tinacms/dev please add to a Milestone before merging `)
}
}
filepath.endsWith("test.js") || filepath.endsWith("test.js.snap"),
).length > 0;
const hasREADMEChanges = danger.git.modified_files.includes("README.md");
if (!isLocal) {
const hasLabels = danger.github.issue.labels.length !== 0;
const isEnhancement =
danger.github.issue.labels.some((l) => l.name === "enhancement") ||
danger.github.pr.title.includes("feature");
const isBug =
danger.github.issue.labels.some((l) => l.name === "bug") ||
danger.github.pr.title.includes("fix") ||
danger.github.pr.title.includes("bug");
if (!hasLabels) {
message("What labels should we add to this PR?");
}
// Fails if the description is too short.
if (!danger.github.pr.body || danger.github.pr.body.length < 10) {
fail(":grey_question: This pull request needs a description.");
}
if (hasLibChanges && !hasLibTestChanges && (isEnhancement || isBug)) {
message("This PR may require new test cases");
}
// Warns if the PR title contains [WIP]
const isWIP = danger.github.pr.title.includes("WIP");
if (isWIP) {
const title = ":construction_worker: Work In Progress";
const idea =
}, thanks for submitting a pull request! :smile_cat:`
);
// Updates to the source require changelog updates
if (modifiedSrc.length > 1 && !changelogChanges) {
warn(`You changed a source file but didn't add to the changelog`);
}
// Pull requests should have descriptions
if (danger.github.pr.body.length === 0) {
warn('Please add a description to your PR');
}
// You added tests :tada:
if (testChanges.length > 0) {
message(':tada: Thanks for working on tests!');
}
schedule(istanbulCoverage());
function handleSuccessfulSubmission() {
message('Thank you so much for contributing your pixel! 💖');
}
const formattedResults = prettyResults(results);
res(`TSLint failed: **@sentry/${packageName}**\n\n${formattedResults}`);
} else {
res('');
}
},
});
});
}),
)).filter(str => str.length);
if (tsLintResult.length) {
tsLintResult.forEach(tsLintFail => {
fail(`${tsLintFail}`);
});
} else {
message('✅ TSLint passed');
}
});
)
}
if (legacyHelpers.created) {
warn(['This PR added helper modules in `lib/` which is deprecated.'].join(''))
} else if (legacyHelpers.edited && !legacyHelperTests.edited) {
warn(
[
'This PR modified helper functions in `lib/` but not accompanying tests. <br>',
"That's okay so long as it's refactoring existing code.",
].join('')
)
}
if (logos.created) {
message(
[
':art: Thanks for submitting a logo. <br>',
'Please ensure your contribution follows our ',
'[guidance](https://github.com/badges/shields/blob/master/doc/logos.md#contributing-logos) ',
'for logo submissions.',
].join('')
)
}
if (capitals.created || underscores.created) {
fail(
[
'JavaScript source files should be named with `kebab-case` ',
'(dash-separated lowercase).',
].join('')
)