Skip to content

Commit

Permalink
CR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eyal Pinkas committed Aug 17, 2020
1 parent 34d8640 commit bd71fd3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

<!-- Your comment below this -->

- 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]

<!-- Your comment above this -->

Expand Down
2 changes: 1 addition & 1 deletion source/commands/ci/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const runRunner = async (app: SharedCLI, config?: Partial<RunnerConfig>)
disableGitHubChecksSupport: !app.useGithubChecks,
failOnErrors: app.failOnErrors,
noPublishCheck: !app.publishCheck,
ignoreInvalidInlineComments: app.ignoreInvalidInlineComments,
noOutOfDiffComments: app.noOutOfDiffComments,
}

const processName = (app.process && addSubprocessCallAguments(app.process.split(" "))) || undefined
Expand Down
2 changes: 1 addition & 1 deletion source/commands/danger-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions source/commands/utils/sharedDangerfileArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand All @@ -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
)
4 changes: 2 additions & 2 deletions source/runner/Executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down Expand Up @@ -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))
}

Expand Down
8 changes: 4 additions & 4 deletions source/runner/_tests/_executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const defaultConfig: ExecutorOptions = {
passURLForDSL: false,
failOnErrors: false,
noPublishCheck: false,
ignoreInvalidInlineComments: false,
noOutOfDiffComments: false,
}

class FakeProcces {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<any>((_, reject) => reject()))
Expand Down

0 comments on commit bd71fd3

Please sign in to comment.