-
-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement quick_fix for talawa_good_doc and enforce tab before None o…
…f params block (#1754) * implement quick_fix for talawa_good_doc and enforce tab before None of params block * fix order of errors * make error more descriptive * Improve param message a bit * fix formatting * Add URL to talawa-docs in the lint errors
- Loading branch information
1 parent
e37dc3e
commit fb94a56
Showing
15 changed files
with
479 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import 'package:analyzer/error/listener.dart'; | ||
import 'package:custom_lint_builder/custom_lint_builder.dart'; | ||
import 'package:talawa_lint/talawa_api_doc/talawa_api_doc_fixer.dart'; | ||
import 'package:talawa_lint/talawa_api_doc/talawa_api_doc_visitor.dart'; | ||
|
||
class TalawaApiDocLintRule extends DartLintRule { | ||
const TalawaApiDocLintRule() : super(code: _code); | ||
|
||
/// Metadata about the warning that will show-up in the IDE. | ||
/// This is used for `// ignore: code` and enabling/disabling the lint | ||
static const _code = LintCode( | ||
name: 'talawa_api_doc', | ||
problemMessage: 'No documentation found for this field.', | ||
correctionMessage: "Add a valid documentation describing usecase.", | ||
url: "https://docs.talawa.io/docs/developers/talawa/talawa-lint/", | ||
); | ||
|
||
@override | ||
void run( | ||
CustomLintResolver resolver, | ||
ErrorReporter reporter, | ||
CustomLintContext context, | ||
) { | ||
final visitor = TalawaApiDocVisitor( | ||
this, | ||
context, | ||
reporter, | ||
); | ||
|
||
context.registry.addClassDeclaration( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addClassTypeAlias( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addCompilationUnit( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addConstructorDeclaration( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addEnumConstantDeclaration( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addEnumDeclaration( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addExtensionDeclaration( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addFieldDeclaration( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addFunctionDeclaration( | ||
(node) => visitor.check(node), | ||
); | ||
context.registry.addFunctionTypeAlias( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addGenericTypeAlias( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addMixinDeclaration( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addVariableDeclaration( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
context.registry.addTopLevelVariableDeclaration( | ||
(node) => node.visitChildren(visitor), | ||
); | ||
} | ||
|
||
@override | ||
List<Fix> getFixes() => [ | ||
TalawaAPIDocFixer(), | ||
]; | ||
} |
Oops, something went wrong.