lizard 1.17.24__tar.gz → 1.17.27__tar.gz

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.
Files changed (100) hide show
  1. {lizard-1.17.24 → lizard-1.17.27}/PKG-INFO +1 -1
  2. {lizard-1.17.24 → lizard-1.17.27}/lizard.egg-info/PKG-INFO +1 -1
  3. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/version.py +1 -1
  4. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/java.py +30 -3
  5. lizard-1.17.27/lizard_languages/script_language.py +31 -0
  6. lizard-1.17.24/lizard_languages/script_language.py +0 -21
  7. {lizard-1.17.24 → lizard-1.17.27}/LICENSE.txt +0 -0
  8. {lizard-1.17.24 → lizard-1.17.27}/README.rst +0 -0
  9. {lizard-1.17.24 → lizard-1.17.27}/lizard.egg-info/SOURCES.txt +0 -0
  10. {lizard-1.17.24 → lizard-1.17.27}/lizard.egg-info/dependency_links.txt +0 -0
  11. {lizard-1.17.24 → lizard-1.17.27}/lizard.egg-info/entry_points.txt +0 -0
  12. {lizard-1.17.24 → lizard-1.17.27}/lizard.egg-info/requires.txt +0 -0
  13. {lizard-1.17.24 → lizard-1.17.27}/lizard.egg-info/top_level.txt +0 -0
  14. {lizard-1.17.24 → lizard-1.17.27}/lizard.py +0 -0
  15. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/__init__.py +0 -0
  16. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/auto_open.py +0 -0
  17. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/csvoutput.py +0 -0
  18. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/default_ordered_dict.py +0 -0
  19. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/extension_base.py +0 -0
  20. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/htmloutput.py +0 -0
  21. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/keywords.py +0 -0
  22. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardboolcount.py +0 -0
  23. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardcomplextags.py +0 -0
  24. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardcpre.py +0 -0
  25. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizarddependencycount.py +0 -0
  26. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizarddumpcomments.py +0 -0
  27. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardduplicate.py +0 -0
  28. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardduplicated_param_list.py +0 -0
  29. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardexitcount.py +0 -0
  30. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardgotocount.py +0 -0
  31. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardignoreassert.py +0 -0
  32. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardio.py +0 -0
  33. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardmccabe.py +0 -0
  34. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardmodified.py +0 -0
  35. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardnd.py +0 -0
  36. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardnonstrict.py +0 -0
  37. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardns.py +0 -0
  38. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardoutside.py +0 -0
  39. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardstatementcount.py +0 -0
  40. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/lizardwordcount.py +0 -0
  41. {lizard-1.17.24 → lizard-1.17.27}/lizard_ext/xmloutput.py +0 -0
  42. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/__init__.py +0 -0
  43. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/clike.py +0 -0
  44. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/code_reader.py +0 -0
  45. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/csharp.py +0 -0
  46. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/erlang.py +0 -0
  47. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/fortran.py +0 -0
  48. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/gdscript.py +0 -0
  49. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/go.py +0 -0
  50. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/golike.py +0 -0
  51. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/javascript.py +0 -0
  52. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/js_style_language_states.py +0 -0
  53. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/js_style_regex_expression.py +0 -0
  54. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/jsx.py +0 -0
  55. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/kotlin.py +0 -0
  56. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/lua.py +0 -0
  57. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/objc.py +0 -0
  58. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/perl.py +0 -0
  59. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/php.py +0 -0
  60. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/python.py +0 -0
  61. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/ruby.py +0 -0
  62. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/rubylike.py +0 -0
  63. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/rust.py +0 -0
  64. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/scala.py +0 -0
  65. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/solidity.py +0 -0
  66. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/swift.py +0 -0
  67. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/tnsdl.py +0 -0
  68. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/tsx.py +0 -0
  69. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/ttcn.py +0 -0
  70. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/typescript.py +0 -0
  71. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/vue.py +0 -0
  72. {lizard-1.17.24 → lizard-1.17.27}/lizard_languages/zig.py +0 -0
  73. {lizard-1.17.24 → lizard-1.17.27}/setup.cfg +0 -0
  74. {lizard-1.17.24 → lizard-1.17.27}/setup.py +0 -0
  75. {lizard-1.17.24 → lizard-1.17.27}/test/testApplication.py +0 -0
  76. {lizard-1.17.24 → lizard-1.17.27}/test/testAssertionExtension.py +0 -0
  77. {lizard-1.17.24 → lizard-1.17.27}/test/testBasicFunctionInfo.py +0 -0
  78. {lizard-1.17.24 → lizard-1.17.27}/test/testCOutsideComplexity.py +0 -0
  79. {lizard-1.17.24 → lizard-1.17.27}/test/testCPreprocessorExtension.py +0 -0
  80. {lizard-1.17.24 → lizard-1.17.27}/test/testCommentOptions.py +0 -0
  81. {lizard-1.17.24 → lizard-1.17.27}/test/testCyclomaticComplexity.py +0 -0
  82. {lizard-1.17.24 → lizard-1.17.27}/test/testExtension.py +0 -0
  83. {lizard-1.17.24 → lizard-1.17.27}/test/testFilesFilter.py +0 -0
  84. {lizard-1.17.24 → lizard-1.17.27}/test/testFunctionDependencyCount.py +0 -0
  85. {lizard-1.17.24 → lizard-1.17.27}/test/testFunctionExitCount.py +0 -0
  86. {lizard-1.17.24 → lizard-1.17.27}/test/testFunctionGotoCount.py +0 -0
  87. {lizard-1.17.24 → lizard-1.17.27}/test/testFunctionStatementCount.py +0 -0
  88. {lizard-1.17.24 → lizard-1.17.27}/test/testHelpers.py +0 -0
  89. {lizard-1.17.24 → lizard-1.17.27}/test/testLanguages.py +0 -0
  90. {lizard-1.17.24 → lizard-1.17.27}/test/testMcCabe.py +0 -0
  91. {lizard-1.17.24 → lizard-1.17.27}/test/testNestedStructures.py +0 -0
  92. {lizard-1.17.24 → lizard-1.17.27}/test/testNestingDepth.py +0 -0
  93. {lizard-1.17.24 → lizard-1.17.27}/test/testOutput.py +0 -0
  94. {lizard-1.17.24 → lizard-1.17.27}/test/testOutputCSV.py +0 -0
  95. {lizard-1.17.24 → lizard-1.17.27}/test/testOutputFile.py +0 -0
  96. {lizard-1.17.24 → lizard-1.17.27}/test/testOutputHTML.py +0 -0
  97. {lizard-1.17.24 → lizard-1.17.27}/test/testTokenizer.py +0 -0
  98. {lizard-1.17.24 → lizard-1.17.27}/test/test_analyzer.py +0 -0
  99. {lizard-1.17.24 → lizard-1.17.27}/test/test_auto_open.py +0 -0
  100. {lizard-1.17.24 → lizard-1.17.27}/test/test_options.py +0 -0
