-
Notifications
You must be signed in to change notification settings - Fork 24
Docs/add ciach package #374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
solid-illiaaihistov
wants to merge
5
commits into
solid-software:master
Choose a base branch
from
solid-illiaaihistov:docs/add-ciach-package
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a0af2d2
docs: add ciach to Other Notable Packages
72ab29c
docs: add index link and descriptions to rulesets documentation pages
f613944
docs: update custom lints category index, remove notable packages pag…
5c0a632
Merge remote-tracking branch 'upstream/master' into docs/add-ciach-pa…
167d9df
docs: update ciach package description, GitHub link, and feature comp…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,8 @@ | ||
| { | ||
| "label": "Pre-configured rule sets", | ||
| "position": 1 | ||
| "position": 1, | ||
| "link": { | ||
| "type": "generated-index", | ||
| "description": "Pre-configured rule sets for applications and tests." | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| --- | ||
| sidebar_label: Main | ||
| sidebar_position: 1 | ||
| description: Static analysis for application code. | ||
| --- | ||
|
|
||
| # Main | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| --- | ||
| sidebar_label: Test | ||
| sidebar_position: 2 | ||
| description: Static analysis for autotests. | ||
| --- | ||
|
|
||
| # Test | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,8 @@ | ||
| { | ||
| "label": "Custom lints", | ||
| "position": 2 | ||
| "position": 2, | ||
| "link": { | ||
| "type": "generated-index", | ||
| "description": "Custom lint rules provided by solid_lints." | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "label": "Other notable packages", | ||
| "position": 3, | ||
| "link": { | ||
| "type": "generated-index", | ||
| "description": "Tools complementing solid_lints." | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
doc/docusaurus/docs/3_other_notable_packages/code_complexity.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| --- | ||
| sidebar_label: Code complexity | ||
| sidebar_position: 3 | ||
| description: Measure and manage code complexity. | ||
| --- | ||
|
|
||
| # Code Complexity | ||
|
|
||
| Tools and metrics for analyzing algorithmic complexity and cognitive burden | ||
| in Dart and Flutter codebases. | ||
|
|
||
| ## [cognitive_complexity](https://pub.dev/packages/cognitive_complexity) | ||
|
|
||
| [](https://pub.dev/packages/cognitive_complexity) | ||
|
|
||
| Algorithmic Cognitive Complexity calculation and Data-Flow analysis library and | ||
| CLI tools for Dart and Flutter. | ||
|
|
||
| It implements the Cognitive Complexity principles articulated by SonarSource, | ||
| providing an objective way to find and fix overly complex logic and routines. | ||
|
|
||
| - **Links**: [pub.dev](https://pub.dev/packages/cognitive_complexity) · | ||
| [GitHub](https://github.com/kevmoo/analytica.dart/tree/main/packages/cognitive_complexity) | ||
|
|
||
| --- | ||
|
|
||
| ## Comparison: [`cyclomatic_complexity`](../2_custom_lints/cyclomatic_complexity.md) vs `cognitive_complexity` | ||
|
|
||
| Both tools aim to alert you when code becomes too complex to maintain, but they | ||
| evaluate complexity from different angles: | ||
|
|
||
| | | `cyclomatic_complexity` | `cognitive_complexity` | | ||
| | :--- | :--- | :--- | | ||
| | **Complexity angle** | **Structural:** Counts branches and execution paths | **Perceptual:** Evaluates mental effort and readability | | ||
| | **Nesting impact** | Treats all branches equally (+1 per branch) | Penalizes deeper nesting progressively | | ||
| | **When it flags** | Functions with too many execution paths | Functions that are hard for humans to follow | | ||
| | **Tool type** | Real-time IDE lint rule (`solid_lints`) | Standalone CLI tool & analysis library | | ||
|
|
||
| > **💡 Best Together:** Use `cyclomatic_complexity` in `solid_lints` to | ||
| > prevent sprawling branch counts, and `cognitive_complexity` to audit deeply | ||
| > nested routines that are hard to comprehend and maintain. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| --- | ||
| sidebar_label: Dead code | ||
| sidebar_position: 1 | ||
| description: Find and remove unused code. | ||
| --- | ||
|
|
||
| # Dead Code | ||
|
|
||
| Tools for identifying, analyzing, and removing unreachable declarations, | ||
| forgotten APIs, and dead code across Dart and Flutter codebases. | ||
|
|
||
| ## [ciach](https://pub.dev/packages/ciach) | ||
|
|
||
| [](https://pub.dev/packages/ciach) | ||
|
|
||
| A command-line tool acting as a wrapper around the **Dart Analysis Server**. | ||
| It queries the analysis server for explicit references to declarations in | ||
| the project. | ||
|
|
||
| `ciach` excels at deep codebase cleanup, inspecting internal class members, | ||
| methods, constructors, extensions, and fields. | ||
|
|
||
| - **Links**: [pub.dev](https://pub.dev/packages/ciach) · | ||
| [GitHub](https://github.com/leancodepl/ciach) | ||
|
|
||
| --- | ||
|
|
||
| ## [undead](https://pub.dev/packages/undead) | ||
|
|
||
| [](https://pub.dev/packages/undead) | ||
|
|
||
| Deterministic reachability and dead/unused declaration analysis library and | ||
| CLI for Dart and Flutter packages. | ||
|
|
||
| It performs whole-package AST analysis using `package:analyzer` to build a | ||
| reachability graph from known entrypoints to all internal declarations, | ||
| identifying unused top-level declarations, classes, functions, and variables. | ||
|
|
||
| - **Links**: [pub.dev](https://pub.dev/packages/undead) · | ||
| [GitHub](https://github.com/kevmoo/analytica.dart/tree/main/packages/undead) | ||
|
|
||
| --- | ||
|
|
||
| ## Comparison: `ciach` vs `undead` | ||
|
|
||
| | | `ciach` | `undead` | | ||
| | :--- | :--- | :--- | | ||
| | **Detection Engine** | Queries the **Dart Analysis Server** for explicit references to declarations. | Parses AST and builds a **reachability graph** from known entrypoints. | | ||
| | **Analysis Depth** | **Deep:** Scans inside classes, including methods, constructors, extensions, and fields. | **Top-level:** Only identifies unused top-level declarations, classes, functions, and global variables. | | ||
| | **Test Handling** | Scans the included workspace files, including `test/` unless excluded. May flag reflection-invoked tests as dead code. | Recognizes package test suites and test-runner entrypoints; library mode uses public `lib/**` exports as reachability roots. | | ||
| | **Suppressions / Ignores** | ❌ **No inline comments.** (Requires CLI exclusions like `-e 'file'` or `@pragma`) | ✅ **Granular inline comments.** (Via `// undead:ignore` & `_for_file`) | | ||
| | **Auto-Removal** | ✅ **Supported** (via `--remove` flag) | ❌ **Analysis only** | | ||
|
|
||
| ### Summary & Recommendations | ||
|
|
||
| - **Use `ciach`** when you want to aggressively find and clean up unused | ||
| internal methods, fields, and members deep inside your application codebase, | ||
| and you want an automated way to delete them. | ||
| - **Use `undead`** when you are building a reusable package or library and | ||
| want to audit public API reachability, ensuring you don't expose forgotten | ||
| top-level declarations. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.