Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: fix prospector linter to not fail on unset line number. #399

Merged
merged 1 commit into from
Oct 20, 2016
Merged
Changes from all commits
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
7 changes: 4 additions & 3 deletions src/client/linters/prospector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ export class Linter extends baseLinter.BaseLinter {
let diagnostics: baseLinter.ILintMessage[] = [];
parsedData.messages.filter((value, index) => index <= this.pythonSettings.linting.maxNumberOfProblems).forEach(msg => {

let sourceLine = txtDocumentLines[msg.location.line - 1];
let lineNumber = msg.location.line === null || isNaN(msg.location.line) ? 1 : msg.location.line;
let sourceLine = txtDocumentLines[lineNumber - 1];
let sourceStart = sourceLine.substring(msg.location.character);
let endCol = txtDocumentLines[msg.location.line - 1].length;
let endCol = txtDocumentLines[lineNumber - 1].length;

// try to get the first word from the starting position
let possibleProblemWords = sourceStart.match(/\w+/g);
Expand All @@ -68,7 +69,7 @@ export class Linter extends baseLinter.BaseLinter {
code: msg.code,
message: msg.message,
column: msg.location.character,
line: msg.location.line,
line: lineNumber,
possibleWord: possibleWord,
type: msg.code,
provider: `${this.Id} - ${msg.source}`
Expand Down