Seiichi Uchida
d4ffd1efa4
Support @generated marker to skip code formatting
...
This is a copy of #4296 with these changes:
* file is not reopened again to find if the file is generated
* first five lines are scanned for `@generated` marker instead of one
* no attempt is made to only search for marker in comments
`@generated` marker is used by certain tools to understand that the
file is generated, so it should be treated differently than a file
written by a human:
* linters should not be invoked on these files,
* diffs in these files are less important,
* and these files should not be reformatted.
This PR proposes builtin support for `@generated` marker.
I have not found a standard for a generated file marker, but:
* Facebook [uses `@generated` marker](https://tinyurl.com/fb-generated )
* Phabricator tool which was spawned from Facebook internal tool
[also understands `@generated` marker](https://git.io/JnVHa )
* Cargo inserts `@generated` marker into [generated Cargo.lock files](https://git.io/JnVHP )
My personal story is that rust-protobuf project which I maintain
was broken twice because of incompatibilities/bugs in rustfmt marker
handling: [one](https://github.com/stepancheg/rust-protobuf/issues/493 ),
[two](https://github.com/stepancheg/rust-protobuf/issues/551 ).
(Also, rust-protobuf started generating `@generated` marker
[6 years ago](https://git.io/JnV5h )).
While rustfmt AST markers are useful to apply to a certain AST
elements, disable whole-file-at-once all-tools-at-once text level
marker might be easier to use and more reliable for generated code.
2021-09-14 21:22:26 -05:00
..
2019-06-08 18:47:18 +09:00
2019-06-09 09:20:39 +09:00
2021-09-14 21:22:26 -05:00
2019-06-17 08:53:39 +09:00
2020-09-04 19:01:18 -05:00
2019-07-16 19:36:23 +09:00
2019-09-02 18:36:51 +09:00
2019-03-22 18:20:00 +09:00
2019-07-15 22:41:56 +09:00
2019-06-05 00:14:12 +09:00
2019-06-17 08:53:39 +09:00
2019-07-17 09:40:33 +09:00
2019-08-16 11:15:28 +09:00
2020-07-15 09:19:21 -05:00
2019-10-11 18:19:44 +09:00
2021-01-27 19:26:58 -06:00
2021-07-27 19:50:11 -05:00
2019-05-10 21:22:52 +08:00
2019-09-24 09:24:05 +09:00
2020-06-11 21:11:18 -05:00
2019-10-07 16:40:27 +09:00
2019-07-17 23:07:12 +09:00
2019-06-29 10:11:20 -05:00
2019-03-20 18:18:02 +01:00
2019-12-03 08:47:25 +09:00
2019-08-02 23:54:39 +09:00
2019-06-07 16:56:30 +09:00
2019-07-17 23:07:12 +09:00
2019-07-17 23:07:12 +09:00
2021-01-27 18:50:03 -06:00
2019-06-07 16:56:30 +09:00
2019-05-10 21:22:52 +08:00
2019-09-04 23:01:04 +09:00
2019-10-04 11:25:16 +09:00
2020-11-28 17:41:21 -06:00
2020-11-28 21:59:30 -06:00
2019-07-15 22:41:56 +09:00
2019-06-03 22:26:48 +09:00
2019-06-03 22:26:48 +09:00
2019-06-03 22:26:48 +09:00
2019-09-20 16:11:52 +09:00
2019-07-17 23:07:12 +09:00
2021-08-22 12:06:18 -05:00
2021-01-09 12:11:52 -06:00
2021-01-17 11:48:47 -06:00
2021-01-27 20:58:42 -06:00
2021-01-17 11:48:47 -06:00
2021-08-31 18:33:06 -05:00
2020-03-27 22:29:12 -05:00
2019-05-10 21:22:52 +08:00
2019-10-08 10:12:21 +09:00
2019-10-08 11:00:31 +09:00
2019-10-17 20:13:11 -05:00
2019-10-11 18:15:04 +09:00
2021-01-27 20:58:42 -06:00
2020-08-09 14:32:34 -05:00
2021-09-06 17:02:20 -05:00
2021-09-06 18:14:13 -05:00
2021-04-21 21:27:50 -05:00
2020-03-27 22:13:46 -05:00
2020-03-31 15:30:26 +09:00
2021-09-06 17:02:20 -05:00
2021-09-02 20:53:15 -05:00
2021-09-02 20:53:15 -05:00
2020-08-09 14:32:34 -05:00
2020-11-14 11:50:28 -06:00
2020-11-14 11:50:28 -06:00
2020-11-14 11:50:28 -06:00
2020-11-16 15:48:20 -06:00
2020-11-29 13:26:58 -06:00
2021-09-06 18:14:13 -05:00
2020-12-20 12:05:05 -06:00
2021-01-16 11:17:23 -06:00
2021-01-28 22:01:50 -06:00
2021-07-25 22:53:32 -05:00
2021-08-06 22:03:40 -05:00
2021-09-08 19:27:31 -05:00
2021-09-02 20:53:15 -05:00
2021-09-02 20:53:15 -05:00
2021-09-07 20:22:09 -05:00
2019-07-17 23:07:12 +09:00
2019-08-06 11:09:45 +09:00
2019-04-05 17:11:11 +02:00
2019-05-10 21:22:52 +08:00
2019-05-10 21:22:52 +08:00
2020-11-29 13:26:58 -06:00
2019-09-06 22:41:03 +09:00
2019-10-19 16:56:32 +09:00
2020-02-08 22:21:37 -06:00
2020-11-05 20:45:11 -06:00
2019-04-26 16:04:49 +08:00
2019-04-03 18:16:54 +09:00
2019-03-29 20:12:45 +09:00
2021-09-08 23:27:51 -05:00
2019-06-07 16:56:30 +09:00
2019-03-19 10:19:45 +01:00
2019-03-24 18:43:35 +09:00
2019-04-07 12:31:57 +09:00
2019-04-23 16:21:04 -07:00
2019-04-23 08:50:44 +09:00
2019-04-29 21:38:38 +09:00
2019-05-06 00:01:13 +09:00
2019-05-16 13:22:25 +09:00
2019-05-22 00:07:56 +09:00
2019-05-21 11:43:27 +09:00
2019-05-30 21:03:29 +09:00
2019-06-06 13:06:40 +09:00
2019-07-15 22:41:56 +09:00
2019-06-30 12:19:24 +09:00
2019-06-23 16:24:40 +09:00
2019-06-25 23:14:19 +09:00
2019-07-29 05:56:34 +09:00
2019-07-14 22:16:47 +09:00
2019-08-11 12:49:14 +09:00
2019-07-30 14:32:38 +09:00
2019-09-15 23:45:46 +09:00
2019-07-31 23:55:58 +09:00
2019-08-13 23:21:55 +09:00
2019-09-05 19:38:00 +09:00
2021-01-17 11:48:47 -06:00
2019-10-02 23:58:25 +09:00
2019-08-28 20:50:02 +09:00
2019-09-18 22:39:27 +09:00
2019-10-07 16:43:50 +09:00
2019-10-04 11:25:16 +09:00
2019-10-10 10:35:34 +09:00
2019-10-24 22:16:56 +09:00
2020-06-27 12:55:15 -05:00
2020-10-24 11:13:00 -05:00
2020-06-11 23:17:38 -05:00
2020-11-29 13:26:58 -06:00
2020-03-27 22:13:46 -05:00
2020-06-11 23:29:51 -05:00
2020-11-29 13:26:58 -06:00
2020-11-14 11:50:28 -06:00
2020-11-29 13:26:58 -06:00
2020-10-01 19:12:22 -05:00
2020-11-29 13:26:58 -06:00
2020-11-29 13:26:58 -06:00
2020-11-29 13:26:58 -06:00
2021-01-27 18:50:03 -06:00
2021-04-21 21:30:42 -05:00
2020-11-28 21:59:30 -06:00
2020-11-14 11:50:28 -06:00
2020-10-24 11:13:00 -05:00
2021-02-17 20:47:20 -06:00
2020-12-20 12:05:05 -06:00
2021-02-17 20:19:27 -06:00
2021-01-27 20:58:42 -06:00
2021-08-25 21:18:41 -05:00
2021-08-25 21:18:41 -05:00
2019-04-23 08:50:44 +09:00
2020-11-11 18:26:13 -06:00
2021-01-09 12:11:52 -06:00
2019-08-28 20:50:41 +09:00
2019-03-30 18:37:37 +01:00
2021-05-04 18:38:22 -05:00
2021-01-17 11:48:47 -06:00
2019-07-17 23:07:12 +09:00
2019-10-19 18:19:47 +09:00
2020-11-30 23:24:36 -06:00
2019-05-01 16:27:34 +08:00
2019-05-22 00:10:35 +09:00
2019-08-06 11:09:45 +09:00
2019-04-24 21:01:09 +02:00
2019-04-24 21:01:09 +02:00
2019-10-05 12:34:48 -05:00
2019-10-19 18:19:47 +09:00
2021-01-09 12:11:52 -06:00
2020-11-28 17:41:21 -06:00
2021-08-22 12:06:18 -05:00
2020-11-02 18:31:51 -06:00
2020-11-02 18:31:51 -06:00
2020-11-02 18:31:51 -06:00
2020-12-20 12:05:05 -06:00
2019-06-17 08:53:17 +09:00
2020-09-23 00:45:18 -05:00
2019-05-02 21:11:13 +08:00