搜尋套件、儲存庫與 APP 分類

套件詳情v2.34.0

dart_code_metrics_presets

DCM 的預設預設,一個用於 Flutter 開發團隊的程式碼品質工具。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
11.8萬
喜歡數
39
Pub 分數
150

安裝套件

flutter pub add dart_code_metrics_presets

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Dart Code Metrics (DCM) 是一款專為幫助 Flutter 開發團隊維持一致的程式碼標準而設計的程式碼品質工具。此集合包含一組預先定義的設定預設,針對不同專案類型與團隊偏好提供即用型規則集,簡化了程式碼風格、複雜度與可維護性最佳實務的設定與執行。透過與 DCM 整合,團隊可快速套用符合產業標準的指引,無需手動設定。該套件支援所有主要平台,非常適合跨平台 Flutter 專案。

適用情境

  • 在團隊間強制執行一致的程式碼風格
  • 在CI/CD流程中自動化程式碼品質檢查
  • 透過標準化規則引導新開發人員
  • 在大型Flutter應用中提高代碼可維護性
  • 自定義適用於特定專案需求的 linting 规則

主要特色

  • 預定義且經過實戰測試的預設
  • 透過 pub add 輕鬆整合
  • 支援所有 Flutter 平台
  • 遵循 Dart 與 Flutter 最佳實務
  • 可擴展以進行自訂設定

適合對象

  • Flutter 團隊優先考慮程式碼品質
  • 需要自動化 linting 的 CI/CD 環境
  • 需要快速設置的新 Flutter 項目
  • 採用標準化編碼規範的團隊
  • 尋求最小設定開銷的開發者

使用建議

  • 需要安裝 Dart Code Metrics
  • 預設可能需要根據特定專案需求進行調整
  • 不是獨立的 linter;依賴 DCM 執行時
  • 預設定義內的自訂有限
  • 最佳搭配團隊範圍的文件使用

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Pub Version License package publisher

DCM Presets

DCM is an advanced linter for Dart and Flutter that helps you analyze and improve your code quality. You can find all available lint rules here.

This repository contains a list of predefined DCM presets for lints:

  • All: contains all available lint rules for Dart and Flutter.
  • Recommended: contains recommended Dart and Flutter rules (with an emphasis on finding errors).
  • Dart: contains all lint rules applicable to any Dart app.
  • Flutter: contains all lint rules applicable to any Flutter app.
  • Pub: contains all lint rules for linting the pubspec.yaml files.
  • Flame: contains all lint rules for the Flame package.
  • Provider: contains all lint rules for the Provider package.
  • Bloc: contains all lint rules for the Bloc package.
  • Riverpod: contains all lint rules for the Riverpod package.
  • Equatable: contains all lint rules for the Equatable package.
  • Patrol: contains all lint rules for the Patrol package.
  • FakeAsync: contains all lint rules for the FakeAsync package.
  • Mocktail: contains all lint rules for the Mocktail package.
  • GetIt: contains all lint rules for the GetIt package.
  • JsonSerializable: contains all lint rules for the JsonSerializable package.
  • FlutterHooks: contains all lint rules for the FlutterHooks package.
  • FirebaseAnalytics: contains all lint rules for the FirebaseAnalytics package.
  • GetX: contains all lint rules for the GetX package.
  • Intl: contains all lint rules for the Intl package.
  • EasyLocalization: contains all lint rules for the EasyLocalization package.

and for metrics:

  • All Metrics: contains all available metrics with recommended default thresholds.
  • Recommended metrics: contains recommended metrics with default thresholds.

How to use a preset

Take these steps to enable a preset:

  1. Install this package as a dev dependency:

    dart pub add --dev dart_code_metrics_presets
    

    or:

    flutter pub add --dev dart_code_metrics_presets
    
  2. For DCM configuration add the extents entry:

    dart_code_metrics:
      extends:
        - package:dart_code_metrics_presets/all.yaml
    

Disabling or reconfiguring a rule from the preset

To disable a rule, simply set its value to false:

dart_code_metrics:
  extends:
    - package:dart_code_metrics_presets/all.yaml
  rules:
    - avoid-banned-imports: false

To reconfigure a rule, that is included into a preset:

dart_code_metrics:
  extends:
    - package:dart_code_metrics_presets/all.yaml
  rules:
    - arguments-ordering:
        child-last: true

Defining a custom preset

Any other preset can be passed to the extends entry. To create a custom preset create a yaml file with the same structure as for regular DCM configuration.

所屬分類

原始碼儲存庫

使用此套件的專案