Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart

Issue 2962903002: Add support code to make fixes easier in plugins (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer_plugin/lib/utilities/fixes/fix_contributor_mixin.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart
diff --git a/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart b/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart
index 0cf5321893f5435d687a4b82bdf7f49c9b866ea6..865d1694db95aec311ace3cb84437324c7139640 100644
--- a/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart
+++ b/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart
@@ -108,3 +108,42 @@ class FixGenerator {
return new GeneratorResult(result, notifications);
}
}
+
+/**
+ * A description of a class of fixes. Instances are intended to hold the
+ * information that is common across a number of fixes and to be shared by those
+ * fixes. For example, if an unnecessary cast is found then one of the suggested
+ * fixes will be to remove the cast. If there are multiple unnecessary casts in
+ * a single file, then there will be multiple fixes, one per occurrence, but
+ * they will all share the same kind.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+class FixKind {
+ /**
+ * The name of this kind of fix, used for debugging.
+ */
+ final String name;
+
+ /**
+ * The priority of this kind of fix for the kind of error being addressed.
+ */
+ final int priority;
+
+ /**
+ * A human-readable description of the changes that will be applied by this
+ * kind of fix. The message can contain parameters, where each parameter is
+ * represented by a zero-based index inside curly braces. For example, the
+ * message `"Create a component named '{0}' in '{1}'"` contains two parameters.
+ */
+ final String message;
+
+ /**
+ * Initialize a newly created kind of fix to have the given [name],
+ * [priority] and [message].
+ */
+ const FixKind(this.name, this.priority, this.message);
+
+ @override
+ String toString() => name;
+}
« no previous file with comments | « pkg/analyzer_plugin/lib/utilities/fixes/fix_contributor_mixin.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698