Skip to content

Commit

Permalink
Don't pass --fatal-infos to dart analyze in validation (#3877)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigurdm authored Apr 18, 2023
1 parent 95044c2 commit 21eb39e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
7 changes: 1 addition & 6 deletions lib/src/validator/analyze.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ class AnalyzeValidator extends Validator {
.where(dirExists);
final result = await runProcess(
Platform.resolvedExecutable,
[
'analyze',
'--fatal-infos',
...dirsToAnalyze,
p.join(entrypoint.rootDir, 'pubspec.yaml')
],
['analyze', ...dirsToAnalyze, p.join(entrypoint.rootDir, 'pubspec.yaml')],
);
if (result.exitCode != 0) {
final limitedOutput = limitLength(result.stdout.join('\n'), 1000);
Expand Down
28 changes: 27 additions & 1 deletion test/validator/analyze_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void main() {
});

test(
'follows analysis_options.yaml and should warn if package contains errors in pubspec.yaml',
'follows analysis_options.yaml and should not warn if package contains only infos',
() async {
await d.dir(appPath, [
d.libPubspec(
Expand All @@ -53,6 +53,32 @@ linter:
''')
]).create();

await expectValidation();
});

test(
'follows analysis_options.yaml and should warn if package contains warnings in pubspec.yaml',
() async {
await d.dir(appPath, [
d.libPubspec(
'test_pkg', '1.0.0',
sdk: '^3.0.0',
// Using http where https is recommended.
extras: {'repository': 'http://repo.org/'},
),
d.file('LICENSE', 'Eh, do what you want.'),
d.file('README.md', "This package isn't real."),
d.file('CHANGELOG.md', '# 1.0.0\nFirst version\n'),
d.file('analysis_options.yaml', '''
linter:
rules:
- secure_pubspec_urls
analyzer:
errors:
secure_pubspec_urls: warning
''')
]).create();

await expectValidation(
error: allOf([
contains(
Expand Down

0 comments on commit 21eb39e

Please sign in to comment.