diff --git a/CHANGELOG.md b/CHANGELOG.md index 3417aea04..14be26525 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,8 @@ -- Added a CLI option `--ignoreInvalidInlineComments` so that you can ignore inline-comments for invalid lines (e.g - unchanged lines). The comment would be ignored completely - it won't even show in the results commit. [@pinkasey] +- Added a CLI option `--noOutOfDiffComments` so that you can ignore inline-comments for lines that were not changed in + this PR. The comments would be ignored completely - they won't even show in the results comment. [@pinkasey] diff --git a/source/commands/ci/runner.ts b/source/commands/ci/runner.ts index 79e15a4ce..6ee655ade 100644 --- a/source/commands/ci/runner.ts +++ b/source/commands/ci/runner.ts @@ -68,7 +68,7 @@ export const runRunner = async (app: SharedCLI, config?: Partial) disableGitHubChecksSupport: !app.useGithubChecks, failOnErrors: app.failOnErrors, noPublishCheck: !app.publishCheck, - ignoreInvalidInlineComments: app.ignoreInvalidInlineComments, + noOutOfDiffComments: app.noOutOfDiffComments, } const processName = (app.process && addSubprocessCallAguments(app.process.split(" "))) || undefined diff --git a/source/commands/danger-process.ts b/source/commands/danger-process.ts index ccf3dc21e..b707e2fcd 100644 --- a/source/commands/danger-process.ts +++ b/source/commands/danger-process.ts @@ -95,7 +95,7 @@ getRuntimeCISource(app).then(source => { passURLForDSL: app.passURLForDSL || false, disableGitHubChecksSupport: !app.useGithubChecks, failOnErrors: app.failOnErrors, - ignoreInvalidInlineComments: app.ignoreInvalidInlineComments, + noOutOfDiffComments: app.noOutOfDiffComments, } d("Exec config: ", execConfig) diff --git a/source/commands/utils/sharedDangerfileArgs.ts b/source/commands/utils/sharedDangerfileArgs.ts index ab4f8e328..b3e7c04b5 100644 --- a/source/commands/utils/sharedDangerfileArgs.ts +++ b/source/commands/utils/sharedDangerfileArgs.ts @@ -28,7 +28,7 @@ export interface SharedCLI extends program.CommanderStatic { /** Use GitHub Checks */ useGithubChecks: boolean /** Ignore invalid inline-comments, for instance a comment with a line that was not changed */ - ignoreInvalidInlineComments: boolean + noOutOfDiffComments: boolean } export default (command: any) => @@ -46,7 +46,7 @@ export default (command: any) => .option("-f, --failOnErrors", "Fail if there are fails in the danger report", false) .option("--use-github-checks", "Use GitHub Checks", false) .option( - "-iiic, --ignoreInvalidInlineComments", + "--noOutOfDiffComments", "Ignore invalid inline-comments, for instance a comment with a line that was not changed", false ) diff --git a/source/runner/Executor.ts b/source/runner/Executor.ts index ffd041944..d0f4a1129 100644 --- a/source/runner/Executor.ts +++ b/source/runner/Executor.ts @@ -59,7 +59,7 @@ export interface ExecutorOptions { /** Dont add danger check to PR */ noPublishCheck?: boolean /** Ignore invalid inline-comments, for instance a comment with a line that was not changed */ - ignoreInvalidInlineComments: boolean + noOutOfDiffComments: boolean } // This is still badly named, maybe it really should just be runner? @@ -280,7 +280,7 @@ export class Executor { const previousComments = await this.platform.getInlineComments(dangerID) const inline = inlineResults(results) let inlineLeftovers = await this.sendInlineComments(inline, git, previousComments) - inlineLeftovers = this.options.ignoreInvalidInlineComments ? emptyDangerResults : inlineLeftovers + inlineLeftovers = this.options.noOutOfDiffComments ? emptyDangerResults : inlineLeftovers mergedResults = sortResults(mergeResults(mergedResults, inlineLeftovers)) } diff --git a/source/runner/_tests/_executor.test.ts b/source/runner/_tests/_executor.test.ts index 22b1bba74..56b27a5e0 100644 --- a/source/runner/_tests/_executor.test.ts +++ b/source/runner/_tests/_executor.test.ts @@ -27,7 +27,7 @@ const defaultConfig: ExecutorOptions = { passURLForDSL: false, failOnErrors: false, noPublishCheck: false, - ignoreInvalidInlineComments: false, + noOutOfDiffComments: false, } class FakeProcces { @@ -121,7 +121,7 @@ describe("setup", () => { dangerID: "123", passURLForDSL: false, failOnErrors: true, - ignoreInvalidInlineComments: false, + noOutOfDiffComments: false, } const exec = new Executor(new FakeCI({}), platform, inlineRunner, strictConfig, new FakeProcces()) const dsl = await defaultDsl(platform) @@ -191,9 +191,9 @@ describe("setup", () => { expect(platform.createInlineComment).toBeCalled() }) - it("Invalid inline comment is ignored if ignoreInvalidInlineComments is true", async () => { + it("Invalid inline comment is ignored if noOutOfDiffComments is true", async () => { const platform = new FakePlatform() - const config = Object.assign({}, defaultConfig, { ignoreInvalidInlineComments: true }) + const config = Object.assign({}, defaultConfig, { noOutOfDiffComments: true }) const exec = new Executor(new FakeCI({}), platform, inlineRunner, config, new FakeProcces()) const dsl = await defaultDsl(platform) platform.createInlineComment = jest.fn().mockReturnValue(new Promise((_, reject) => reject()))