Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: documentation
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'docs/**'
- 'mkdocs.yml'
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.0

- Documentation + README.md updates.

## 0.0.2

- Add CodandoTV to the README.md description.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/CodandoTV/eagle-eye/issues)[![Pub Version](https://img.shields.io/pub/v/eagle_eye?style=flat)](https://pub.dev/packages/eagle_eye)

# EagleEye

**EagleEye** is a Dart CLI tool for **detecting architecture violations** in Dart projects.

> ⚠️ **Note:** This tool is under active development and **not yet production-ready**.
📚 Check our documentation [here](https://codandotv.github.io/eagle-eye/).

---

Expand All @@ -28,7 +30,7 @@ cd eagle_eye
⚠ We are working on a better way to distribute the library.

```yaml
dependencies:
dev_dependencies:
eagle_eye:
path: ../eagle_eye
```
Expand Down
75 changes: 75 additions & 0 deletions docs/1-getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Getting started 🚀

## 1. Define rules

- In the root level of you project, you need to create the file `eagle_eye_config.json` at the root level of your flutter/dart project.

```json
[
{
"filePattern": "*/data/model/*",
"noDependsEnabled": true
},
{
"filePattern": "*viewmodel.dart",
"doNotWithPatterns": ["*_screen.dart"]
},
{
"filePattern": "*/util/*_handler.dart",
"noDependsEnabled": true
}
]
```

In my first rule, I’m telling Eagle Eye that no file under the `data/model` path should have dependencies.

The second rule states that my `ViewModels` must not depend on any screen-related files.

I also have a third rule that enforces that our handler classes should not have any dependencies at all.

## 2. Make sure you have a lint rule to avoid relative imports

```yaml
# analysis_options.yaml

analyzer:
errors:
avoid_relative_lib_imports: error
```

In this way, we are forcing the internal imports to have the app name:

```dart
// BAD ❌ (relative import)
import '../utils/helper.dart';
```

```dart
// GOOD ✅ (package import)
import 'package:my_app/utils/helper.dart';
```

Ensure that this lint rule is enabled for EagleEye to function correctly.

## 3. Add Eagle Eye dependency

Add EagleEye to your project in `pubspec.yaml`:

```yaml
# versions available, run `flutter pub outdated`.
dev_dependencies:
...
eagle_eye: ^version
```

## 4. Run the CLI

Now you can run the CLI, or integrate in your CI/CD pipeline as a required step.

```shell
dart run eagle_eye:main
```

--

Any problems you are facing, any suggestions you want to add, please feel free to [reach us out](mailto:gabrielbronzattimoro.es@gmail.com).
44 changes: 44 additions & 0 deletions docs/2-existing-rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Existing rules 📐

We have several rules already defined in the plugin. You can create some rule too, take a look in our section about [contributions](./3-contributions.md).

## DoNotWithRule

The `DoNotWithRule` specifies that a set of file should not depend on certain files. For example:

```json
// your-project-root/eagle_eye_config.json
{
"filePattern": "*viewmodel.dart",
"doNotWithPatterns": ["*_screen.dart"]
},
```

In this case, all files that has the suffix `viewmodel.dart` should not depend on any file whose name includes '_screen.dart'.

## JustWithRule

The `JustWithRule` specifies that some files should depend on certain files. For example:

```json
// your-project-root/eagle_eye_config.json
{
"filePattern": "*repository.dart",
"justWithPatterns": ["*_datasources.dart"]
},
```

In this case, the our repositories should depend only on data sources.

## NoDependencyRule

The `NoDependencyRule` ensures that some files should remain free of any dependencies. For example:

```json
{
"filePattern": "*util.dart",
"noDependsEnabled": true
},
```

In this case, the all utils should be free of any internal dependencies.
9 changes: 9 additions & 0 deletions docs/3-contributions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Contributions 🤝

We encourage contributions of all types! Whether it's reporting issues, suggesting new features, or submitting pull requests, you're welcome to help improve the plugin.

- Check out the [issues](https://github.com/CodandoTV/eagle-eyeg/issues) page for ideas.

- Feel free to submit [pull requests](https://github.com/CodandoTV/eagle-eye/pulls).

🤗 Happy coding!
31 changes: 31 additions & 0 deletions docs/4-tooling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Tooling 🛠️

## Mkdocs-material

### How to run mkdocs locally?

- Create your virtual env:

```shell
python3 -m venv venv
```

- Open the new env:

```shell
source venv/bin/activate
```

- Install mkdocs-material:

```shell
pip install mkdocs-material
```

- Start the local server:

```shell
mkdocs serve --watch .
```

Access your documentation at `http://127.0.0.1:8000/`
Binary file added docs/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/CodandoTV/eagle-eye/issues)[![Pub Version](https://img.shields.io/pub/v/eagle_eye?style=flat)](https://pub.dev/packages/eagle_eye)


# Welcome to the Eagle Eye documentation! 👋

![Eagle Eye Logo](./img/logo.png)

EagleEye is a Dart CLI tool for detecting architecture violations in Dart projects.

Take a look at our [repository](https://github.com/CodandoTV/eagle-eye).

## Summary

### 1. [Getting started](1-getting-started.md)

### 2. [Existing Rules](2-existing-rules.md)

### 3. [Contributions](3-contributions.md)

### 4. [Tooling](4-tooling.md)
55 changes: 55 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
site_name: Eagle eye
repo_url: https://github.com/CodandoTV/eagle-eye
repo_name: EagleEye

theme:
name: material
logo: img/logo.png
font:
text: Merriweather Sans
code: Red Hat Mono
icon:
repo: fontawesome/brands/github
features:
- navigation.footer
- content.code.annotations
- navigation.instant
- content.code.copy
palette:
# Dark Mode
- scheme: slate
toggle:
icon: material/weather-sunny
name: Dark mode
primary: deep purple
accent: light blue

# Light Mode
- scheme: default
toggle:
icon: material/weather-night
name: Light mode
primary: deep purple
accent: blue

markdown_extensions:
- smarty
- codehilite:
guess_lang: false
- footnotes
- meta
- toc:
permalink: true
- pymdownx.betterem:
smart_enable: all
- pymdownx.caret
- pymdownx.inlinehilite
- pymdownx.magiclink
- pymdownx.smartsymbols
- pymdownx.superfences
- pymdownx.emoji
- pymdownx.details
- pymdownx.tabbed:
alternate_style: true
- tables
- admonition
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: eagle_eye
description: "EagleEye is a Dart CLI tool provided by CodandoTV for detecting architecture violations in Dart projects."
homepage: "https://github.com/CodandoTV/eagle-eye"

version: 0.0.2
version: 1.0.0

environment:
sdk: ^3.5.0
Expand Down