Skip to content

Commit

Permalink
Merge pull request #18 from bancolombia/fix/dart-rules
Browse files Browse the repository at this point in the history
- Remove angular rule definition
- Rename common rules to dart rules
- Change redirect from localhost to dcl.apps.bancolombia.com
  • Loading branch information
santitigaga authored Sep 21, 2023
2 parents f2b703a + cb25cf4 commit 874f174
Show file tree
Hide file tree
Showing 70 changed files with 134 additions and 147 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Changelog
## 1.1.1
- Rename common rules to dart rules
## 1.1.0
- Added new presets
- Removed Angular framework rules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ Issue createIssue({
/// Returns a url of a page containing documentation associated with [pattern]
Uri documentation(Pattern pattern) => Uri(
scheme: 'https',
host: 'localhost',
host: 'dcl.apps.bancolombia.com',
pathSegments: [
'docs',
'individuals',
'anti-patterns',
pattern.id,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ class LintAnalysisOptionsValidator {
severity: Severity.warning,
message:
"'${rule.ruleName}' is not recognized as a valid rule name.",
documentation: Uri.parse('https://localhost/rules'),
documentation:
Uri.parse('https://dcl.apps.bancolombia.com/docs/rules'),
location: _copySpanWithOffset(rule.span),
),
);
Expand All @@ -132,7 +133,8 @@ class LintAnalysisOptionsValidator {
severity: Severity.warning,
message:
"'${rule.ruleName}' requires a config to produce any diagnostics.",
documentation: Uri.parse('https://localhost/rules'),
documentation:
Uri.parse('https://dcl.apps.bancolombia.com/docs/rules'),
location: _copySpanWithOffset(rule.span),
),
);
Expand Down
3 changes: 1 addition & 2 deletions lib/src/analyzers/lint_analyzer/metrics/metric_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import 'models/metric_value_level.dart';
/// Returns the url of a page containing documentation associated with [metricId]
Uri documentation(String metricId) => Uri(
scheme: 'https',
host: 'localhost',
host: 'dcl.apps.bancolombia.com',
pathSegments: [
'docs',
'individuals',
'metrics',
metricId,
],
Expand Down
14 changes: 0 additions & 14 deletions lib/src/analyzers/lint_analyzer/rules/models/angular_rule.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import 'rule.dart';
import 'rule_type.dart';

/// Represents a base class for common rules.
abstract class CommonRule extends Rule {
const CommonRule({
abstract class DartRule extends Rule {
const DartRule({
required super.id,
required super.severity,
required super.excludes,
required super.includes,
}) : super(
type: RuleType.common,
type: RuleType.dart,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class RuleType {

const RuleType._(this.value);

static const common = RuleType._('common');
static const dart = RuleType._('dart');
static const flutter = RuleType._('flutter');
static const intl = RuleType._('intl');
static const angular = RuleType._('angular');
Expand Down
3 changes: 1 addition & 2 deletions lib/src/analyzers/lint_analyzer/rules/rule_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ Issue createIssue({
/// Returns a url of a page containing documentation associated with [rule]
Uri documentation(Rule rule) => Uri(
scheme: 'https',
host: 'localhost',
host: 'dcl.apps.bancolombia.com',
pathSegments: [
'docs',
'individuals',
'rules',
rule.type.value,
rule.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/replacement.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'config_parser.dart';
part 'visitor.dart';

class ArgumentsOrderingRule extends CommonRule {
class ArgumentsOrderingRule extends DartRule {
static const String ruleId = 'arguments-ordering';

static const _warningMessage =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'utils/config_parser.dart';
part 'visitor.dart';

class AvoidBannedImportsRule extends CommonRule {
class AvoidBannedImportsRule extends DartRule {
static const String ruleId = 'avoid-banned-imports';

final List<_AvoidBannedImportsConfigEntry> _entries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidCascadeAfterIfNullRule extends CommonRule {
class AvoidCascadeAfterIfNullRule extends DartRule {
static const String ruleId = 'avoid-cascade-after-if-null';

static const _warning =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'config_parser.dart';
part 'visitor.dart';

class AvoidCollectionMethodsWithUnrelatedTypesRule extends CommonRule {
class AvoidCollectionMethodsWithUnrelatedTypesRule extends DartRule {
static const String ruleId = 'avoid-collection-methods-with-unrelated-types';

static const _warning = 'Avoid collection methods with unrelated types.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/replacement.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidDoubleSlashImportsRule extends CommonRule {
class AvoidDoubleSlashImportsRule extends DartRule {
static const String ruleId = 'avoid-double-slash-imports';

static const _warning = 'Avoid double slash import/export directives.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidDuplicateExportsRule extends CommonRule {
class AvoidDuplicateExportsRule extends DartRule {
static const ruleId = 'avoid-duplicate-exports';
static const _issueMessage = 'Avoid declaring duplicate exports.';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidDynamicRule extends CommonRule {
class AvoidDynamicRule extends DartRule {
static const String ruleId = 'avoid-dynamic';

static const _warning = 'Avoid using dynamic type.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidGlobalStateRule extends CommonRule {
class AvoidGlobalStateRule extends DartRule {
static const String ruleId = 'avoid-global-state';

static const _warning =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidIgnoringReturnValuesRule extends CommonRule {
class AvoidIgnoringReturnValuesRule extends DartRule {
static const String ruleId = 'avoid-ignoring-return-values';

static const _warning = 'Avoid ignoring return values.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'config_parser.dart';
part 'visitor.dart';

class AvoidLateKeywordRule extends CommonRule {
class AvoidLateKeywordRule extends DartRule {
static const String ruleId = 'avoid-late-keyword';

static const _warning = "Avoid using 'late' keyword.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidMissingEnumConstantInMapRule extends CommonRule {
class AvoidMissingEnumConstantInMapRule extends DartRule {
static const String ruleId = 'avoid-missing-enum-constant-in-map';

static const _warning = 'Missing map entry for';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'config_parser.dart';
part 'visitor.dart';

class AvoidNestedConditionalExpressionsRule extends CommonRule {
class AvoidNestedConditionalExpressionsRule extends DartRule {
static const String ruleId = 'avoid-nested-conditional-expressions';

static const _warning = 'Avoid nested conditional expressions.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidNonAsciiSymbolsRule extends CommonRule {
class AvoidNonAsciiSymbolsRule extends DartRule {
static const String ruleId = 'avoid-non-ascii-symbols';

static const _warning = 'Avoid using non ascii symbols in string literals.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidNonNullAssertionRule extends CommonRule {
class AvoidNonNullAssertionRule extends DartRule {
static const String ruleId = 'avoid-non-null-assertion';

static const _warning = 'Avoid using non null assertion.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidPassingAsyncWhenSyncExpectedRule extends CommonRule {
class AvoidPassingAsyncWhenSyncExpectedRule extends DartRule {
static const String ruleId = 'avoid-passing-async-when-sync-expected';

static const _warningMessage = 'Expected a sync function but got async.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidRedundantAsyncRule extends CommonRule {
class AvoidRedundantAsyncRule extends DartRule {
static const String ruleId = 'avoid-redundant-async';

static const _warningMessage =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidSubstringRule extends CommonRule {
class AvoidSubstringRule extends DartRule {
static const String ruleId = 'avoid-substring';

static const _warning =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidThrowInCatchBlockRule extends CommonRule {
class AvoidThrowInCatchBlockRule extends DartRule {
static const String ruleId = 'avoid-throw-in-catch-block';

static const _warningMessage =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import '../../../lint_utils.dart';
import '../../../models/internal_resolved_unit_result.dart';
import '../../../models/issue.dart';
import '../../../models/severity.dart';
import '../../models/common_rule.dart';
import '../../models/dart_rule.dart';
import '../../rule_utils.dart';

part 'visitor.dart';

class AvoidTopLevelMembersInTestsRule extends CommonRule {
class AvoidTopLevelMembersInTestsRule extends DartRule {
static const String ruleId = 'avoid-top-level-members-in-tests';

static const _warning = 'Avoid declaring top-level members in tests.';
Expand Down
Loading

0 comments on commit 874f174

Please sign in to comment.