google / google/built_value.dart

Enforce dart_style's non-whitespace style fixes, i.e., dart format . --fix

Open
#1,086 3 comments 1 reaction 1 assignee Claimed by @davidmorgan View on GitHub
p2 / feature request
Dominant language
Dart
Stars
886
Forks
195
Avg merge
1d 11h
Merged PRs (30d)
4

Description

I have my `*.g.dart` files committed in git, and I have `dart format . --fix` running in CI. I would like it if the code generated by built_value followed the advice found in dart format's --fix rules.

```
> dart help format
...
--fix Apply all style fixes.
```

- https://github.com/dart-lang/dart_style#style-fixes
- https://github.com/dart-lang/dart_style/blob/2.0.3/lib/src/style_fix.dart

To see what this looks like, try a fresh clone of built_value and try `dart format . --fix` there.

For example,

```diff
modified example/lib/values.g.dart
@@ -6,16 +6,16 @@ part of values;
// BuiltValueGenerator
// **************************************************************************

-Serializer _$simpleValueSerializer = new _$SimpleValueSerializer();
+Serializer _$simpleValueSerializer = _$SimpleValueSerializer();
```

I didn't attempt to dig deep into the issue, I don't know if a related issue can be filed with source_gen, for example.

I'll try the following as a quick fix:

```
dart format $(find . \( -name '*.dart' ! -name '*.g.dart' \)) --fix
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.