File tree Expand file tree Collapse file tree 9 files changed +23
-8
lines changed
test_repo/pkgs/package2/lib Expand file tree Collapse file tree 9 files changed +23
-8
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.10.2-wip
2
+
3
+ - Don't check licenses of generated files in PR health workflow.
4
+
1
5
## 0.10.1
2
6
3
7
- Small fixes to the PR health checker.
Original file line number Diff line number Diff line change @@ -41,11 +41,13 @@ class Coverage {
41
41
.where ((file) => file.status != FileStatus .removed)
42
42
.where ((file) => isInSomePackage (packages, file.filename))
43
43
.where ((file) => isNotATest (packages, file.filename))
44
+ .where (
45
+ (file) => ignoredFiles.none ((glob) => glob.matches (file.filename)))
44
46
.toList ();
45
47
print ('The files of interest are $filesOfInterest ' );
46
48
47
49
var baseRepository = Repository (base );
48
- var basePackages = baseRepository.locatePackages (ignore: ignoredFiles );
50
+ var basePackages = baseRepository.locatePackages (ignore: ignoredPackages );
49
51
print ('Found packages $basePackages at $base ' );
50
52
51
53
var changedPackages = packages
Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ Future<List<String>> getFilesWithoutLicenses(
26
26
if (ignoredFiles.none ((glob) =>
27
27
glob.matches (path.relative (file.path, from: repositoryDir.path)))) {
28
28
var fileContents = File (file.path).readAsStringSync ();
29
- var fileContainsCopyright = fileContents. contains ( '// Copyright (c)' );
30
- if ( ! fileContainsCopyright) {
29
+ if ( ! fileIsGenerated (fileContents, file.path) &&
30
+ ! fileContainsCopyright (fileContents) ) {
31
31
print (relativePath);
32
32
return relativePath;
33
33
}
@@ -40,3 +40,13 @@ Future<List<String>> getFilesWithoutLicenses(
40
40
Done, found ${filesWithoutLicenses .length } files without license headers''' );
41
41
return filesWithoutLicenses;
42
42
}
43
+
44
+ bool fileIsGenerated (String fileContents, String path) =>
45
+ path.endsWith ('g.dart' ) ||
46
+ fileContents
47
+ .split ('\n ' )
48
+ .takeWhile ((line) => line.startsWith ('//' ) || line.isEmpty)
49
+ .any ((line) => line.toLowerCase ().contains ('generate' ));
50
+
51
+ bool fileContainsCopyright (String fileContents) =>
52
+ fileContents.contains ('// Copyright (c)' );
Original file line number Diff line number Diff line change 1
1
name : firehose
2
2
description : A tool to automate publishing of Pub packages from GitHub actions.
3
- version : 0.10.1
3
+ version : 0.10.2-wip
4
4
repository : https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose
5
5
6
6
environment :
Original file line number Diff line number Diff line change 12
12
| Files |
13
13
| :--- |
14
14
| pkgs/package1/bin/package1.dart|
15
- | pkgs/package2/lib/anotherLib.dart|
16
15
| pkgs/package5/lib/src/package5_base.dart|
17
16
18
17
All source files should start with a [ license header] ( https://github.com/dart-lang/ecosystem/wiki/License-Header ) .
Original file line number Diff line number Diff line change 14
14
| pkgs/package1/bin/package1.dart|
15
15
| pkgs/package1/lib/package1.dart|
16
16
| pkgs/package1/test/package1_test.dart|
17
- | pkgs/package2/lib/anotherLib.dart|
18
17
| pkgs/package2/lib/package2.dart|
19
18
| pkgs/package2/test/package2_test.dart|
20
19
| pkgs/package3/bin/package3.dart|
Original file line number Diff line number Diff line change 12
12
| Files |
13
13
| :--- |
14
14
| pkgs/package1/bin/package1.dart|
15
- | pkgs/package2/lib/anotherLib.dart|
16
15
| pkgs/package5/lib/src/package5_base.dart|
17
16
18
17
All source files should start with a [ license header] ( https://github.com/dart-lang/ecosystem/wiki/License-Header ) .
Original file line number Diff line number Diff line change 11
11
12
12
| Files |
13
13
| :--- |
14
- | pkgs/package2/lib/anotherLib.dart|
15
14
| pkgs/package5/lib/src/package5_base.dart|
16
15
17
16
All source files should start with a [ license header] ( https://github.com/dart-lang/ecosystem/wiki/License-Header ) .
Original file line number Diff line number Diff line change
1
+ // SOME COMMENT
2
+ // THIS IS A GENERATED FILE
3
+
1
4
int calculateUnused () {
2
5
return 6 * 7 ;
3
6
}
You can’t perform that action at this time.
0 commit comments