This repository was archived by the owner on Jan 15, 2025. It is now read-only.
File tree 3 files changed +17
-14
lines changed
3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change
1
+ from pkg_resources import (
2
+ get_distribution as _get_distribution ,
3
+ DistributionNotFound as _DistributionNotFound ,
4
+ )
5
+
6
+ try :
7
+ __version__ = _get_distribution (__name__ ).version
8
+ except _DistributionNotFound : # pragma: no cover
9
+ # package is not installed
10
+ __version__ = "0.0.0"
11
+
1
12
from .flake8_plugin import Plugin
2
13
3
14
__all__ = ["Plugin" ]
Original file line number Diff line number Diff line change 1
1
import ast
2
- from pkg_resources import (
3
- get_distribution as _get_distribution ,
4
- DistributionNotFound as _DistributionNotFound ,
5
- )
2
+
6
3
from typing import List , Tuple , Type
7
4
5
+ from flake8_idom_hooks import __version__
6
+
8
7
from .utils import ErrorVisitor
9
8
from .rules_of_hooks import RulesOfHooksVisitor
10
9
from .exhaustive_deps import ExhaustiveDepsVisitor
11
10
12
- try :
13
- __version__ = _get_distribution (__name__ ).version
14
- except _DistributionNotFound : # pragma: no cover
15
- # package is not installed
16
- __version__ = "0.0.0"
17
-
18
11
19
12
class Plugin :
20
13
21
14
name = __name__
22
15
version = __version__
23
- options = None
24
16
25
17
_visitor_types : List [Type [ErrorVisitor ]] = [
26
18
RulesOfHooksVisitor ,
Original file line number Diff line number Diff line change @@ -64,9 +64,9 @@ def _check_if_propper_hook_usage(
64
64
msg = f"hook { name !r} used outside element or hook definition"
65
65
self ._save_error (101 , node , msg )
66
66
67
- _loop_or_conditional = self ._current_conditional or self ._current_loop
68
- if _loop_or_conditional is not None :
69
- node_type = type (_loop_or_conditional )
67
+ loop_or_conditional = self ._current_conditional or self ._current_loop
68
+ if loop_or_conditional is not None :
69
+ node_type = type (loop_or_conditional )
70
70
node_type_to_name = {
71
71
ast .If : "if statement" ,
72
72
ast .IfExp : "inline if expression" ,
You can’t perform that action at this time.
0 commit comments