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-07-17 09:40:33 +09:00
2021-07-27 19:50:11 -05:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2019-03-17 12:21:21 +09:00
2018-06-25 15:27:09 +09:00
2019-03-20 18:18:02 +01:00
2019-06-07 16:56:30 +09:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-08-31 18:10:47 +09:00
2018-10-15 12:09:53 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2019-06-07 16:56:30 +09:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2020-11-28 17:41:21 -06:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2019-06-03 22:26:48 +09:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-06 19:42:38 +09:00
2018-03-02 15:07:13 +13:00
2018-08-24 14:39:05 +09:00
2018-04-11 10:46:49 +12:00
2021-09-02 20:53:15 -05:00
2021-09-02 20:53:15 -05:00
2021-09-06 18:14:13 -05:00
2021-01-28 22:01:50 -06:00
2021-09-02 20:53:15 -05:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-06-27 15:28:32 +02:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-31 13:16:36 +09:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-09-11 08:54:43 +03:00
2018-05-02 10:38:02 +02:00
2018-06-19 20:51:49 +09:00
2018-06-05 13:42:58 +09:00
2018-08-05 10:50:24 +09:00
2018-08-31 16:25:01 +03:00
2018-08-31 15:25:08 +03:00
2018-09-11 11:09:31 +03:00
2018-10-06 16:32:27 +03:00
2018-10-06 10:59:47 +03:00
2019-03-02 17:33:43 +09:00
2019-02-08 00:05:54 +09:00
2018-12-24 06:18:00 +09:00
2019-06-07 16:56:30 +09:00
2019-03-24 18:43:35 +09:00
2019-04-23 08:50:44 +09:00
2020-06-11 23:29:51 -05:00
2021-01-27 20:58:42 -06:00
2018-05-21 22:37:55 +08:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2020-11-30 23:24:36 -06:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2019-08-06 11:09:45 +09:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2018-03-02 15:07:13 +13:00
2020-12-20 12:05:05 -06:00
2018-03-06 19:42:55 +09:00
2018-03-02 15:07:13 +13:00