Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
b9b6ad3b
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
b9b6ad3b
编写于
11月 13, 2015
作者:
H
Hixie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Skyanalyzer is no longer needed.
上级
133a8781
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
108 deletion
+0
-108
sky/tools/skyanalyzer
sky/tools/skyanalyzer
+0
-108
未找到文件。
sky/tools/skyanalyzer
已删除
100755 → 0
浏览文件 @
133a8781
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import
argparse
import
os
import
re
import
subprocess
import
sys
SKY_TOOLS_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
SKY_ROOT
=
os
.
path
.
dirname
(
SKY_TOOLS_DIR
)
SRC_ROOT
=
os
.
path
.
dirname
(
SKY_ROOT
)
WORKBENCH
=
os
.
path
.
join
(
SRC_ROOT
,
'sky'
,
'packages'
,
'workbench'
)
DART_SDK
=
os
.
path
.
join
(
SRC_ROOT
,
'third_party'
,
'dart-sdk'
,
'dart-sdk'
,
'bin'
)
DARTANALYZER
=
os
.
path
.
join
(
DART_SDK
,
'dartanalyzer'
)
SKY_UNIT_TESTS
=
os
.
path
.
join
(
SKY_ROOT
,
'unit'
,
'test'
)
SKY_EXAMPLES
=
os
.
path
.
join
(
SRC_ROOT
,
'examples'
)
_IGNORED_PATTERNS
=
[
# Ignored because they're not indicative of specific errors.
re
.
compile
(
r
'^$'
),
re
.
compile
(
r
'^Analyzing \['
),
re
.
compile
(
r
'^No issues found'
),
re
.
compile
(
r
'^[0-9]+ (error|warning|hint|lint).*found\.'
),
# We still have some parts in our code, so silence the warnings that come from trying to analyze them directly.
re
.
compile
(
r
'^Only libraries can be analyzed\.$'
),
re
.
compile
(
r
'^.+ is a part and can not be analyzed\.$'
),
# Disable the Strong checks that we don't care about.
re
.
compile
(
r
'^\[error\] Invalid override\. The type of [^ ]+ \(.+\) is not a subtype of [^ ]+ \(.+\)\.'
),
# we allow type narrowing
re
.
compile
(
r
'^\[(warning|hint)\] .+ will need runtime check to cast to type .+'
),
# https://github.com/dart-lang/sdk/issues/24542
re
.
compile
(
r
'^\[error\] Type check failed: .*\(dynamic\) is not of type'
),
# allow unchecked casts from dynamic
# Bogus hint - https://github.com/dart-lang/sdk/issues/24710
re
.
compile
(
r
'^\[hint\] \(toText == toPlainText\) \? toStyledText : toPlainText has inferred type \(String, String\) → Widget \(.+styled_text.dart,.+\)'
),
re
.
compile
(
r
'^\[hint\] .+ [?:] \([_, ]+\) .+ has inferred type .+'
),
# analyzer doesn't support constructor tear-offs yet
re
.
compile
(
r
'.+/examples/widgets/drag_and_drop.dart, line 8[03], col .+'
),
# Disable the lint checks that will be caught by code review
re
.
compile
(
r
'^\[lint\] Avoid defining a one-member abstract class when a simple function will do'
),
re
.
compile
(
r
'^\[lint\] Prefer using lowerCamelCase for constant names\.'
),
re
.
compile
(
r
'^\[lint\] Name non-constant identifiers using lowerCamelCase\.'
),
# TODO: Fix all the warnings in the mojo packages
re
.
compile
(
r
'.*pub-cache.*\.mojom\.dart'
),
# It'd be nice if the other packages we used didn't have warnings, too...
re
.
compile
(
r
'.*pub-cache/hosted/pub.dartlang.org/'
),
re
.
compile
(
r
'.*/\.pub/deps/debug/[^/]+/lib/.+.dart, line [0-9]+, col [0-9]+'
),
]
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Sky Analyzer'
)
parser
.
add_argument
(
'--congratulate'
,
action
=
"store_true"
)
parser
.
add_argument
(
'app_path'
,
type
=
str
,
nargs
=
"?"
)
args
=
parser
.
parse_args
()
if
args
.
app_path
is
not
None
:
app_paths
=
[
args
.
app_path
]
else
:
# If no app_path is provided, then run the analyzer on any Dart file
# within the unit tests and examples directories.
app_paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
SKY_UNIT_TESTS
):
app_paths
.
extend
(
os
.
path
.
join
(
root
,
f
)
for
f
in
files
if
f
.
endswith
(
".dart"
)
and
not
'.#'
in
f
)
for
root
,
dirs
,
files
in
os
.
walk
(
SKY_EXAMPLES
):
app_paths
.
extend
(
os
.
path
.
join
(
root
,
f
)
for
f
in
files
if
f
.
endswith
(
".dart"
)
and
not
'.#'
in
f
)
if
'.pub'
in
dirs
:
dirs
.
remove
(
'.pub'
)
try
:
subprocess
.
check_output
([
DARTANALYZER
,
"--package-warnings"
,
"--package-root"
,
os
.
path
.
join
(
WORKBENCH
,
"packages"
),
"--ignore-unrecognized-flags"
,
"--fatal-hints"
,
"--fatal-warnings"
,
"--lints"
,
"--strong"
,
"--strong-hints"
,
"--enable-strict-call-checks"
,
"--enable_type_checks"
,
"--supermixin"
,
]
+
app_paths
,
stderr
=
subprocess
.
STDOUT
)
except
subprocess
.
CalledProcessError
as
e
:
errors
=
[
l
for
l
in
e
.
output
.
split
(
'
\n
'
)
if
not
any
(
p
.
match
(
l
)
for
p
in
_IGNORED_PATTERNS
)]
if
len
(
errors
)
>
0
:
for
error
in
errors
:
print
>>
sys
.
stderr
,
error
# Propagate analyzer error code.
return
e
.
returncode
# If we do not have any errors left after filtering, return 0.
if
args
.
congratulate
:
print
>>
sys
.
stdout
,
"No analyzer warnings!"
return
0
if
__name__
==
'__main__'
:
sys
.
exit
(
main
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录