flutter_zhiyao_lint 0.0.2 copy "flutter_zhiyao_lint: ^0.0.2" to clipboard
flutter_zhiyao_lint: ^0.0.2 copied to clipboard

outdated

flutter zhiyao lint.

example/example.dart

import 'dart:io';

import 'package:flutter_zhiyao_lint/lint_analyzer.dart';

Future<void> main() async {
  // Get some folder you would like to analyze
  const foldersToAnalyze = ['lib', 'test'];

  // Root folder path is used to resolve relative file paths
  const rootFolder = 'E:\\111work\\code\\code_work\\flutter_zhiyao_lint';


  // First of all config has to be created for a checker
  const config = LintConfig(
    excludePatterns: [
      'test/resources/**',
      'test/**',
      'lib/src/**',
      'lib/analyzer_plugin.dart',
      'lib/config.dart',
      'lib/lint_analyzer.dart',
      'lib/reporters.dart',
      'lib/unused_code_analyzer.dart',
      'lib/unused_files_analyzer.dart',
      'lib/unused_l10n_analyzer.dart',
    ],
    excludeForMetricsPatterns: ['test/**'],
    metrics: {
      'maximum-nesting-level': '5',
      'number-of-methods': '10',
    },
    excludeForRulesPatterns: ['test/**'],
    rules: {
      'double-literal-format': {},
      'newline-before-return': {'severity': 'info'},
    },
    antiPatterns: {'long-method': {}},
  );

  const analyzer = LintAnalyzer();

  final result =
      await analyzer.runCliAnalysis(foldersToAnalyze, rootFolder, config);


  /// report with console
  await analyzer
      .getReporter(name: 'console', output: stdout, reportFolder: '.')
      ?.report(result);

  /// report with html
  // await analyzer
  //     .getReporter(name: 'html', output: stdout, reportFolder: 'report')
  //     ?.report(result);


  /// report with json
  // await analyzer
  //     .getReporter(name: 'json', output: stdout, reportFolder: 'report')
  //     ?.report(result);

}
0
likes
0
points
50
downloads

Publisher

unverified uploader

Weekly Downloads

flutter zhiyao lint.

Homepage

License

unknown (license)

Dependencies

analyzer, analyzer_plugin, ansicolor, args, collection, crypto, file, glob, html, meta, path, source_span, yaml

More

Packages that depend on flutter_zhiyao_lint