Skip to content
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

feat(cli): handle imports in the migration generator #66

Merged
merged 3 commits into from
Nov 14, 2024

Conversation

m4tx
Copy link
Member

@m4tx m4tx commented Nov 12, 2024

Previously, use statements had to be added manually after generating a migration. This commit adds a simple solution that scans the file for top-level uses, structs and consts so that they are imported automatically.

In addition to that, this adds some tests to the migration generator and some useful options to the CLI (--app-name and --output-dir to override the migration's app name and generator's output directory).

@m4tx m4tx requested review from seqre and Iipin November 12, 2024 15:50
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 87.14859% with 64 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
flareon-cli/src/migration_generator.rs 88.13% 54 Missing ⚠️
flareon-cli/src/main.rs 0.00% 10 Missing ⚠️
Flag Coverage Δ
rust 82.56% <87.14%> (+4.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
flareon-cli/tests/migration_generator.rs 100.00% <100.00%> (ø)
flareon-cli/src/main.rs 0.00% <0.00%> (ø)
flareon-cli/src/migration_generator.rs 69.14% <88.13%> (+69.14%) ⬆️

... and 8 files with indirect coverage changes

@m4tx m4tx force-pushed the migration-generator-imports branch from 15b25c9 to bf95fb8 Compare November 12, 2024 16:20
Previously, `use` statements had to be added manually after generating a
migration. This commit adds a simple solution that scans the file for
top-level `use`s, `struct`s and `const`s so that they are imported
automatically.

In addition to that, this adds some tests to the migration generator and
some useful options to the CLI (--app-name and --output-dir to override
the migration's app name and generator's output directory).
@m4tx m4tx force-pushed the migration-generator-imports branch from bf95fb8 to 374d8dc Compare November 12, 2024 18:35
Copy link
Contributor

@seqre seqre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with few comments

flareon-cli/src/migration_generator.rs Outdated Show resolved Hide resolved
flareon-cli/src/migration_generator.rs Outdated Show resolved Hide resolved
flareon-cli/src/migration_generator.rs Show resolved Hide resolved
@m4tx m4tx merged commit 38123d5 into master Nov 14, 2024
19 checks passed
@m4tx m4tx deleted the migration-generator-imports branch November 14, 2024 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants