lizard 1.17.24__py2.py3-none-any.whl → 1.17.27__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lizard
3
- Version: 1.17.24
3
+ Version: 1.17.27
4
4
  Summary: A code analyzer without caring the C/C++ header files. It works with Java, C/C++, JavaScript, Python, Ruby, Swift, Objective C. Metrics includes cyclomatic complexity number etc.
5
5
  Home-page: http://www.lizard.ws
6
6
  Download-URL: https://pypi.python.org/lizard/
@@ -25,7 +25,7 @@ lizard_ext/lizardns.py,sha256=8pztUoRS_UWN24MawwxeHEJgYh49id5PWODUBb6O72U,4184
25
25
  lizard_ext/lizardoutside.py,sha256=FGm2tbBZ17-2OCgmQlD-vobUCfQKb0FAygf86eM3xuM,336
26
26
  lizard_ext/lizardstatementcount.py,sha256=xYk6ixSIItSE1BWQXzrWmduFgGhA3VR817SNKLffyVQ,1182
27
27
  lizard_ext/lizardwordcount.py,sha256=2QYXD7-AtkkgAbi9VSidunMbSsGQ7MKYb6IT-bS-cok,7575
28
- lizard_ext/version.py,sha256=5EWG0zrw8uPuX6Rn7CaOTVJa6kB-qGS0Tk91MFU8t7o,182
28
+ lizard_ext/version.py,sha256=ifLmnnW7z1u6nkJUVvmUgSy98E-YourXV_bcy6y1FiY,182
29
29
  lizard_ext/xmloutput.py,sha256=-cbh0he4O_X-wX56gkv9AnSPNN0qvR7FACqlBeezUS4,5609
30
30
  lizard_languages/__init__.py,sha256=ArNmUrVSU6HFxhDka1-vWMZpVIM39P-gqv6BoOLNMV8,1522
31
31
  lizard_languages/clike.py,sha256=INd5tkvwEVZm7dx2yHG2OIFHZn7JzQGmnT9WQNFZ2XU,11110
@@ -36,7 +36,7 @@ lizard_languages/fortran.py,sha256=KATDsnfjob5W3579A_VxbwrbTkK7Rx3p0eXdBgjx25I,8
36
36
  lizard_languages/gdscript.py,sha256=KwlGoODilQnFgXvODpq_XlA6fV3hGbN9fd7bsiEUn78,637
37
37
  lizard_languages/go.py,sha256=iU2wZ0Iuo4OifscZhoHS_jDbdGYxquocqmvYX0l9MnE,1358
38
38
  lizard_languages/golike.py,sha256=vRIfjTVvc0VmJf27lTOLht55ZF1AQ9wn0Fvu-9WabWk,2858
39
- lizard_languages/java.py,sha256=c1rd0PN4iIrYHPLTFW67YsBX6pizsrJma3tfCDj9B2Q,4936
39
+ lizard_languages/java.py,sha256=QkUBAyXMn8a99KpebBdsmFyLQd88X3XrioIL9h4yRZ4,6128
40
40
  lizard_languages/javascript.py,sha256=qqxocZbZ6ivchhswRBBSjEJKiTClnm9ScOy4nlX4JKA,318
41
41
  lizard_languages/js_style_language_states.py,sha256=AdiehzSziZIbuWMomYmchNsJr7ZqtxN6l29osj3SA3A,4431
42
42
  lizard_languages/js_style_regex_expression.py,sha256=Xgyogch4xElYtCG4EnBKvalHTl3tjRPcIIcIQRRd61I,1970
@@ -51,7 +51,7 @@ lizard_languages/ruby.py,sha256=HL1ZckeuUUJU3QSVAOPsG_Zsl0C6X2PX5_VaWqclzkM,2277
51
51
  lizard_languages/rubylike.py,sha256=dAGZ2wqW8nqaESMU8HkeR9gwQ-q9fmZqE6AANvVZD1Q,3426
52
52
  lizard_languages/rust.py,sha256=DG2RkR9JWwcD6gIw-BPzg-Yo_lxQtSvfgHioFWIQm9o,610
53
53
  lizard_languages/scala.py,sha256=6Jr_TG945VYqB3o5weD7jN7S4beHt4aVj3r-fmKeMAM,1316
54
- lizard_languages/script_language.py,sha256=UUO3Wjkoa-ZqwwvcwvhOr5tg1rVavcrEYx3dNdoYSBc,531
54
+ lizard_languages/script_language.py,sha256=sDw-ssikPaouKjeKwdyGoAyv6F8650lh2e1X_FP8TN0,1200
55
55
  lizard_languages/solidity.py,sha256=Z0GD7U5bI5eUikdy7m_iKWeFD5yXRYq4r3zycscOhJQ,553
56
56
  lizard_languages/swift.py,sha256=p8S2OAkQOx9YQ02yhoVXFkr7pMqUH1Nb3RVXPHRU_9M,2450
57
57
  lizard_languages/tnsdl.py,sha256=pGcalA_lHY362v2wwPS86seYBOOBBjvmU6vd4Yy3A9g,2803
@@ -60,9 +60,9 @@ lizard_languages/ttcn.py,sha256=ygjw_raBmPF-4mgoM8m6CAdyEMpTI-n1kZJK1RL4Vxo,2131
60
60
  lizard_languages/typescript.py,sha256=P_rphg5AXJAk9QetmvVKc2911ilPmiRa0Qa5fHWleJg,3829
61
61
  lizard_languages/vue.py,sha256=KXUBUo2R1zNF8Pffrz_KsQEN44m5XFRMoGXylxKUeT0,1038
