搜索插件、代码仓与 APP 分类

插件详情v0.0.2

flutterando_analysis

Flutter 和 Dart 的代码检查规则,专为 Flutterando 社区的开源项目创建。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
352
喜欢数
24
Pub 分数
160

安装插件

flutter pub add flutterando_analysis

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一套专为 Flutterando 社区内的开源项目量身定制的自定义 lint 规则,适用于 Flutter 和 Dart。这些规则旨在促进代码的一致性、可读性和最佳实践,适用于 Flutter 应用程序。该包与 Dart 分析工具无缝集成,并针对现代 Flutter 开发标准进行了优化。它通过强制执行社区驱动的规范并及早发现常见问题,帮助维护高质量的代码库。

适合场景

  • 在开源Flutter项目中强制执行一致的编码风格
  • 通过社区认可的 lint 规则提升代码质量
  • 在CI/CD流水线中集成标准化检查
  • 支持团队范围内的代码库一致性
  • 自动检测 Flutter/Dart 代码中的反模式

主要特点

  • 社区驱动的代码检查规则
  • 专为 Flutter 和 Dart 最佳实践量身定制
  • 通过 pub add 轻松集成
  • 与所有主要平台兼容
  • 可扩展且易于维护的配置

适合对象

  • 开源 Flutter 开发者
  • 维护大型 Flutter 代码库的团队
  • 致力于高代码质量的项目
  • 使用静态分析的 CI/CD 环境
  • 遵循 Flutterando 编码规范的开发者

使用建议

  • 需要了解 Dart linter 配置
  • 可能需要为非-Flutterando 项目进行自定义
  • 依赖于 analysis_options.yaml 中的正确设置
  • 不建议在没有额外的 linter 设置的情况下独立使用
  • 最好与其他优质工具(如 flutter_lints)配合使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Flutterando Analysis


Logo

This package provides lint rules for Dart and Flutter which are used in Flutterando's packages and projects. For more information, see the complete list of options.

Report Bug · Request Feature


Version Pub Points Pub Points

Pub Publisher



Table of Contents
  1. About The Project
  2. Sponsors
  3. How to Use
  4. How to Supress Lints
  5. Badge
  6. Contributing
  7. Contact
  8. Acknowledgements


About The Project


Flutterando Analysis are a set of Flutter and Dart Lint rules that are the basis of our projects here at the community. They were inspired and selected from our work experience with other companies, and are backed up by several senior Flutter developers that can guarantee it's usefullness.

This project is distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Sponsors

Logo

(back to top)


How To Use

To use our linter rules import it to your project like this:

a) Adding the package as a dependency in your Pubspec.yaml:

# Add it as a dev dependency
dev_dependencies:
  flutterando_analysis: ^0.0.2

# Or as a normal dependency if you need to
dependencies: 
  flutterando_analysis: ^0.0.2

b) Alternatively, use Dart Pub. You can take out the tag --dev if you want to install as a normal dependency:

  dart pub add --dev flutterando_analysis

After importing it, add an include in your project's analysis_options.yaml:

include: package:flutterando_analysis/flutter.yaml

or, for Dart:

include: package:flutterando_analysis/dart.yaml

There are 4 sets of linter rules that you can choose from:

  • dart.yaml

  • flutter.yaml

  • dart_package.yaml

  • flutter_package.yaml (this second set has the rule "public_member_api_docs" set to True)

See also the analysis_options.0.0.1.yaml to know which rules we are using.


How To Suppress Lints

There may be cases where specific lint rules are undesirable. Lint rules can be suppressed at the line, file, or project level.

An example use case for suppressing lint rules at the file level is suppressing the prefer_const_constructors in order to achieve 100% code coverage. This is due to the fact that const constructors are executed before the tests are run, resulting in no coverage collection.

Line Level

To suppress a specific lint rule for a specific line of code, use an ignore comment directly above the line:

// ignore: public_member_api_docs
class A {}
File Level

To suppress a specific lint rule of a specific file, use an ignore_for_file comment at the top of the file:

// ignore_for_file: public_member_api_docs

class A {}

class B {}
Project Level

To suppress a specific lint rule for an entire project, modify analysis_options.yaml:

Example (change flutterando_analysis.yaml for the analysis file you are using, like in the Getting Started section above):

include: package:flutterando_analysis/flutterando_analysis.yaml
linter:
  rules:
    public_member_api_docs: false

(back to top)


Badge

To indicate that your project is using flutterando_analysis you can use this badge:


Just copy and paste in your readme.md the code below:

[![style: Flutterando analysis](https://img.shields.io/badge/style-flutterando__analysis-blueviolet)](https://pub.dev/packages/flutterando_analysis)

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better or questions, please open an issue here, with the appropriate tag. Don't forget to give the project a star! Thanks!

Remember to include a tag, and to follow Conventional Commits and Semantic Versioning when uploading your commit and/or creating the issue.

(back to top)

Contact

Flutterando Community

(back to top)

Acknowledgements

Thanks to the people who contributed to this project.

Disclaimer: this project's readme was based on very_good_analysis' readme.


(back to top)

Maintaned by


Built and maintained by Flutterando.

所属分类

源码仓库

使用此插件的项目