Skip to content

Commit f3f8970

Browse files
ci: add check for license header and add melos command to add & check license header (#9704)
* Add `header_template.txt` * Add instructions on running `addlicense` * Run `addlicense -f header_template.txt .` * Add `check-files-license-headers` * Add comment * Revert "Run `addlicense -f header_template.txt .`" This reverts commit 3cfcc38. * Add `melos run add-license-header` * Adjust `CONTRIBUTING.md` * Add `melos run check-license-header` * Improve "check-files-license-headers" check * Install Dart SDK instead of Flutter SDK * disable `bootstrap` * Add license header for missing files * Ignore also text files * ignore `.cmake` * Add missing license header
1 parent 8e9f6b4 commit f3f8970

File tree

259 files changed

+1195
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+1195
-0
lines changed

.github/workflows/all_plugins.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,25 @@ jobs:
111111
run: melos run test --no-select
112112
- name: 'Flutter Test - Web'
113113
run: melos run test:web --no-select
114+
115+
check-files-license-headers:
116+
runs-on: ubuntu-latest
117+
timeout-minutes: 30
118+
steps:
119+
- uses: actions/checkout@v2
120+
- uses: actions/setup-go@v2
121+
with:
122+
go-version: '^1.13.1'
123+
# Go is used by addlicense command (addlicense is used in melos run
124+
# check-license-header)
125+
- run: go install github.com/google/addlicense@latest
126+
- name: Install Dart
127+
uses: dart-lang/[email protected]
128+
- name: Install Melos
129+
uses: bluefireteam/melos-action@v2
130+
with:
131+
# Running `melos bootstrap` is not needed because we use Melos just
132+
# for the `check-license-header` script.
133+
run-bootstrap: false
134+
- name: Check license header
135+
run: melos run check-license-header

CONTRIBUTING.md

+19
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,25 @@ You can do this online, and it only takes a minute.
208208
If you've never submitted code before, you must add your (or your
209209
organization's) name and contact info to the [AUTHORS](AUTHORS) file.
210210

211+
If you create a new file, do not forget to add the license header. You can use
212+
[`addlicense`](https://github.com/google/addlicense) to add the license to all
213+
necessary files.
214+
215+
To install `addlicense`, run:
216+
```bash
217+
go install github.com/google/addlicense@latest
218+
```
219+
220+
Do not forget to add `$HOME/go/bin` to your `PATH`. If you are using Bash on
221+
Linux or macOS, you need to add `export PATH="$HOME/go/bin:$PATH"` to your
222+
`.bash_profile`.
223+
224+
To add the license header to all files, run from the root of the repository:
225+
```bash
226+
melos run add-license-header
227+
```
228+
This command uses `addlicense` with all necessary flags.
229+
211230
### The review process
212231

213232
Newly opened PRs first go through initial triage which results in one of:

header_template.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Copyright {{.Year}}, the Chromium project authors. Please see the AUTHORS file
2+
for details. All rights reserved. Use of this source code is governed by a
3+
BSD-style license that can be found in the LICENSE file.

melos.yaml

+65
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,68 @@ scripts:
261261
# Additional cleanup lifecycle script, executed when `melos clean` is run.
262262
postclean: >
263263
melos exec -c 6 -- "flutter clean"
264+
265+
add-license-header:
266+
# If you add here another --ignore flag, add it also to
267+
# "check-license-header".
268+
run: |
269+
addlicense -f header_template.txt \
270+
--ignore "**/*.yml" \
271+
--ignore "**/*.yaml" \
272+
--ignore "**/*.xml" \
273+
--ignore "**/*.g.dart" \
274+
--ignore "**/*.sh" \
275+
--ignore "**/*.html" \
276+
--ignore "**/*.js" \
277+
--ignore "**/*.ts" \
278+
--ignore "**/*.g.h" \
279+
--ignore "**/*.g.m" \
280+
--ignore "**/*.rb" \
281+
--ignore "**/*.txt" \
282+
--ignore "**/*.cmake" \
283+
--ignore "**/Runner/AppDelegate.swift" \
284+
--ignore "**/Runner/MainFlutterWindow.swift" \
285+
--ignore "**/Runner/Runner-Bridging-Header.h" \
286+
--ignore "**/Runner/AppDelegate.h" \
287+
--ignore "**/Runner/AppDelegate.m" \
288+
--ignore "**/Runner/main.m" \
289+
--ignore "**/MainActivity.kt" \
290+
--ignore "**/MainActivity.java" \
291+
--ignore "**/FlutterMultiDexApplication.java" \
292+
--ignore "**/GeneratedPluginRegistrant.swift" \
293+
--ignore "**/Pods/**" \
294+
.
295+
description: Add a license header to all necessary files.
296+
297+
check-license-header:
298+
# If you add here another --ignore flag, add it also to
299+
# "add-license-header".
300+
run: |
301+
addlicense -f header_template.txt \
302+
--check \
303+
--ignore "**/*.yml" \
304+
--ignore "**/*.yaml" \
305+
--ignore "**/*.xml" \
306+
--ignore "**/*.g.dart" \
307+
--ignore "**/*.sh" \
308+
--ignore "**/*.html" \
309+
--ignore "**/*.js" \
310+
--ignore "**/*.ts" \
311+
--ignore "**/*.g.h" \
312+
--ignore "**/*.g.m" \
313+
--ignore "**/*.rb" \
314+
--ignore "**/*.txt" \
315+
--ignore "**/*.cmake" \
316+
--ignore "**/Runner/AppDelegate.swift" \
317+
--ignore "**/Runner/MainFlutterWindow.swift" \
318+
--ignore "**/Runner/Runner-Bridging-Header.h" \
319+
--ignore "**/Runner/AppDelegate.h" \
320+
--ignore "**/Runner/AppDelegate.m" \
321+
--ignore "**/Runner/main.m" \
322+
--ignore "**/MainActivity.kt" \
323+
--ignore "**/MainActivity.java" \
324+
--ignore "**/FlutterMultiDexApplication.java" \
325+
--ignore "**/GeneratedPluginRegistrant.swift" \
326+
--ignore "**/Pods/**" \
327+
.
328+
description: Add a license header to all necessary files.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:integration_test/integration_test_driver.dart';
26

37
Future<void> main() => integrationDriver();

packages/cloud_firestore_odm/cloud_firestore_odm/example/lib/integration/freezed.freezed.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
// coverage:ignore-file
26
// GENERATED CODE - DO NOT MODIFY BY HAND
37
// ignore_for_file: type=lint

packages/cloud_firestore_odm/cloud_firestore_odm/example/lib/integration/named_query.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:cloud_firestore/cloud_firestore.dart';
26
import 'package:cloud_firestore_odm/cloud_firestore_odm.dart';
37
import 'package:freezed_annotation/freezed_annotation.dart';
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:integration_test/integration_test_driver.dart';
26

37
Future<void> main() => integrationDriver();

packages/cloud_firestore_odm/cloud_firestore_odm_generator/cloud_firestore_odm_generator_integration_test/lib/freezed.freezed.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
// coverage:ignore-file
26
// GENERATED CODE - DO NOT MODIFY BY HAND
37
// ignore_for_file: type=lint

packages/cloud_firestore_odm/cloud_firestore_odm_generator/lib/src/collection_data.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:analyzer/dart/constant/value.dart';
26
import 'package:analyzer/dart/element/element.dart';
37
import 'package:analyzer/dart/element/type.dart';

packages/cloud_firestore_odm/cloud_firestore_odm_generator/lib/src/named_query_data.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:analyzer/dart/constant/value.dart';
26
import 'package:analyzer/dart/element/type.dart';
37
import 'package:recase/recase.dart';

packages/cloud_firestore_odm/cloud_firestore_odm_generator/lib/src/names.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:analyzer/dart/element/type.dart';
26

37
/// A mixin for obtaining the class name of collections/documents/snapshots/etc

packages/cloud_firestore_odm/cloud_firestore_odm_generator/lib/src/templates/named_query.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import '../collection_generator.dart';
26
import '../named_query_data.dart';
37

packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/android_provider.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
// An enum representing the different types of Android App Attest providers.
26
enum AndroidProvider {
37
// The debug provider

packages/firebase_app_check/firebase_app_check_platform_interface/lib/src/method_channel/utils/provider_to_string.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_app_check_platform_interface/src/android_provider.dart';
26

37
/// Converts [Provider] to [String]

packages/firebase_dynamic_links/firebase_dynamic_links/example/lib/firebase_options.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
// File generated by FlutterFire CLI.
26
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
37
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:integration_test/integration_test_driver.dart';
26

37
Future<void> main() => integrationDriver();

packages/firebase_ui_auth/example/lib/config.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
// ignore_for_file: do_not_use_environment, constant_identifier_names
26

37
const GOOGLE_CLIENT_ID =

packages/firebase_ui_auth/example/lib/decorations.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:flutter/material.dart';
26
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
37

packages/firebase_ui_auth/example/lib/firebase_options.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
// File generated by FlutterFire CLI.
26
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
37
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;

packages/firebase_ui_auth/example/lib/main.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_auth/firebase_auth.dart'
26
hide PhoneAuthProvider, EmailAuthProvider;
37
import 'package:firebase_core/firebase_core.dart';

packages/firebase_ui_auth/example/linux/flutter/generated_plugin_registrant.cc

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
//
26
// Generated file. Do not edit.
37
//

packages/firebase_ui_auth/example/linux/flutter/generated_plugin_registrant.h

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright 2022, the Chromium project authors. Please see the AUTHORS file
3+
* for details. All rights reserved. Use of this source code is governed by a
4+
* BSD-style license that can be found in the LICENSE file.
5+
*/
6+
17
//
28
// Generated file. Do not edit.
39
//

packages/firebase_ui_auth/example/linux/main.cc

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
#include "my_application.h"
26

37
int main(int argc, char** argv) {

packages/firebase_ui_auth/example/linux/my_application.cc

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
#include "my_application.h"
26

37
#include <flutter_linux/flutter_linux.h>

packages/firebase_ui_auth/example/linux/my_application.h

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright 2022, the Chromium project authors. Please see the AUTHORS file
3+
* for details. All rights reserved. Use of this source code is governed by a
4+
* BSD-style license that can be found in the LICENSE file.
5+
*/
6+
17
#ifndef FLUTTER_MY_APPLICATION_H_
28
#define FLUTTER_MY_APPLICATION_H_
39

packages/firebase_ui_auth/example/test_driver/apple_sign_in_test.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_auth/firebase_auth.dart';
26
import 'package:firebase_core/firebase_core.dart';
37
import 'package:flutter/foundation.dart';

packages/firebase_ui_auth/example/test_driver/email_form_test.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_auth/firebase_auth.dart';
26
import 'package:flutter/material.dart';
37
import 'package:flutter_test/flutter_test.dart';

packages/firebase_ui_auth/example/test_driver/email_link_sign_in_view_test.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_auth/firebase_auth.dart';
26
import 'package:flutter/material.dart';
37
import 'package:flutter_test/flutter_test.dart';

packages/firebase_ui_auth/example/test_driver/facebook_sign_in_test.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_auth/firebase_auth.dart';
26
import 'package:flutter/foundation.dart';
37
import 'package:flutter/material.dart';

packages/firebase_ui_auth/example/test_driver/firebase_options.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
// File generated by FlutterFire CLI.
26
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
37
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;

packages/firebase_ui_auth/example/test_driver/google_sign_in_test.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_auth/firebase_auth.dart';
26
import 'package:flutter/foundation.dart';
37
import 'package:flutter/material.dart';

packages/firebase_ui_auth/example/test_driver/layout_test.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:drive/drive.dart';
26
import 'package:firebase_auth/firebase_auth.dart'
37
hide EmailAuthProvider, PhoneAuthProvider;

packages/firebase_ui_auth/example/test_driver/phone_verification_test.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'dart:async';
26

37
import 'package:flutter/material.dart';

packages/firebase_ui_auth/example/test_driver/twitter_sign_in_test.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_auth/firebase_auth.dart';
26
import 'package:flutter/foundation.dart';
37
import 'package:flutter/material.dart';

packages/firebase_ui_auth/example/test_driver/universal_email_sign_in_screen_test.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'package:firebase_auth/firebase_auth.dart'
26
hide EmailAuthProvider, PhoneAuthProvider;
37
import 'package:firebase_core/firebase_core.dart';

packages/firebase_ui_auth/example/test_driver/utils.dart

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
15
import 'dart:convert';
26

37
import 'package:firebase_auth/firebase_auth.dart';

0 commit comments

Comments
 (0)