Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
b68786a4
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b68786a4
编写于
7月 12, 2021
作者:
D
Devon Carew
提交者:
GitHub
7月 12, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update the analysis options for tools/licenses (#27339)
update the analysis options for tools/licenses
上级
a984a833
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
98 addition
and
253 deletion
+98
-253
ci/licenses_golden/tool_signature
ci/licenses_golden/tool_signature
+1
-1
tools/licenses/analysis_options.yaml
tools/licenses/analysis_options.yaml
+2
-159
tools/licenses/lib/cache.dart
tools/licenses/lib/cache.dart
+2
-2
tools/licenses/lib/filesystem.dart
tools/licenses/lib/filesystem.dart
+5
-5
tools/licenses/lib/licenses.dart
tools/licenses/lib/licenses.dart
+19
-19
tools/licenses/lib/main.dart
tools/licenses/lib/main.dart
+67
-67
tools/licenses/lib/patterns.dart
tools/licenses/lib/patterns.dart
+2
-0
未找到文件。
ci/licenses_golden/tool_signature
浏览文件 @
b68786a4
Signature:
affc80a35fe2dc9647bf293dd8afcaa7
Signature:
5754c1ee0193299dad20012e408d4ce2
tools/licenses/analysis_options.yaml
浏览文件 @
b68786a4
# Specify analysis options.
#
# Until there are meta linter rules, each desired lint must be explicitly enabled.
# See: https://github.com/dart-lang/linter/issues/288
#
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
# See the configuration guide for more
# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
#
# There are other similar analysis options files in the flutter repos,
# which should be kept in sync with this file:
#
# - analysis_options.yaml
# - tools/licenses/analysis_options.yaml (this file)
# - https://github.com/flutter/flutter/blob/master/analysis_options_user.yaml
# - https://github.com/flutter/flutter/blob/master/packages/flutter/lib/analysis_options_user.yaml
# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml
#
# This file contains the analysis options used by Flutter tools, such as IntelliJ,
# Android Studio, and the `flutter analyze` command.
include
:
../../analysis_options.yaml
analyzer
:
strong-mode
:
implicit-dynamic
:
false
errors
:
# allow having TODOs in the code
todo
:
ignore
linter
:
rules
:
# these rules are documented on and in the same order as
# the Dart Lint rules page to make maintenance easier
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
-
always_declare_return_types
-
always_put_control_body_on_new_line
-
always_put_required_named_parameters_first
-
always_require_non_null_named_parameters
-
always_specify_types
-
annotate_overrides
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
-
avoid_as
-
avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses # we do this commonly
# - avoid_catching_errors # we do this commonly
-
avoid_classes_with_only_static_members
# - avoid_double_and_int_checks # only useful when targeting JS runtime
-
avoid_empty_else
-
avoid_field_initializers_in_const_classes
-
avoid_function_literals_in_foreach_calls
-
avoid_implementing_value_types
-
avoid_init_to_null
# - avoid_js_rounded_ints # only useful when targeting JS runtime
-
avoid_null_checks_in_equality_operators
-
avoid_positional_boolean_parameters
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
-
avoid_relative_lib_imports
-
avoid_renaming_method_parameters
-
avoid_return_types_on_setters
# - avoid_returning_null # there are plenty of valid reasons to return null
-
avoid_returning_null_for_void
# - avoid_returning_this # there are plenty of valid reasons to return this
-
avoid_setters_without_getters
-
avoid_single_cascade_in_expression_statements
-
avoid_slow_async_io
-
avoid_types_as_parameter_names
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
-
avoid_unused_constructor_parameters
-
avoid_void_async
-
await_only_futures
-
camel_case_types
-
cancel_subscriptions
# - cascade_invocations # not yet tested
# - close_sinks # not reliable enough
# - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
-
control_flow_in_finally
# - curly_braces_in_flow_control_structures # not yet tested
# TODO: Re-enable directives_ordering once roll https://github.com/flutter/engine/pull/27324 has completed.
# - directives_ordering
-
empty_catches
-
empty_constructor_bodies
-
empty_statements
-
file_names
-
flutter_style_todos
-
hash_and_equals
-
implementation_imports
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
-
iterable_contains_unrelated_type
# - join_return_with_assignment # not yet tested
-
library_names
-
library_prefixes
# - lines_longer_than_80_chars # not yet tested
-
list_remove_unrelated_type
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
-
no_adjacent_strings_in_list
-
no_duplicate_case_values
-
non_constant_identifier_names
-
null
_closures
# - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
-
overridden_fields
-
package_api_docs
-
package_names
-
package_prefixed_library_names
# - parameter_assignments # we do this commonly
-
prefer_adjacent_string_concatenation
-
prefer_asserts_in_initializer_lists
-
prefer_collection_literals
-
prefer_conditional_assignment
-
prefer_const_constructors
-
prefer_const_constructors_in_immutables
-
prefer_const_declarations
-
prefer_const_literals_to_create_immutables
# - prefer_constructors_over_static_methods # not yet tested
-
prefer_contains
-
prefer_equal_for_default_values
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
-
prefer_final_fields
-
prefer_final_locals
-
prefer_foreach
-
prefer_function_declarations_over_variables
# not yet tested
-
prefer_generic_function_type_aliases
-
prefer_initializing_formals
-
prefer_int_literals
# - prefer_interpolation_to_compose_strings # not yet tested
-
prefer_is_empty
-
prefer_is_not_empty
-
prefer_iterable_whereType
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
-
prefer_single_quotes
-
prefer_typing_uninitialized_variables
-
prefer_void_to_null
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
-
recursive_getters
-
slash_for_doc_comments
-
sort_constructors_first
-
sort_pub_dependencies
-
sort_unnamed_constructors_first
-
test_types_in_equals
-
throw_in_finally
# - type_annotate_public_apis # subset of always_specify_types
-
type_init_formals
# - unawaited_futures # too many false positives
-
unnecessary_brace_in_string_interps
-
unnecessary_const
-
unnecessary_getters_setters
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
-
unnecessary_new
-
unnecessary_null_aware_assignments
-
unnecessary_null_in_if_null_operators
-
unnecessary_overrides
-
unnecessary_parenthesis
-
unnecessary_statements
-
unnecessary_this
-
unrelated_type_equality_checks
-
use_rethrow_when_possible
-
use_setters_to_change_properties
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
-
valid_regexps
-
void_checks
public_member_api_docs
:
ignore
tools/licenses/lib/cache.dart
浏览文件 @
b68786a4
...
...
@@ -5,8 +5,8 @@
Map
<
Key
,
dynamic
>
_cache
=
<
Key
,
dynamic
>{};
const
int
_maxSize
=
10
;
T
cache
<
T
>(
Key
key
,
T
getter
()
)
{
T
result
=
_cache
[
key
];
T
cache
<
T
>(
Key
key
,
T
Function
()
getter
)
{
T
result
=
_cache
[
key
]
as
T
;
if
(
result
!=
null
)
{
_cache
.
remove
(
key
);
}
else
{
...
...
tools/licenses/lib/filesystem.dart
浏览文件 @
b68786a4
...
...
@@ -451,14 +451,14 @@ class FileSystemDirectory extends IoNode implements Directory {
Iterable
<
IoNode
>
get
walk
sync
*
{
final
List
<
io
.
FileSystemEntity
>
list
=
_directory
.
listSync
().
toList
();
list
.
sort
((
io
.
FileSystemEntity
a
,
io
.
FileSystemEntity
b
)
=>
a
.
path
.
compareTo
(
b
.
path
));
for
(
io
.
FileSystemEntity
entity
in
list
)
{
for
(
final
io
.
FileSystemEntity
entity
in
list
)
{
if
(
entity
is
io
.
Directory
)
{
yield
FileSystemDirectory
(
entity
);
}
else
if
(
entity
is
io
.
Link
)
{
yield
FileSystemLink
(
entity
);
}
else
{
assert
(
entity
is
io
.
File
);
final
io
.
File
fileEntity
=
entity
;
final
io
.
File
fileEntity
=
entity
as
io
.
File
;
if
(
fileEntity
.
lengthSync
()
>
0
)
{
switch
(
identifyFile
(
fileEntity
.
path
,
()
=>
_readBytes
(
fileEntity
)))
{
case
FileType
.
binary
:
yield
FileSystemFile
(
fileEntity
);
break
;
...
...
@@ -554,7 +554,7 @@ class ArchiveDirectory extends IoNode implements Directory {
}
else
{
if
(
entry
.
size
>
0
)
{
final
String
entryFullName
=
fullName
+
'/'
+
path
.
basename
(
entry
.
name
);
switch
(
identifyFile
(
entry
.
name
,
()
=>
entry
.
content
))
{
switch
(
identifyFile
(
entry
.
name
,
()
=>
entry
.
content
as
List
<
int
>
))
{
case
FileType
.
binary
:
_files
.
add
(
ArchiveFile
(
entryFullName
,
entry
));
break
;
case
FileType
.
zip
:
_files
.
add
(
ArchiveZipFile
(
entryFullName
,
entry
));
break
;
case
FileType
.
tar
:
_files
.
add
(
ArchiveTarFile
(
entryFullName
,
entry
));
break
;
...
...
@@ -570,7 +570,7 @@ class ArchiveDirectory extends IoNode implements Directory {
static
ArchiveDirectory
parseArchive
(
a
.
Archive
archive
,
String
ownerPath
)
{
final
ArchiveDirectory
root
=
ArchiveDirectory
(
'
$ownerPath
!'
,
''
);
for
(
a
.
ArchiveFile
file
in
archive
.
files
)
{
for
(
final
a
.
ArchiveFile
file
in
archive
.
files
)
{
if
(
file
.
size
>
0
)
root
.
_add
(
file
,
file
.
name
.
split
(
'/'
));
}
...
...
@@ -597,7 +597,7 @@ class ArchiveFile extends IoNode implements File {
@override
List
<
int
>
readBytes
()
{
return
_file
.
content
;
return
_file
.
content
as
List
<
int
>
;
}
}
...
...
tools/licenses/lib/licenses.dart
浏览文件 @
b68786a4
...
...
@@ -368,7 +368,7 @@ abstract class License implements Comparable<License> {
yesWeKnowWhatItLooksLikeButItIsNot
=
true
;
if
(
detectedType
!=
LicenseType
.
unknown
&&
detectedType
!=
type
&&
!
yesWeKnowWhatItLooksLikeButItIsNot
)
throw
'Created a license of type
$type
but it looks like
$detectedType
\
.'
;
throw
'Created a license of type
$type
but it looks like
$detectedType
.'
;
if
(
type
!=
LicenseType
.
apache
&&
type
!=
LicenseType
.
apacheNotice
)
{
if
(!
yesWeKnowWhatItLooksLikeButItIsNot
&&
body
.
contains
(
'Apache'
))
throw
'Non-Apache license (type=
$type
, detectedType=
$detectedType
) contains the word "Apache"; maybe it
\'
s a notice?:
\n
---
\n
$body
\n
---'
;
...
...
@@ -494,7 +494,7 @@ String _reformat(String body) {
int
lastGood
;
String
previousPrefix
;
bool
lastWasEmpty
=
true
;
for
(
String
line
in
lines
)
{
for
(
final
String
line
in
lines
)
{
final
Match
match
=
stripDecorations
.
firstMatch
(
line
);
final
String
prefix
=
match
.
group
(
1
);
String
s
=
match
.
group
(
2
);
...
...
@@ -668,7 +668,7 @@ class _PartialLicenseMatch {
Iterable
<
_PartialLicenseMatch
>
_findLicenseBlocks
(
String
body
,
RegExp
pattern
,
int
firstPrefixIndex
,
int
indentPrefixIndex
,
{
bool
needsCopyright
=
true
})
sync
*
{
// I tried doing this with one big RegExp initially, but that way lay madness.
for
(
Match
match
in
pattern
.
allMatches
(
body
))
{
for
(
final
Match
match
in
pattern
.
allMatches
(
body
))
{
assert
(
match
.
groupCount
>=
firstPrefixIndex
);
assert
(
match
.
groupCount
>=
indentPrefixIndex
);
int
start
=
match
.
start
;
...
...
@@ -678,7 +678,7 @@ Iterable<_PartialLicenseMatch> _findLicenseBlocks(String body, RegExp pattern, i
bool
firstLineSpecialComment
=
false
;
bool
lastWasBlank
=
false
;
bool
foundNonBlank
=
false
;
for
(
_LineRange
range
in
_walkLinesBackwards
(
body
,
start
))
{
for
(
final
_LineRange
range
in
_walkLinesBackwards
(
body
,
start
))
{
String
line
=
range
.
value
;
bool
isBlockCommentLine
;
if
(
line
.
length
>
3
&&
line
.
endsWith
(
'*/'
))
{
...
...
@@ -715,7 +715,7 @@ Iterable<_PartialLicenseMatch> _findLicenseBlocks(String body, RegExp pattern, i
// then we walk forward dropping anything until the first line that matches what
// we think might be part of a copyright statement
bool
foundAny
=
false
;
for
(
_LineRange
range
in
_walkLinesForwards
(
body
,
start:
start
,
end:
match
.
start
))
{
for
(
final
_LineRange
range
in
_walkLinesForwards
(
body
,
start:
start
,
end:
match
.
start
))
{
final
String
line
=
range
.
value
;
if
(
firstLineSpecialComment
||
line
.
startsWith
(
fullPrefix
))
{
String
data
;
...
...
@@ -795,7 +795,7 @@ Iterable<_LicenseMatch> _expand(License template, String copyright, String body,
}
Iterable
<
_LicenseMatch
>
_tryNone
(
String
body
,
String
filename
,
RegExp
pattern
,
LicenseSource
parentDirectory
)
sync
*
{
for
(
Match
match
in
pattern
.
allMatches
(
body
))
{
for
(
final
Match
match
in
pattern
.
allMatches
(
body
))
{
final
List
<
License
>
results
=
parentDirectory
.
nearestLicensesFor
(
filename
);
if
(
results
==
null
||
results
.
isEmpty
)
throw
'no default license file found'
;
...
...
@@ -807,7 +807,7 @@ Iterable<_LicenseMatch> _tryNone(String body, String filename, RegExp pattern, L
}
Iterable
<
_LicenseMatch
>
_tryAttribution
(
String
body
,
RegExp
pattern
,
{
String
origin
})
sync
*
{
for
(
Match
match
in
pattern
.
allMatches
(
body
))
{
for
(
final
Match
match
in
pattern
.
allMatches
(
body
))
{
assert
(
match
.
groupCount
==
2
);
yield
_LicenseMatch
(
License
.
unique
(
'Thanks to
${match.group(2)}
.'
,
LicenseType
.
unknown
,
origin:
origin
),
match
.
start
,
match
.
end
,
debug:
'_tryAttribution'
);
}
...
...
@@ -815,7 +815,7 @@ Iterable<_LicenseMatch> _tryAttribution(String body, RegExp pattern, { String or
Iterable
<
_LicenseMatch
>
_tryReferenceByFilename
(
String
body
,
LicenseFileReferencePattern
pattern
,
LicenseSource
parentDirectory
,
{
String
origin
})
sync
*
{
if
(
pattern
.
copyrightIndex
!=
null
)
{
for
(
Match
match
in
pattern
.
pattern
.
allMatches
(
body
))
{
for
(
final
Match
match
in
pattern
.
pattern
.
allMatches
(
body
))
{
final
String
copyright
=
match
.
group
(
pattern
.
copyrightIndex
);
final
String
authors
=
pattern
.
authorIndex
!=
null
?
match
.
group
(
pattern
.
authorIndex
)
:
null
;
final
String
filename
=
match
.
group
(
pattern
.
fileIndex
);
...
...
@@ -827,7 +827,7 @@ Iterable<_LicenseMatch> _tryReferenceByFilename(String body, LicenseFileReferenc
yield
*
_expand
(
template
,
copyright
,
entireLicense
,
match
.
start
,
match
.
end
,
debug:
'_tryReferenceByFilename (with explicit copyright) looking for
$filename
'
,
origin:
origin
);
}
}
else
{
for
(
_PartialLicenseMatch
match
in
_findLicenseBlocks
(
body
,
pattern
.
pattern
,
pattern
.
firstPrefixIndex
,
pattern
.
indentPrefixIndex
,
needsCopyright:
pattern
.
needsCopyright
))
{
for
(
final
_PartialLicenseMatch
match
in
_findLicenseBlocks
(
body
,
pattern
.
pattern
,
pattern
.
firstPrefixIndex
,
pattern
.
indentPrefixIndex
,
needsCopyright:
pattern
.
needsCopyright
))
{
final
String
authors
=
match
.
getAuthors
();
String
filename
=
match
.
group
(
pattern
.
fileIndex
);
if
(
filename
==
'modp_b64.c'
)
...
...
@@ -848,7 +848,7 @@ Iterable<_LicenseMatch> _tryReferenceByFilename(String body, LicenseFileReferenc
}
Iterable
<
_LicenseMatch
>
_tryReferenceByType
(
String
body
,
RegExp
pattern
,
LicenseSource
parentDirectory
,
{
String
origin
,
bool
needsCopyright
=
true
})
sync
*
{
for
(
_PartialLicenseMatch
match
in
_findLicenseBlocks
(
body
,
pattern
,
1
,
2
,
needsCopyright:
needsCopyright
))
{
for
(
final
_PartialLicenseMatch
match
in
_findLicenseBlocks
(
body
,
pattern
,
1
,
2
,
needsCopyright:
needsCopyright
))
{
final
LicenseType
type
=
convertLicenseNameToType
(
match
.
group
(
3
));
final
License
template
=
parentDirectory
.
nearestLicenseOfType
(
type
);
if
(
template
==
null
)
...
...
@@ -865,7 +865,7 @@ Iterable<_LicenseMatch> _tryReferenceByType(String body, RegExp pattern, License
}
}
License
_dereferenceLicense
(
int
groupIndex
,
String
group
(
int
index
)
,
MultipleVersionedLicenseReferencePattern
pattern
,
LicenseSource
parentDirectory
,
{
String
origin
})
{
License
_dereferenceLicense
(
int
groupIndex
,
String
Function
(
int
index
)
group
,
MultipleVersionedLicenseReferencePattern
pattern
,
LicenseSource
parentDirectory
,
{
String
origin
})
{
License
result
=
pattern
.
checkLocalFirst
?
parentDirectory
.
nearestLicenseWithName
(
group
(
groupIndex
))
:
null
;
if
(
result
==
null
)
{
String
suffix
=
''
;
...
...
@@ -877,9 +877,9 @@ License _dereferenceLicense(int groupIndex, String group(int index), MultipleVer
}
Iterable
<
_LicenseMatch
>
_tryReferenceByUrl
(
String
body
,
MultipleVersionedLicenseReferencePattern
pattern
,
LicenseSource
parentDirectory
,
{
String
origin
})
sync
*
{
for
(
_PartialLicenseMatch
match
in
_findLicenseBlocks
(
body
,
pattern
.
pattern
,
1
,
2
,
needsCopyright:
false
))
{
for
(
final
_PartialLicenseMatch
match
in
_findLicenseBlocks
(
body
,
pattern
.
pattern
,
1
,
2
,
needsCopyright:
false
))
{
bool
isDuplicate
=
false
;
for
(
int
index
in
pattern
.
licenseIndices
)
{
for
(
final
int
index
in
pattern
.
licenseIndices
)
{
final
License
result
=
_dereferenceLicense
(
index
,
match
.
group
,
pattern
,
parentDirectory
,
origin:
origin
);
yield
_LicenseMatch
(
result
,
match
.
start
,
match
.
end
,
isDuplicate:
isDuplicate
,
debug:
'_tryReferenceByUrl'
);
isDuplicate
=
true
;
...
...
@@ -892,7 +892,7 @@ Iterable<_LicenseMatch> _tryInline(String body, RegExp pattern, {
String
origin
,
})
sync
*
{
assert
(
needsCopyright
!=
null
);
for
(
_PartialLicenseMatch
match
in
_findLicenseBlocks
(
body
,
pattern
,
1
,
2
,
needsCopyright:
false
))
{
for
(
final
_PartialLicenseMatch
match
in
_findLicenseBlocks
(
body
,
pattern
,
1
,
2
,
needsCopyright:
false
))
{
// We search with "needsCopyright: false" but then create a _LicenseMatch with
// "missingCopyrights: true" if our own "needsCopyright" argument is true.
// We use a template license here (not unique) because it's not uncommon for files
...
...
@@ -902,7 +902,7 @@ Iterable<_LicenseMatch> _tryInline(String body, RegExp pattern, {
}
Iterable
<
_LicenseMatch
>
_tryForwardReferencePattern
(
String
fileContents
,
ForwardReferencePattern
pattern
,
License
template
,
{
String
origin
})
sync
*
{
for
(
_PartialLicenseMatch
match
in
_findLicenseBlocks
(
fileContents
,
pattern
.
pattern
,
pattern
.
firstPrefixIndex
,
pattern
.
indentPrefixIndex
))
{
for
(
final
_PartialLicenseMatch
match
in
_findLicenseBlocks
(
fileContents
,
pattern
.
pattern
,
pattern
.
firstPrefixIndex
,
pattern
.
indentPrefixIndex
))
{
if
(!
template
.
body
.
contains
(
pattern
.
targetPattern
))
{
throw
'forward license reference to unexpected license
\n
'
...
...
@@ -957,11 +957,11 @@ List<License> determineLicensesFor(String fileContents, String filename, License
return
a
.
end
-
b
.
end
;
});
int
position
=
0
;
for
(
_LicenseMatch
m
in
verificationList
)
{
for
(
final
_LicenseMatch
m
in
verificationList
)
{
if
(
m
.
isDuplicate
)
continue
;
// some text expanded into multiple licenses, so overlapping is expected
if
(
position
>
m
.
start
)
{
for
(
_LicenseMatch
n
in
results
)
for
(
final
_LicenseMatch
n
in
results
)
print
(
'license match:
${n.start}
..
${n.end}
,
${n.debug}
, first line:
${n.license.body.split("\n").first}
'
);
throw
'overlapping licenses in
$filename
(one ends at
$position
, another starts at
${m.start}
)'
;
}
...
...
@@ -984,10 +984,10 @@ License interpretAsRedirectLicense(String fileContents, LicenseSource parentDire
}
final
String
body
=
split
.
getConditions
().
trim
();
License
result
;
for
(
MultipleVersionedLicenseReferencePattern
pattern
in
csReferencesByUrl
)
{
for
(
final
MultipleVersionedLicenseReferencePattern
pattern
in
csReferencesByUrl
)
{
final
Match
match
=
pattern
.
pattern
.
matchAsPrefix
(
body
);
if
(
match
!=
null
&&
match
.
start
==
0
&&
match
.
end
==
body
.
length
)
{
for
(
int
index
in
pattern
.
licenseIndices
)
{
for
(
final
int
index
in
pattern
.
licenseIndices
)
{
final
License
candidate
=
_dereferenceLicense
(
index
,
match
.
group
,
pattern
,
parentDirectory
,
origin:
origin
);
if
(
result
!=
null
&&
candidate
!=
null
)
throw
'Multiple potential matches in interpretAsRedirectLicense in
$parentDirectory
; body was:
\n
------8<------
\n
$fileContents
\n
------8<------'
;
...
...
tools/licenses/lib/main.dart
浏览文件 @
b68786a4
此差异已折叠。
点击以展开。
tools/licenses/lib/patterns.dart
浏览文件 @
b68786a4
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ignore_for_file: use_raw_strings
// COMMON PATTERNS
const
String
kIndent
=
r'^((?:[-;@#<!.\\"/* ]*(?:REM[-;@#<!.\\"/* ]*)?[-;@#<!.\"/*]+)?)( *)'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录