62
62
  lizard_languages/zig.py,sha256=NX1iyBstBuJFeAGBOAIaRfrmeBREne2HX6Pt4fXZZTQ,586
63
- lizard-1.17.24.dist-info/LICENSE.txt,sha256=05ZjgQ8Cl1dD9p0BhW-Txzkc5rhCogGJVEuf1GT2Y_M,1303
64
- lizard-1.17.24.dist-info/METADATA,sha256=DG9dDjfGKIo14W-cZ1cUKzdUQ68VdhpGe4HyxYN0QDc,16130
65
- lizard-1.17.24.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
66
- lizard-1.17.24.dist-info/entry_points.txt,sha256=ZBqPhu-J3NoGGW5vn2Gfyoo0vdVlgBgM-wlNm0SGYUQ,39
67
- lizard-1.17.24.dist-info/top_level.txt,sha256=5NTrTaOLhHuTzXaGcZPKfuaOgUv7WafNGe0Zl5aycpg,35
68
- lizard-1.17.24.dist-info/RECORD,,
63
+ lizard-1.17.27.dist-info/LICENSE.txt,sha256=05ZjgQ8Cl1dD9p0BhW-Txzkc5rhCogGJVEuf1GT2Y_M,1303
64
+ lizard-1.17.27.dist-info/METADATA,sha256=aeZ7pMw4GO1CV7KTRjp7XSL2LgAmqLTd_C8Vbq3ticA,16130
65
+ lizard-1.17.27.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
66
+ lizard-1.17.27.dist-info/entry_points.txt,sha256=ZBqPhu-J3NoGGW5vn2Gfyoo0vdVlgBgM-wlNm0SGYUQ,39
67
+ lizard-1.17.27.dist-info/top_level.txt,sha256=5NTrTaOLhHuTzXaGcZPKfuaOgUv7WafNGe0Zl5aycpg,35
68
+ lizard-1.17.27.dist-info/RECORD,,
lizard_ext/version.py CHANGED
@@ -3,4 +3,4 @@
3
3
  #
4
4
  # pylint: disable=missing-docstring,invalid-name
5
5
 
6
- version = "1.17.24"
6
+ version = "1.17.27"
lizard_languages/java.py CHANGED
@@ -25,13 +25,18 @@ class JavaStates(CLikeStates): # pylint: disable=R0903
25
25
  self.class_name = None
26
26
  self.is_record = False
27
27
  self.in_record_constructor = False
28
+ self.in_method_body = False
28
29
 
29
30
  def _state_old_c_params(self, token):
30
31
  if token == '{':
31
32
  self._state_dec_to_imp(token)
32
33
 
33
34
  def _state_imp(self, token):
35
+ # When entering a function implementation, set the flag
36
+ self.in_method_body = True
34
37
  def callback():
38
+ # When exiting the function implementation, clear the flag
39
+ self.in_method_body = False
35
40
  self.next(self._state_global)
36
41
  self.sub_state(JavaFunctionBodyStates(self.context), callback, token)
37
42
 
@@ -103,15 +108,37 @@ class JavaStates(CLikeStates): # pylint: disable=R0903
103
108
  class JavaFunctionBodyStates(JavaStates):
104
109
  def __init__(self, context):
105
110
  super(JavaFunctionBodyStates, self).__init__(context)
111
+ self.in_method_body = True
112
+ self.ignore_tokens = False # Additional flag to ignore tokens that could confuse the parser
113
+ self.handling_dot_class = False # Flag to handle .class token specifically
106
114
 
107
115
  @CodeStateMachine.read_inside_brackets_then("{}", "_state_dummy")
108
116
  @CodeStateMachine.read_inside_brackets_then("()", "_state_dummy")
109
117
  def _state_global(self, token):
118
+ # Special handling for .class token
119
+ if token == "." and not self.handling_dot_class:
120
+ self.handling_dot_class = True
121
+ return
122
+ if self.handling_dot_class:
123
+ self.handling_dot_class = False
124
+ if token == "class":
125
+ return # Skip the 'class' token after a dot
126
+
127
+ # Special handling for tokens that could confuse the parser
128
+ if self.ignore_tokens:
129
+ self.ignore_tokens = False
130
+ return
131
+
110
132
  if token == "new":
111
133
  self.next(self._state_new)
112
- self._try_start_a_class(token)
113
- if self.br_count == 0:
114
- self.statemachine_return()
134
+ else:
135
+ # Always try to parse class declarations, even in method bodies
136
+ # This ensures that local classes are properly detected
137
+ if self._try_start_a_class(token):
138
+ return
139
+
140
+ if self.br_count == 0:
141
+ self.statemachine_return()
115
142
 
116
143
  def _state_dummy(self, _):
117
144
  pass
@@ -10,7 +10,17 @@ class ScriptLanguageMixIn:
10
10
  @staticmethod
11
11
  def get_comment_from_token(token):
12
12
  if token.startswith("#"):
13
- return token[1:]
13
+ # For forgiveness comments, return the entire comment with directive intact
14
+ stripped = token.lstrip('#').strip()
15
+
16
+ # Handle forgiveness directives with proper formatting
17
+ if stripped.startswith('lizard forgive global') or stripped.startswith('#lizard forgive global'):
18
+ return '#lizard forgive global' # Preserve global directive
19
+ elif stripped.startswith('lizard forgive') or stripped.startswith('#lizard forgive'):
20
+ return '#lizard forgive' # Return standardized forgiveness comment
21
+
22
+ return stripped # Return the stripped comment for other cases
23
+ return None
14
24
 
15
25
  @staticmethod
16
26
  def generate_common_tokens(source_code, addition, match_holder=None):