replacing all danger mutable lets with const
This commit is contained in:
parent
7d120f94f6
commit
ba5d6c9108
|
@ -13,7 +13,7 @@ const github = danger.github
|
||||||
const user = pr.user.login
|
const user = pr.user.login
|
||||||
const modified = danger.git.modified_files
|
const modified = danger.git.modified_files
|
||||||
const created = danger.git.created_files
|
const created = danger.git.created_files
|
||||||
let editedFiles = [...modified, ...created]
|
const editedFiles = [...modified, ...created]
|
||||||
|
|
||||||
// Check that the PR has a description
|
// Check that the PR has a description
|
||||||
if (pr.body.length == 0) {
|
if (pr.body.length == 0) {
|
||||||
|
@ -30,10 +30,10 @@ const changelogAllowList = [
|
||||||
"dependabot[bot]",
|
"dependabot[bot]",
|
||||||
]
|
]
|
||||||
|
|
||||||
let requiresChangelog = !changelogAllowList.includes(user)
|
const requiresChangelog = !changelogAllowList.includes(user)
|
||||||
|
|
||||||
if (requiresChangelog) {
|
if (requiresChangelog) {
|
||||||
let changelogFiles = editedFiles.filter(file => file.startsWith("changelog.d/"))
|
const changelogFiles = editedFiles.filter(file => file.startsWith("changelog.d/"))
|
||||||
|
|
||||||
if (changelogFiles.length == 0) {
|
if (changelogFiles.length == 0) {
|
||||||
warn("Please add a changelog. See instructions [here](https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog)")
|
warn("Please add a changelog. See instructions [here](https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog)")
|
||||||
|
@ -77,18 +77,18 @@ const allowList = [
|
||||||
"yostyle",
|
"yostyle",
|
||||||
]
|
]
|
||||||
|
|
||||||
let requiresSignOff = !allowList.includes(user)
|
const requiresSignOff = !allowList.includes(user)
|
||||||
|
|
||||||
if (requiresSignOff) {
|
if (requiresSignOff) {
|
||||||
let hasPRBodySignOff = pr.body.includes(signOff)
|
const hasPRBodySignOff = pr.body.includes(signOff)
|
||||||
let hasCommitSignOff = danger.git.commits.every(commit => commit.message.includes(signOff))
|
const hasCommitSignOff = danger.git.commits.every(commit => commit.message.includes(signOff))
|
||||||
if (!hasPRBodySignOff && !hasCommitSignOff) {
|
if (!hasPRBodySignOff && !hasCommitSignOff) {
|
||||||
fail("Please add a sign-off to either the PR description or to the commits themselves.")
|
fail("Please add a sign-off to either the PR description or to the commits themselves.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for screenshots on view changes
|
// Check for screenshots on view changes
|
||||||
let hasChangedViews = editedFiles.filter(file => file.includes("/layout")).length > 0
|
const hasChangedViews = editedFiles.filter(file => file.includes("/layout")).length > 0
|
||||||
if (hasChangedViews) {
|
if (hasChangedViews) {
|
||||||
if (!pr.body.includes("user-images")) {
|
if (!pr.body.includes("user-images")) {
|
||||||
warn("You seem to have made changes to views. Please consider adding screenshots.")
|
warn("You seem to have made changes to views. Please consider adding screenshots.")
|
||||||
|
@ -96,7 +96,7 @@ if (hasChangedViews) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for pngs on resources
|
// Check for pngs on resources
|
||||||
let hasPngs = editedFiles.filter(file => file.toLowerCase().endsWith(".png")).length > 0
|
const hasPngs = editedFiles.filter(file => file.toLowerCase().endsWith(".png")).length > 0
|
||||||
if (hasPngs) {
|
if (hasPngs) {
|
||||||
warn("You seem to have made changes to some images. Please consider using an vector drawable.")
|
warn("You seem to have made changes to some images. Please consider using an vector drawable.")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue