{"id":29126469,"url":"https://github.com/alexhcjp/markup_analyzer","last_synced_at":"2026-01-11T13:35:07.027Z","repository":{"id":238742516,"uuid":"797442557","full_name":"AlexHCJP/markup_analyzer","owner":"AlexHCJP","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-19T06:08:08.000Z","size":445,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-29T23:34:49.695Z","etag":null,"topics":["flutter","linter"],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexHCJP.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-05-07T20:57:47.000Z","updated_at":"2025-04-05T16:06:58.000Z","dependencies_parsed_at":"2025-01-15T06:50:52.978Z","dependency_job_id":"af496cb1-dcc2-444a-bccb-632553917187","html_url":"https://github.com/AlexHCJP/markup_analyzer","commit_stats":null,"previous_names":["alexhcjp/test_localization","alexhcjp/markup_analyzer","contributors-company/markup_analyzer"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/AlexHCJP/markup_analyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexHCJP%2Fmarkup_analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexHCJP%2Fmarkup_analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexHCJP%2Fmarkup_analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexHCJP%2Fmarkup_analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexHCJP","download_url":"https://codeload.github.com/AlexHCJP/markup_analyzer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexHCJP%2Fmarkup_analyzer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264795838,"owners_count":23665241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flutter","linter"],"created_at":"2025-06-29T23:32:16.654Z","updated_at":"2026-01-11T13:35:07.021Z","avatar_url":"https://github.com/AlexHCJP.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MarkupAnalyzer Lint Rule\n\n![Pub Version](https://img.shields.io/pub/v/markup_analyzer)\n![License](https://img.shields.io/github/license/AlexHCJP/markup_analyzer)\n![Issues](https://img.shields.io/github/issues/AlexHCJP/markup_analyzer)\n[![codecov](https://codecov.io/gh/AlexHCJP/markup_analyzer/graph/badge.svg?token=UYEMR670IR)](https://codecov.io/gh/AlexHCJP/markup_analyzer)\n![Stars](https://img.shields.io/github/stars/AlexHCJP/markup_analyzer)\n\n## Description\n\n`Markup Analyzer` is a customizable lint rule for the [`custom_lint`](https://pub.dev/packages/custom_lint) package in Dart/Flutter. It allows you to prohibit specific types of string expressions in the parameters of Flutter widgets.\n\nThis rule enables you to control the usage of string expressions such as simple string literals, interpolations, binary expressions, and others based on your configuration.\n\n\n- [MarkupAnalyzer Lint Rule](#markupanalyzer-lint-rule)\n  - [Description](#description)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n  - [Usage](#usage)\n  - [Examples](#examples)\n    - [1. Simple String Literals (`simple`)](#1-simple-string-literals-simple)\n    - [2. Prefixed Identifiers (`prefixed_identifier`)](#2-prefixed-identifiers-prefixed_identifier)\n    - [3. String Interpolation (`interpolation`)](#3-string-interpolation-interpolation)\n    - [4. Binary Expressions (`binary`)](#4-binary-expressions-binary)\n    - [5. Adjacent Strings (`adjacent`)](#5-adjacent-strings-adjacent)\n    - [6. Method Invocations (`method`)](#6-method-invocations-method)\n    - [7. Simple Identifiers (`simple_identifier`)](#7-simple-identifiers-simple_identifier)\n    - [8. Function Invocations (`function`)](#8-function-invocations-function)\n\n## Installation\n\n1. **Add the package to your project's dependencies:**\n\n   Add the following to your project's `pubspec.yaml` under `dev_dependencies`:\n\n   ```yaml\n   dev_dependencies:\n     custom_lint: \n     markup_analyzer: ^latest_version\n   ```\n\n2. **Get the dependencies:**\n\n   ```bash\n   flutter pub get\n   ```\n\n3. **Activate the plugin in `analysis_options.yaml`:**\n\n   Create or update the `analysis_options.yaml` file at the root of your project:\n\n   ```yaml\n   analyzer:\n     plugins:\n       - custom_lint\n\n   custom_lint:\n     rules:\n       - markup_analyzer\n   ```\n\n## Configuration\n\nYou can configure the `MarkupAnalyzer` rule via `analysis_options.yaml` by specifying which types of string expressions should be prohibited and the severity level of the error.\n\nExample of a full configuration:\n\n```yaml\ncustom_lint:\n  rules:\n    - markup_analyzer:\n      simple: error\n      interpolation: warning\n      binary: warning\n      adjacent: warning\n      prefixed_identifier: none\n      method: none\n      simple_identifier: none\n      function: none\n```\n\n## Usage\n\nAfter setting up the plugin and configuring the rules, run the analyzer on your project:\n\n```bash\ndart run custom_lint\n```\n\nAll rule violations will be displayed in the console and highlighted in your IDE if it supports `custom_lint`.\n\n\n## Examples\n\n### 1. Simple String Literals (`simple`)\n\n**Configuration:**\n\n  ```yaml\ncustom_lint:\n  rules:\n    markup_analyzer:\n      simple: error\n  ```\n\n  ```dart\n  // BAD\n  Text('Hello, world!'); // Simple string literal is prohibited.\n\n  // OR GOOD\n  Text(AppLocalizations.of(context).greeting)\n  ```\n\n### 2. Prefixed Identifiers (`prefixed_identifier`)\n\n**Configuration:**\n\n  ```yaml\ncustom_lint:\n  rules:\n    markup_analyzer:\n      prefixed_identifier: error\n  ```\n\n  ```dart\n  // ERROR\n  Text(widget.title); // Prefixed identifier is prohibited.\n  ```\n\n### 3. String Interpolation (`interpolation`)\n\n**Configuration:**\n\n  ```yaml\ncustom_lint:\n  rules:\n    markup_analyzer:\n      interpolation: error\n  ```\n\n  ```dart\n  // BAD\n  Text('Hello, $name!'); // String interpolation is prohibited.\n\n  // GOOD\n  Text(AppLocalizations.of(context).helloWithName(name)); // Use string concatenation instead.\n  ```\n\n### 4. Binary Expressions (`binary`)\n\n**Configuration:**\n\n  ```yaml\ncustom_lint:\n  rules:\n    markup_analyzer:\n      binary: error\n  ```\n\n\n  ```dart\n  // ERROR\n  Text('Hello, ' + 'world!'); // Binary expression with '+' is prohibited.\n  ```\n\n### 5. Adjacent Strings (`adjacent`)\n\n**Configuration:**\n\n  ```yaml\ncustom_lint:\n  rules:\n    markup_analyzer:\n      adjacent: error\n  ```\n\n  ```dart\n  // ERROR\n  Text(\n  'Hello, '\n  'world!'\n  ); // Adjacent strings are prohibited.\n  ```\n\n### 6. Method Invocations (`method`)\n\n**Configuration:**\n\n  ```yaml\ncustom_lint:\n  rules:\n    markup_analyzer:\n      method: error\n  ```\n\n  ```dart\n  // BAD\n  Text('hello'.tr()); // Method invocation is prohibited.\n\n  //GOOD\n  Text(AppLocalizations.of(context).hello)\n  ```\n\n### 7. Simple Identifiers (`simple_identifier`)\n\n**Configuration:**\n\n  ```yaml\ncustom_lint:\n  rules:\n    markup_analyzer:\n      simple_identifier: error\n  ```\n\n  ```dart\n  // ERROR\n  Text(title); // Simple identifier is prohibited.\n  ```\n\n### 8. Function Invocations (`function`)\n\n**Configuration:**\n\n  ```yaml\ncustom_lint:\n  rules:\n    markup_analyzer:\n      function: error\n  ```\n\n  ```dart\n  // ERROR\n  Text(() { return 'Hello' } ()); // Function invocation is prohibited.\n\n  ```\n\n\n\n\u003cimg align=\"left\" src = \"https://profile-counter.glitch.me/markup_analyzer/count.svg\" alt =\"Loading\"\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexhcjp%2Fmarkup_analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexhcjp%2Fmarkup_analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexhcjp%2Fmarkup_analyzer/lists"}