Skip to content

Commit

Permalink
Normalize the filepath so VS's error list has the correct interaction…
Browse files Browse the repository at this point in the history
  • Loading branch information
WGroenestein authored and adidahiya committed Aug 22, 2017
1 parent a66fc77 commit d63a434
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/formatters/msbuildFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
* limitations under the License.
*/

import * as path from "path";

import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";

import { camelize, dedent } from "../utils";

export class Formatter extends AbstractFormatter {
Expand All @@ -36,7 +37,7 @@ export class Formatter extends AbstractFormatter {

public format(failures: RuleFailure[]): string {
const outputLines = failures.map((failure: RuleFailure) => {
const fileName = failure.getFileName();
const fileName = path.normalize(failure.getFileName());
const failureString = failure.getFailure();
const camelizedRule = camelize(failure.getRuleName());

Expand Down
3 changes: 2 additions & 1 deletion test/formatters/msbuildFormatterTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import { assert } from "chai";
import * as path from "path";
import * as ts from "typescript";

import { IFormatter, TestUtils } from "../lint";
Expand Down Expand Up @@ -55,6 +56,6 @@ describe("MSBuild Formatter", () => {
});

function getFailureString(file: string, line: number, character: number, reason: string, ruleCamelCase: string, severity: string) {
return `${file}(${line},${character}): ${severity} ${ruleCamelCase}: ${reason}\n`;
return `${path.normalize(file)}(${line},${character}): ${severity} ${ruleCamelCase}: ${reason}\n`;
}
});

0 comments on commit d63a434

Please sign in to comment.