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

[dartgen] Add ability to customize format options for dartgen command #4412

Closed

Conversation

fondoger
Copy link
Contributor

@fondoger fondoger commented Oct 6, 2024

Currently, when running goctl api dart ... to generate dart API files, the dart formatter will be triggered automatically. But it always uses the default configurations when formatting the dart files.

This PR adds a feature to allow users to override the default dart format parameters. So the formatted dart file obeys the lint rules of the existing dart project.

Before:

goctl api dart -api server.api -dir ../app/api

=> `dart format <dir>`

After:

goctl api dart -api server.api -dir ../app/api -format-args "--line-length=150"

=> `dart format <dir> --line-length=150`

The current behavior is not affected.

Copy link

codecov bot commented Oct 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.04%. Comparing base (8690859) to head (a925e10).
Report is 260 commits behind head on master.

Additional details and impacted files

see 255 files with indirect coverage changes

@kevwan kevwan force-pushed the fondoger/dart-format-options branch from 5c995b4 to a925e10 Compare October 15, 2024 11:46
@kevwan
Copy link
Contributor

kevwan commented Feb 9, 2025

I think it's better to format dart code in you IDE, otherwise there're lots of command line arguments to add.

@kevwan kevwan added kind/need-more-discussion Not decided, need more discussion! area/goctl Categorizes issue or PR as related to goctl. labels Feb 9, 2025
@fondoger
Copy link
Contributor Author

I think it's better to format dart code in you IDE, otherwise there're lots of command line arguments to add.

Thanks for your reply. I can format the code manually with an additional command dart format <dir>

@fondoger fondoger closed this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/goctl Categorizes issue or PR as related to goctl. kind/need-more-discussion Not decided, need more discussion!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants