Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

vsoFormatter: don't duplicate output for fixed failures #3348

Merged
merged 2 commits into from
Oct 20, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/formatters/vsoFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ export class Formatter extends AbstractFormatter {
};
/* tslint:enable:object-literal-sort-keys */

public format(failures: RuleFailure[], warnings: RuleFailure[] = []): string {
const all = failures.concat(warnings);

const outputLines = all.map((failure: RuleFailure) => {
public format(failures: RuleFailure[]): string {
const outputLines = failures.map((failure: RuleFailure) => {
const fileName = failure.getFileName();
const failureString = failure.getFailure();
const lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
Expand Down
2 changes: 1 addition & 1 deletion test/formatters/vsoFormatterTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("VSO Formatter", () => {
getFailureString(TEST_FILE, 2, 12, "mid failure", "mid-name") +
getFailureString(TEST_FILE, 9, 2, "last failure", "last-name");

const actualResult = formatter.format(failures);
const actualResult = formatter.format(failures, failures);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is confusing to read -- the second argument is fixes but it's called failures here. you might want to write a separate test to validate that passing in fixes as a second argument doesn't create excess formatter output, or at least leave a comment here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a separate test where I duplicate the failures array to pass them as fixes

assert.equal(actualResult, expectedResult);
});

Expand Down