|
| 1 | +--- |
| 2 | +name: adding-copyright-headers |
| 3 | +description: Adds copyright headers to files based on file type. Use when creating new files or when asked to verify copyright headers. |
| 4 | +--- |
| 5 | + |
| 6 | +# Adding Copyright Headers |
| 7 | + |
| 8 | +## Formats |
| 9 | + |
| 10 | +### Dart Files (`.dart`) |
| 11 | + |
| 12 | +```dart |
| 13 | +// Copyright 20?? The Flutter Authors |
| 14 | +// Use of this source code is governed by a BSD-style license that can be |
| 15 | +// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. |
| 16 | +``` |
| 17 | + |
| 18 | +### YAML Files (`.yaml`) |
| 19 | + |
| 20 | +```yaml |
| 21 | +# Copyright 20?? The Flutter Authors |
| 22 | +# Use of this source code is governed by a BSD-style license that can be |
| 23 | +# found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. |
| 24 | +``` |
| 25 | + |
| 26 | +### HTML Files (`.html`) and Markdown Files (`.md`) |
| 27 | + |
| 28 | +```html |
| 29 | +<!-- |
| 30 | +Copyright 20?? The Flutter Authors |
| 31 | +Use of this source code is governed by a BSD-style license that can be |
| 32 | +found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. |
| 33 | +--> |
| 34 | +``` |
| 35 | + |
| 36 | +### Shell Scripts (`.sh`) |
| 37 | + |
| 38 | +```bash |
| 39 | +# Copyright 20?? The Flutter Authors |
| 40 | +# Use of this source code is governed by a BSD-style license that can be |
| 41 | +# found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. |
| 42 | +``` |
| 43 | + |
| 44 | +## Instructions |
| 45 | + |
| 46 | +1. **New Files**: When creating a new file, you MUST add the appropriate copyright header based on its file extension. |
| 47 | + - Replace `20??` with the current year (e.g., 2026). |
| 48 | +2. **Placement**: |
| 49 | + - The copyright header should be at the very top of the file by default. |
| 50 | + - **Exception**: If the file requires a shebang (e.g., `#!/bin/bash` in `.sh` files) or other necessary frontmatter, the copyright header must come **after** the frontmatter, separated by a blank line. |
| 51 | +3. **Exclusions**: Copyright headers are **not necessary** in directories that begin with a dot (`.`), such as: |
| 52 | + - `.agents/` |
| 53 | + - `.gemini/` |
| 54 | + - `.github/` |
| 55 | +4. **Existing Files**: When editing an existing file, do NOT modify the year in the copyright header. Leave it as it is. |
| 56 | +5. **Subsequent Edits**: Subsequent edits should not modify the year. |
| 57 | + |
| 58 | +## Examples (for 2026) |
| 59 | + |
| 60 | +### Shell Script with Shebang |
| 61 | +```bash |
| 62 | +#!/bin/bash |
| 63 | + |
| 64 | +# Copyright 2026 The Flutter Authors |
| 65 | +# Use of this source code is governed by a BSD-style license that can be |
| 66 | +# found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. |
| 67 | +``` |
| 68 | + |
| 69 | +### Dart File |
| 70 | +```dart |
| 71 | +// Copyright 2026 The Flutter Authors |
| 72 | +// Use of this source code is governed by a BSD-style license that can be |
| 73 | +// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd. |
| 74 | +``` |
0 commit comments