Skip to content

Commit

Permalink
Remove extra ! and run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
andybelltree committed Nov 15, 2021
1 parent adfc3ce commit f9a9d65
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23083,7 +23083,7 @@ async function getExistingComments(github, options, context) {
return results.filter(
comment =>
!!comment.user &&
(!!options.title || comment.body.includes(options.title)) &&
(!options.title || comment.body.includes(options.title)) &&
comment.body.includes("Coverage Report"),
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/delete_old_comments.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as core from "@actions/core"

const REQUESTED_COMMENTS_PER_PAGE = 20;
const REQUESTED_COMMENTS_PER_PAGE = 20

export async function deleteOldComments(github, options, context) {
const existingComments = await getExistingComments(github, options, context)
Expand Down Expand Up @@ -37,7 +37,7 @@ async function getExistingComments(github, options, context) {
return results.filter(
comment =>
!!comment.user &&
(!!options.title || comment.body.includes(options.title)) &&
(!options.title || comment.body.includes(options.title)) &&
comment.body.includes("Coverage Report"),
)
}
7 changes: 3 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { parse } from "./lcov"
import { diff } from "./comment"
import { getChangedFiles } from "./get_changes"
import { deleteOldComments } from "./delete_old_comments"
import { normalisePath } from "./util";
import { normalisePath } from "./util"

const MAX_COMMENT_CHARS = 65536;
const MAX_COMMENT_CHARS = 65536

async function main() {
const token = core.getInput("github-token")
Expand Down Expand Up @@ -56,8 +56,7 @@ async function main() {

const lcov = await parse(raw)
const baselcov = baseRaw && (await parse(baseRaw))
const body = diff(lcov, baselcov, options)
.substring(0, MAX_COMMENT_CHARS);
const body = diff(lcov, baselcov, options).substring(0, MAX_COMMENT_CHARS)

if (shouldDeleteOldComments) {
await deleteOldComments(githubClient, options, context)
Expand Down
9 changes: 4 additions & 5 deletions src/tabulate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { th, tr, td, table, tbody, a, b, span, fragment } from "./html"
import { normalisePath } from "./util";
import { normalisePath } from "./util"

// Tabulate the lcov data in a HTML table.
export function tabulate(lcov, options) {
Expand Down Expand Up @@ -38,17 +38,16 @@ function filterAndNormaliseLcov(lcov, options) {
return lcov
.map(file => ({
...file,
file: normalisePath(file.file)
file: normalisePath(file.file),
}))
.filter(file =>
shouldBeIncluded(file.file, options))
.filter(file => shouldBeIncluded(file.file, options))
}

function shouldBeIncluded(fileName, options) {
if (!options.shouldFilterChangedFiles) {
return true
}
return options.changedFiles.includes(fileName.replace(options.prefix, ""));
return options.changedFiles.includes(fileName.replace(options.prefix, ""))
}

function toFolder(path) {
Expand Down
2 changes: 1 addition & 1 deletion src/util.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function normalisePath(file) {
return file.replace(/\\/g, "/")
}
}

0 comments on commit f9a9d65

Please sign in to comment.