Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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