@@ -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/
@@ -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/
@@ -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"
@@ -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
@@ -0,0 +1,31 @@
1
+ '''
2
+ Common behaviours of script languages
3
+ '''
4
+ from .code_reader import CodeReader
5
+
6
+
7
+ class ScriptLanguageMixIn:
8
+ # pylint: disable=R0903
9
+
10
+ @staticmethod
11
+ def get_comment_from_token(token):
12
+ if token.startswith("#"):
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
24
+
25
+ @staticmethod
26
+ def generate_common_tokens(source_code, addition, match_holder=None):
27
+ _until_end = r"(?:\\\n|[^\n])*"
28
+ return CodeReader.generate_tokens(
29
+ source_code,
30
+ r"|\#" + _until_end + addition,
31
+ match_holder)
@@ -1,21 +0,0 @@
1
- '''
2
- Common behaviours of script languages
3
- '''
4
- from .code_reader import CodeReader
5
-
6
-
7
- class ScriptLanguageMixIn:
8
- # pylint: disable=R0903
9
-
10
- @staticmethod
11
- def get_comment_from_token(token):
12
- if token.startswith("#"):
13
- return token[1:]
14
-
15
- @staticmethod
16
- def generate_common_tokens(source_code, addition, match_holder=None):
17
- _until_end = r"(?:\\\n|[^\n])*"
18
- return CodeReader.generate_tokens(
19
- source_code,
20
- r"|\#" + _until_end + addition,
21
- match_holder)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes