replacing all danger mutable lets with const

This commit is contained in:
Adam Brown 2022-08-02 12:19:16 +01:00
parent 7d120f94f6
commit ba5d6c9108

View file

@ -13,7 +13,7 @@ const github = danger.github
const user = pr.user.login
const modified = danger.git.modified_files
const created = danger.git.created_files
let editedFiles = [...modified, ...created]
const editedFiles = [...modified, ...created]
// Check that the PR has a description
if (pr.body.length == 0) {
@ -30,10 +30,10 @@ const changelogAllowList = [
"dependabot[bot]",
]
let requiresChangelog = !changelogAllowList.includes(user)
const requiresChangelog = !changelogAllowList.includes(user)
if (requiresChangelog) {
let changelogFiles = editedFiles.filter(file => file.startsWith("changelog.d/"))
const changelogFiles = editedFiles.filter(file => file.startsWith("changelog.d/"))
if (changelogFiles.length == 0) {
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",
]
let requiresSignOff = !allowList.includes(user)
const requiresSignOff = !allowList.includes(user)
if (requiresSignOff) {
let hasPRBodySignOff = pr.body.includes(signOff)
let hasCommitSignOff = danger.git.commits.every(commit => commit.message.includes(signOff))
const hasPRBodySignOff = pr.body.includes(signOff)
const hasCommitSignOff = danger.git.commits.every(commit => commit.message.includes(signOff))
if (!hasPRBodySignOff && !hasCommitSignOff) {
fail("Please add a sign-off to either the PR description or to the commits themselves.")
}
}
// 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 (!pr.body.includes("user-images")) {
warn("You seem to have made changes to views. Please consider adding screenshots.")
@ -96,7 +96,7 @@ if (hasChangedViews) {
}
// 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) {
warn("You seem to have made changes to some images. Please consider using an vector drawable.")
}