analyzer: Add a test-directory-specific analysis options file

Change-Id: I6f8ce377923756a0ac31a377c75632216bcec0c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365867
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
Sam Rawlins
2024-05-10 15:52:03 +00:00
committed by Commit Queue
parent 1b075fb407
commit f1aa891d6a
16 changed files with 52 additions and 20 deletions
+17 -9
View File
@@ -9,26 +9,34 @@ analyzer:
# still reported. Re-evaluate after
# https://github.com/dart-lang/language/pull/599 and a functional fix land.
inference_failure_on_untyped_parameter: ignore
# There are about 10k violations in test/ due to missing return types on
# test methods. It would be nice to mark this code as
# "ignored for test/**/*.dart".
inference_failure_on_function_return_type: ignore
# Lints from the recommended set that conflict w/ analyzer style or will
# require some work to reach compliance.
# See: https://github.com/dart-lang/sdk/issues/48784
avoid_renaming_method_parameters: ignore
# We sometimes name test classes with an underscore, and have a consistent
# practice of doing so. We do not have an problems of naming classes with
# snake_case, so we're not missing much by disabling it. Re-enable when we
# can ignore a lint rule for a certain path.
camel_case_types: ignore
# More than 500 violations in lib/.
constant_identifier_names: ignore
# About 10 violations in lib/.
hash_and_equals: ignore
# More than 500 violations in lib/.
non_constant_identifier_names: ignore
# This package imports much of the implementation libraries of the
# '_fe_analyzer_shared' package, because it is tightly integrated. This
# will not likely change any time soon.
implementation_imports: ignore
# About 20 violations of this in lib/.
library_private_types_in_public_api: ignore
# About 30 violations of this in lib/.
provide_deprecation_message: ignore
# Ignoring this for all developers means developers don't need to ignore
# TODOs in their IDE settings.
todo: ignore
language:
@@ -6113,6 +6113,8 @@ class ParameterElementImpl extends VariableElementImpl
}
/// The parameter of an implicit setter.
// Pre-existing name.
// ignore: camel_case_types
class ParameterElementImpl_ofImplicitSetter extends ParameterElementImpl {
final PropertyAccessorElementImpl_ImplicitSetter setter;
@@ -6454,6 +6456,8 @@ class PropertyAccessorElementImpl extends ExecutableElementImpl
}
/// Implicit getter for a [PropertyInducingElementImpl].
// Pre-existing name.
// ignore: camel_case_types
class PropertyAccessorElementImpl_ImplicitGetter
extends PropertyAccessorElementImpl {
/// Create the implicit getter and bind it to the [property].
@@ -6514,6 +6518,8 @@ class PropertyAccessorElementImpl_ImplicitGetter
}
/// Implicit setter for a [PropertyInducingElementImpl].
// Pre-existing name.
// ignore: camel_case_types
class PropertyAccessorElementImpl_ImplicitSetter
extends PropertyAccessorElementImpl {
/// Create the implicit setter and bind it to the [property].
+2
View File
@@ -166,6 +166,8 @@ class SdkDescription {
}
}
// Pre-existing name.
// ignore: camel_case_types
class SdkLibrariesReader_LibraryBuilder extends RecursiveAstVisitor<void> {
/// The prefix added to the name of a library to form the URI used in code to
/// reference the library.
@@ -952,7 +952,7 @@ class AstBinaryWriter extends ThrowingAstVisitor<void> {
_writeStringReference(token.lexeme);
}
_writeDouble(double value) {
void _writeDouble(double value) {
_sink.addDouble(value);
}
@@ -37,7 +37,7 @@ class MacroElementsMerger {
});
void perform({
required Function() updateConstants,
required void Function() updateConstants,
}) {
_mergeClasses();
_mergeFunctions();
@@ -54,6 +54,8 @@ abstract class OperationPerformanceDataImpl<T>
}
}
// Pre-existing name.
// ignore: camel_case_types
class OperationPerformanceDataImpl_int
extends OperationPerformanceDataImpl<int> {
@override
+14
View File
@@ -0,0 +1,14 @@
include: ../analysis_options.yaml
analyzer:
errors:
# There are about 10k violations here due to missing return types on test
# methods.
inference_failure_on_function_return_type: ignore
# We sometimes name test classes with an underscore, and have a consistent
# practice of doing so. We do not have an problems of naming classes with
# snake_case, so we're not missing much by disabling it.
camel_case_types: ignore
constant_identifier_names: ignore
non_constant_identifier_names: ignore
@@ -7,7 +7,7 @@ import 'dart:io';
import 'package:analyzer/src/summary/idl.dart';
import 'package:args/args.dart';
main(List<String> args) {
void main(List<String> args) {
ArgParser argParser = ArgParser()..addFlag('raw');
ArgResults argResults = argParser.parse(args);
if (argResults.rest.length != 1) {
@@ -11,7 +11,7 @@ import 'generate.dart';
/// Check that all targets have been code generated. If they haven't tell the
/// user to run `generate.dart`.
main() async {
void main() async {
String script = Platform.script.toFilePath(windows: Platform.isWindows);
List<String> components = split(script);
int index = components.indexOf('analyzer');
+1 -1
View File
@@ -11,7 +11,7 @@ import 'package:analyzer_utilities/tools.dart';
import 'package:path/path.dart';
import 'package:yaml/yaml.dart' show YamlMap, loadYaml;
main() async {
void main() async {
await GeneratedContent.generateAll(
normalize(join(pkg_root.packageRoot, 'analyzer')), allTargets);
}
@@ -24,7 +24,7 @@ import 'package:yaml/yaml.dart';
import 'error_code_info.dart';
main() {
void main() {
var errorDeclarations = _findErrorDeclarations();
var errorCodesByClass = _findErrorCodesByClass();
_generateYaml(errorCodesByClass, errorDeclarations);
+1 -1
View File
@@ -10,7 +10,7 @@ import 'generate.dart';
/// Check that the target file has been code generated. If it hasn't tell the
/// user to run generate.dart.
main() async {
void main() async {
var idlFolderPath = normalize(
join(package_root.packageRoot, 'analyzer', 'lib', 'src', 'summary'));
var idlPath = normalize(join(idlFolderPath, 'idl.dart'));
+1 -1
View File
@@ -26,7 +26,7 @@ import 'package:analyzer_utilities/tools.dart';
import 'idl_model.dart' as idl_model;
import 'mini_ast.dart';
main(List<String> args) async {
void main(List<String> args) async {
if (args.length != 1) {
print('Error: IDL path is required');
print('usage: dart generate.dart path/to/idl.dart');
@@ -6,7 +6,7 @@ import 'dart:io';
/// A simple command-line app that reads the content of a file containing the
/// output from `test.py` and performs some simple analysis of it.
main(List<String> args) async {
void main(List<String> args) async {
if (args.length != 1) {
print('Usage: dart test_log_parser logFilePath');
return;
+1 -1
View File
@@ -4,7 +4,7 @@
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart' as id;
main() async {
void main() async {
await id.updateAllTests(idTests);
}
+1 -1
View File
@@ -339,7 +339,7 @@ class _TrivialEncoding extends _Encoding {
}
extension<T> on List<T> {
forEachSeparated(void Function() separator, void Function(T) callback) {
void forEachSeparated(void Function() separator, void Function(T) callback) {
void Function()? nextSeparator;
for (var item in this) {
nextSeparator?.call();