diff --git a/CHANGELOG.md b/CHANGELOG.md index e076850a5e..87a33ba1c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * chore: restrict `analyzer` version to `>=4.1.0 <4.5.0`. * chore: restrict `analyzer_plugin` version to `>=0.11.0 <0.12.0`. +* feat: replace relative path in reporters output with absolute to support IDE clicks. ## 4.17.0 diff --git a/lib/src/analyzers/lint_analyzer/reporters/reporters_list/console/lint_console_reporter.dart b/lib/src/analyzers/lint_analyzer/reporters/reporters_list/console/lint_console_reporter.dart index 7be78b626a..0a6c273cdc 100644 --- a/lib/src/analyzers/lint_analyzer/reporters/reporters_list/console/lint_console_reporter.dart +++ b/lib/src/analyzers/lint_analyzer/reporters/reporters_list/console/lint_console_reporter.dart @@ -36,7 +36,7 @@ class LintConsoleReporter extends ConsoleReporter _reportIssues(Iterable issues, String relativePath) => + Iterable _reportIssues(Iterable issues, String absolutePath) => (issues.toList() ..sort((a, b) => a.location.start.offset.compareTo(b.location.start.offset))) - .map((issue) => _helper.getIssueMessage(issue, relativePath)) + .map((issue) => _helper.getIssueMessage(issue, absolutePath)) .expand((lines) => lines); Iterable _reportEntityMetrics(Map reports) => diff --git a/lib/src/analyzers/lint_analyzer/reporters/reporters_list/console/lint_console_reporter_helper.dart b/lib/src/analyzers/lint_analyzer/reporters/reporters_list/console/lint_console_reporter_helper.dart index 2f5971f2b1..c4662b0623 100644 --- a/lib/src/analyzers/lint_analyzer/reporters/reporters_list/console/lint_console_reporter_helper.dart +++ b/lib/src/analyzers/lint_analyzer/reporters/reporters_list/console/lint_console_reporter_helper.dart @@ -30,17 +30,17 @@ class LintConsoleReporterHelper { }; /// Converts an [issue] to the issue message string. - Iterable getIssueMessage(Issue issue, String relativePath) { + Iterable getIssueMessage(Issue issue, String absolutePath) { final severity = _getSeverity(issue.severity); final locationStart = issue.location.start; final location = _linkPen( - '$relativePath:${locationStart.line}:${locationStart.column}', + '$absolutePath:${locationStart.line}:${locationStart.column}', ); final tabulation = _normalize(''); return [ '$severity${issue.message}', - '$tabulation$location', + '${tabulation}at $location', '$tabulation${issue.ruleId} : ${issue.documentation}', '', ]; diff --git a/lib/src/analyzers/unnecessary_nullable_analyzer/reporters/reporters_list/console/unnecessary_nullable_console_reporter.dart b/lib/src/analyzers/unnecessary_nullable_analyzer/reporters/reporters_list/console/unnecessary_nullable_console_reporter.dart index a9b2db7ef4..84e3a77538 100644 --- a/lib/src/analyzers/unnecessary_nullable_analyzer/reporters/reporters_list/console/unnecessary_nullable_console_reporter.dart +++ b/lib/src/analyzers/unnecessary_nullable_analyzer/reporters/reporters_list/console/unnecessary_nullable_console_reporter.dart @@ -37,7 +37,7 @@ class UnnecessaryNullableConsoleReporter extends ConsoleReporter< for (final issue in analysisRecord.issues) { final line = issue.location.line; final column = issue.location.column; - final path = analysisRecord.relativePath; + final path = analysisRecord.path; final offset = ''.padRight(3); final pathOffset = offset.padRight(5); diff --git a/lib/src/analyzers/unused_code_analyzer/reporters/reporters_list/console/unused_code_console_reporter.dart b/lib/src/analyzers/unused_code_analyzer/reporters/reporters_list/console/unused_code_console_reporter.dart index 8c2ac5d8b1..544a035bed 100644 --- a/lib/src/analyzers/unused_code_analyzer/reporters/reporters_list/console/unused_code_console_reporter.dart +++ b/lib/src/analyzers/unused_code_analyzer/reporters/reporters_list/console/unused_code_console_reporter.dart @@ -36,7 +36,7 @@ class UnusedCodeConsoleReporter extends ConsoleReporter