Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
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: 1 addition & 6 deletions example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ Future<void> main() async {

// Now pass collected analysis reports from runner to reporter and that's it
await analyzer
.getReporter(
name: 'console',
output: stdout,
config: config,
reportFolder: '.',
)
.getReporter(name: 'console', output: stdout, reportFolder: '.')
?.report(result);

// There is also JsonReporter for making machine-readable reports
Expand Down
4 changes: 2 additions & 2 deletions lib/src/analyzers/lint_analyzer/lint_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ class LintAnalyzer {
const LintAnalyzer();

Reporter? getReporter({
required LintConfig config,
Copy link
Member

Choose a reason for hiding this comment

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

Please revert this changes, it's a breaking change and should be managed accordingly.

Copy link
Member

Choose a reason for hiding this comment

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

You can make it optional though and mark as deprecated.

required String name,
required IOSink output,
required String reportFolder,
@Deprecated('Unused argument. Will be removed in 5.0.0.') // ignore: avoid-unused-parameters
LintConfig? config,
}) =>
reporter(
config: config,
name: name,
output: output,
reportFolder: reportFolder,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ class FileMetricsReport {
final double averageMaintainabilityIndex;
final int maintainabilityIndexViolations;

final int averageMethodsCount;
final int methodsCountViolations;

final int totalCyclomaticComplexity;
final int cyclomaticComplexityViolations;

Expand All @@ -25,8 +22,6 @@ class FileMetricsReport {
required this.argumentsCountViolations,
required this.averageMaintainabilityIndex,
required this.maintainabilityIndexViolations,
required this.averageMethodsCount,
required this.methodsCountViolations,
required this.totalCyclomaticComplexity,
required this.cyclomaticComplexityViolations,
required this.totalSourceLinesOfCode,
Expand Down
29 changes: 11 additions & 18 deletions lib/src/analyzers/lint_analyzer/reporters/reporter_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,31 @@ import '../../../reporters/models/github_reporter.dart';
import '../../../reporters/models/html_reporter.dart';
import '../../../reporters/models/json_reporter.dart';
import '../../../reporters/models/reporter.dart';
import '../lint_config.dart';
import 'reporters_list/code_climate/lint_code_climate_reporter.dart';
import 'reporters_list/console/lint_console_reporter.dart';
import 'reporters_list/github/lint_github_reporter.dart';
import 'reporters_list/html/lint_html_reporter.dart';
import 'reporters_list/json/lint_json_reporter.dart';

final _implementedReports = <String,
Reporter Function(IOSink output, LintConfig config, String reportFolder)>{
ConsoleReporter.id: (output, _, __) => LintConsoleReporter(output),
ConsoleReporter.verboseId: (output, _, __) =>
final _implementedReports =
<String, Reporter Function(IOSink output, String reportFolder)>{
ConsoleReporter.id: (output, _) => LintConsoleReporter(output),
ConsoleReporter.verboseId: (output, _) =>
LintConsoleReporter(output, reportAll: true),
CodeClimateReporter.id: (output, config, _) =>
LintCodeClimateReporter(output, metrics: config.metrics),
HtmlReporter.id: (_, __, reportFolder) => LintHtmlReporter(reportFolder),
JsonReporter.id: (output, _, __) => LintJsonReporter(output),
GitHubReporter.id: (output, _, __) => LintGitHubReporter(output),
CodeClimateReporter.alternativeId: (output, config, _) =>
LintCodeClimateReporter(
output,
metrics: config.metrics,
gitlabCompatible: true,
),
CodeClimateReporter.id: (output, _) => LintCodeClimateReporter(output),
HtmlReporter.id: (_, reportFolder) => LintHtmlReporter(reportFolder),
JsonReporter.id: (output, _) => LintJsonReporter(output),
GitHubReporter.id: (output, _) => LintGitHubReporter(output),
CodeClimateReporter.alternativeId: (output, _) =>
LintCodeClimateReporter(output, gitlabCompatible: true),
};

Reporter? reporter({
required String name,
required IOSink output,
required LintConfig config,
required String reportFolder,
}) {
final constructor = _implementedReports[name];

return constructor != null ? constructor(output, config, reportFolder) : null;
return constructor != null ? constructor(output, reportFolder) : null;
}

This file was deleted.

Loading