Strong modeify the examples
This makes skyanalyzer also check the examples, and fixes everything it found there.
This commit is contained in:
@@ -17,7 +17,7 @@ class Field extends StatelessComponent {
|
||||
final String placeholder;
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return new Row([
|
||||
return new Row(<Widget>[
|
||||
new Padding(
|
||||
padding: const EdgeDims.symmetric(horizontal: 16.0),
|
||||
child: new Icon(type: icon, size: 24)
|
||||
@@ -37,7 +37,7 @@ class AddressBookHome extends StatelessComponent {
|
||||
Widget buildToolBar(BuildContext context) {
|
||||
return new ToolBar(
|
||||
left: new IconButton(icon: "navigation/arrow_back"),
|
||||
right: [new IconButton(icon: "navigation/check")]
|
||||
right: <Widget>[new IconButton(icon: "navigation/check")]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class AddressBookHome extends StatelessComponent {
|
||||
static final GlobalKey noteKey = new GlobalKey(label: 'note field');
|
||||
|
||||
Widget buildBody(BuildContext context) {
|
||||
return new Block([
|
||||
return new Block(<Widget>[
|
||||
new AspectRatio(
|
||||
aspectRatio: 16.0 / 9.0,
|
||||
child: new Container(
|
||||
|
||||
@@ -30,8 +30,8 @@ const List<Color> textColors = const <Color>[
|
||||
const Color(0xFF000000),
|
||||
];
|
||||
|
||||
final List<TextStyle> textStyles = textColors.map((color) {
|
||||
return new TextStyle(color: color, fontWeight: bold, textAlign: TextAlign.center);
|
||||
final List<TextStyle> textStyles = textColors.map((Color color) {
|
||||
return new TextStyle(color: color, fontWeight: bold, textAlign: TextAlign.center);
|
||||
}).toList();
|
||||
|
||||
enum CellState { covered, exploded, cleared, flagged, shown }
|
||||
@@ -64,10 +64,10 @@ class MineDiggerState extends State<MineDigger> {
|
||||
hasWon = false;
|
||||
detectedCount = 0;
|
||||
// Initialize matrices.
|
||||
cells = new List<List>.generate(rows, (int row) {
|
||||
cells = new List<List<bool>>.generate(rows, (int row) {
|
||||
return new List<bool>.filled(cols, false);
|
||||
});
|
||||
uiState = new List<List>.generate(rows, (int row) {
|
||||
uiState = new List<List<CellState>>.generate(rows, (int row) {
|
||||
return new List<CellState>.filled(cols, CellState.covered);
|
||||
});
|
||||
// Place the mines.
|
||||
|
||||
@@ -8,10 +8,17 @@ dependencies:
|
||||
sky_tools: ">=0.0.26"
|
||||
cipher: any
|
||||
asn1lib: any
|
||||
flutter_rendering_examples: any
|
||||
flutter_sprites: any
|
||||
playfair: any
|
||||
dependency_overrides:
|
||||
material_design_icons:
|
||||
path: ../material_design_icons
|
||||
flutter:
|
||||
path: ../sky
|
||||
flutter_rendering_examples:
|
||||
path: ../../../examples/rendering
|
||||
flutter_sprites:
|
||||
path: ../../../skysprites
|
||||
environment:
|
||||
sdk: '>=1.8.0 <2.0.0'
|
||||
|
||||
@@ -18,32 +18,43 @@ 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).*found[.]'),
|
||||
re.compile(r'^[0-9]+ (error|warning|hint).*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
|
||||
|
||||
# String mode hints. Those are going away anyway, but these in particular aren't useful.
|
||||
re.compile(r'^\[hint\] .+ requires dynamic invoke'), # too many false positives, e.g. https://github.com/dart-lang/sdk/issues/24564
|
||||
re.compile(r'^\[hint\] Runtime check on non-ground type .+ may throw StrongModeError'), # https://github.com/dart-lang/sdk/issues/24565
|
||||
re.compile(r'^\[hint] \([_, ]+\) .+ has inferred type '), # ignore underscore-only arguments
|
||||
re.compile(r'^\[error\] Type check failed: .*\(dynamic\) is not of type'), # allow unchecked casts from dynamic
|
||||
|
||||
# Bogus hint
|
||||
re.compile(r'^\[hint\] \(toText == toPlainText\) \? toStyledText : toPlainText has inferred type \(String, String\) → Widget \(.+styled_text.dart,.+\)'), # https://github.com/dart-lang/sdk/issues/24710
|
||||
|
||||
# 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.'),
|
||||
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():
|
||||
@@ -56,11 +67,16 @@ def main():
|
||||
app_paths = [args.app_path]
|
||||
else:
|
||||
# If no app_path is provided, then run the analyzer on any Dart file
|
||||
# within the unit tests.
|
||||
# within the unit tests and examples directories.
|
||||
app_paths = []
|
||||
for root, _, files in os.walk(SKY_UNIT_TESTS):
|
||||
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"))
|
||||
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"))
|
||||
if '.pub' in dirs:
|
||||
dirs.remove('.pub')
|
||||
|
||||
try:
|
||||
subprocess.check_output([
|
||||
|
||||
Reference in New Issue
Block a user