2
2
3
3
import pycodestyle
4
4
5
+ from je_editor .utils .logging .loggin_instance import jeditor_logger
6
+
5
7
6
8
class PEP8FormatChecker (pycodestyle .Checker ):
7
9
8
10
def __init__ (self , filename : str , ** kwargs ):
11
+ jeditor_logger .info (f"Init PEP8FormatChecker "
12
+ f"filename: { filename } "
13
+ f"kwargs: { kwargs } " )
9
14
super ().__init__ (filename , ** kwargs )
10
15
# Init variable
11
16
self .physical_line = None
@@ -21,14 +26,22 @@ def __init__(self, filename: str, **kwargs):
21
26
self .total_lines = None
22
27
self .new_line = frozenset ([tokenize .NL , tokenize .NEWLINE ])
23
28
self .report_error = self .replace_report_error
29
+ self .current_file : str = filename
24
30
self .error_list : list = list ()
25
31
26
32
def replace_report_error (self , line_number , offset , text , check ):
33
+ jeditor_logger .info (f"PEP8FormatChecker replace_report_error "
34
+ f"line_number: { line_number } "
35
+ f"offset: { offset } "
36
+ f"text: { text } " )
27
37
if not text .startswith ("W191" ):
28
38
self .error_list .append (f"{ text } on line: { line_number } , offset: { offset } " )
29
39
30
40
def check_all_format (self , expected = None , line_offset = 0 ) -> int :
31
41
"""Run all checks on the input file."""
42
+ jeditor_logger .info (f"PEP8FormatChecker check_all_format "
43
+ f"expected: { expected } "
44
+ f"line_offset: { line_offset } " )
32
45
self .report .init_file (self .filename , self .lines , expected , line_offset )
33
46
self .total_lines = len (self .lines )
34
47
if self ._ast_checks :
0 commit comments