• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dart-lang / linter / 3690449303

pending completion
3690449303

push

github

GitHub
Fix `unnecessary_parenthesis` with postfix bang operator. (#3904)

2 of 2 new or added lines in 1 file covered. (100.0%)

8263 of 8640 relevant lines covered (95.64%)

1.47 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/lib/src/rules/use_string_in_part_of_directives.dart
1
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2
// for details. All rights reserved. Use of this source code is governed by a
3
// BSD-style license that can be found in the LICENSE file.
4

5
import 'package:analyzer/dart/ast/ast.dart';
6
import 'package:analyzer/dart/ast/visitor.dart';
7

8
import '../analyzer.dart';
9

10
const _desc = r'Use string in part of directives.';
11

12
const _details = r'''
13
From [Effective Dart](https://dart.dev/guides/language/effective-dart/usage#do-use-strings-in-part-of-directives):
14

15
**DO** use strings in `part of` directives.
16

17
**BAD:**
18

19
```dart
20
part of my_library;
21
```
22

23
**GOOD:**
24

25
```dart
26
part of '../../my_library.dart';
27
```
28

29
''';
30

31
class UseStringInPartOfDirectives extends LintRule {
32
  UseStringInPartOfDirectives()
1✔
33
      : super(
1✔
34
          name: 'use_string_in_part_of_directives',
35
          description: _desc,
36
          details: _details,
37
          group: Group.style,
38
        );
39

40
  @override
1✔
41
  void registerNodeProcessors(
42
    NodeLintRegistry registry,
43
    LinterContext context,
44
  ) {
45
    var visitor = _Visitor(this);
1✔
46
    registry.addPartOfDirective(this, visitor);
1✔
47
  }
48
}
49

50
class _Visitor extends SimpleAstVisitor<void> {
51
  _Visitor(this.rule);
1✔
52

53
  final LintRule rule;
54

55
  @override
×
56
  void visitPartOfDirective(PartOfDirective node) {
57
    if (node.libraryName != null) {
×
58
      rule.reportLint(node);
×
59
    }
60
  }
61
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc