This repository was archived by the owner on Jan 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Expand file tree Collapse file tree 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+
112from .flake8_plugin import Plugin
213
314__all__ = ["Plugin" ]
Original file line number Diff line number Diff line change 11import ast
2- from pkg_resources import (
3- get_distribution as _get_distribution ,
4- DistributionNotFound as _DistributionNotFound ,
5- )
2+
63from typing import List , Tuple , Type
74
5+ from flake8_idom_hooks import __version__
6+
87from .utils import ErrorVisitor
98from .rules_of_hooks import RulesOfHooksVisitor
109from .exhaustive_deps import ExhaustiveDepsVisitor
1110
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-
1811
1912class Plugin :
2013
2114 name = __name__
2215 version = __version__
23- options = None
2416
2517 _visitor_types : List [Type [ErrorVisitor ]] = [
2618 RulesOfHooksVisitor ,
Original file line number Diff line number Diff line change @@ -64,9 +64,9 @@ def _check_if_propper_hook_usage(
6464 msg = f"hook { name !r} used outside element or hook definition"
6565 self ._save_error (101 , node , msg )
6666
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 )
7070 node_type_to_name = {
7171 ast .If : "if statement" ,
7272 ast .IfExp : "inline if expression" ,
You can’t perform that action at this time.
0 commit comments