go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

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

Open fondoger opened this issue 1 year ago • 1 comments

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.

fondoger avatar Oct 06 '24 11:10 fondoger

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

codecov[bot] avatar Oct 06 '24 11:10 codecov[bot]

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

kevwan avatar Feb 09 '25 03:02 kevwan

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 avatar Feb 10 '25 03:02 fondoger