lizard 1.22.0__tar.gz → 1.22.2__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.
- {lizard-1.22.0 → lizard-1.22.2}/PKG-INFO +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard.egg-info/PKG-INFO +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardduplicate.py +33 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/version.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/erlang.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/gdscript.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/kotlin.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/perl.py +2 -2
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/php.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/python.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/rubylike.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/rust.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/scala.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/solidity.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/swift.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/typescript.py +7 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/zig.py +1 -1
- {lizard-1.22.0 → lizard-1.22.2}/LICENSE.txt +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/README.rst +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard.egg-info/SOURCES.txt +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard.egg-info/dependency_links.txt +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard.egg-info/entry_points.txt +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard.egg-info/requires.txt +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard.egg-info/top_level.txt +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/__init__.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/auto_open.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/checkstyleoutput.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/csvoutput.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/default_ordered_dict.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/extension_base.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/htmloutput.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/keywords.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardboolcount.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardcomplextags.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardcpre.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizarddependencycount.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizarddumpcomments.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardduplicated_param_list.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardexitcount.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardgotocount.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardignoreassert.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardio.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardmccabe.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardmodified.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardnd.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardnonstrict.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardns.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardoutside.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardstatementcount.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/lizardwordcount.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_ext/xmloutput.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/__init__.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/clike.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/code_reader.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/csharp.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/fortran.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/go.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/golike.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/java.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/javascript.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/js_style_regex_expression.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/lua.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/objc.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/plsql.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/r.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/ruby.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/script_language.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/st.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/tnsdl.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/tsx.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/ttcn.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/lizard_languages/vue.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/setup.cfg +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/setup.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testApplication.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testAssertionExtension.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testBasicFunctionInfo.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testCOutsideComplexity.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testCPreprocessorExtension.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testCommentOptions.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testCyclomaticComplexity.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testExtension.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testFilesFilter.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testFunctionDependencyCount.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testFunctionExitCount.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testFunctionGotoCount.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testFunctionStatementCount.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testHelpers.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testLanguages.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testMcCabe.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testNestedStructures.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testNestingDepth.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testOutput.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testOutputCSV.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testOutputFile.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testOutputHTML.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/testTokenizer.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/test_analyzer.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/test_auto_open.py +0 -0
- {lizard-1.22.0 → lizard-1.22.2}/test/test_options.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lizard
|
|
3
|
-
Version: 1.22.
|
|
3
|
+
Version: 1.22.2
|
|
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.4
|
|
2
2
|
Name: lizard
|
|
3
|
-
Version: 1.22.
|
|
3
|
+
Version: 1.22.2
|
|
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/
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Get Duplicated parameter lists
|
|
3
3
|
'''
|
|
4
4
|
from __future__ import print_function
|
|
5
|
+
from bisect import bisect_right
|
|
5
6
|
from collections import deque
|
|
6
7
|
from itertools import groupby
|
|
7
8
|
from .default_ordered_dict import DefaultOrderedDict
|
|
@@ -98,6 +99,8 @@ class DuplicateFinder(object):
|
|
|
98
99
|
self.duplicate_token_count = 0
|
|
99
100
|
self.nodes = nodes
|
|
100
101
|
self.boundaries = set(boundaries + [len(nodes)])
|
|
102
|
+
self.sorted_boundaries = sorted(self.boundaries)
|
|
103
|
+
self.covered_duplicates = DefaultOrderedDict(list)
|
|
101
104
|
self.hashed_node_indice = DefaultOrderedDict(list)
|
|
102
105
|
for i, node_hash in enumerate(n.hash for n in nodes):
|
|
103
106
|
if i in self.boundaries:
|
|
@@ -117,8 +120,37 @@ class DuplicateFinder(object):
|
|
|
117
120
|
token_count = len(dup) * \
|
|
118
121
|
(dup[0][1] - dup[0][0] + self.sample_size)
|
|
119
122
|
if token_count >= self.min_duplicate_tokens:
|
|
120
|
-
self.
|
|
123
|
+
self._add_duplicate_ranges(dup)
|
|
121
124
|
yield dup
|
|
125
|
+
self.duplicate_token_count = sum(
|
|
126
|
+
self._merged_token_count(intervals)
|
|
127
|
+
for intervals in self.covered_duplicates.values())
|
|
128
|
+
|
|
129
|
+
def _add_duplicate_ranges(self, dup):
|
|
130
|
+
for start, end in dup:
|
|
131
|
+
boundary_index = self._boundary_index(start)
|
|
132
|
+
boundary_start = self.sorted_boundaries[boundary_index]
|
|
133
|
+
self.covered_duplicates[boundary_index].append(
|
|
134
|
+
(start - boundary_start,
|
|
135
|
+
end - boundary_start + self.sample_size))
|
|
136
|
+
|
|
137
|
+
def _boundary_index(self, index):
|
|
138
|
+
return bisect_right(self.sorted_boundaries, index) - 1
|
|
139
|
+
|
|
140
|
+
@staticmethod
|
|
141
|
+
def _merged_token_count(intervals):
|
|
142
|
+
if not intervals:
|
|
143
|
+
return 0
|
|
144
|
+
intervals = sorted(intervals)
|
|
145
|
+
start, end = intervals[0]
|
|
146
|
+
token_count = 0
|
|
147
|
+
for current_start, current_end in intervals[1:]:
|
|
148
|
+
if current_start <= end:
|
|
149
|
+
end = max(end, current_end)
|
|
150
|
+
else:
|
|
151
|
+
token_count += end - start
|
|
152
|
+
start, end = current_start, current_end
|
|
153
|
+
return token_count + end - start
|
|
122
154
|
|
|
123
155
|
def duplicate_rate(self):
|
|
124
156
|
try:
|
|
@@ -13,7 +13,7 @@ class ErlangReader(CodeReader):
|
|
|
13
13
|
|
|
14
14
|
ext = ['erl', 'hrl', 'es', 'escript']
|
|
15
15
|
language_names = ['erlang']
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
# Separated condition categories
|
|
18
18
|
_control_flow_keywords = {'if', 'catch', 'when'} # when is used in guards
|
|
19
19
|
_logical_operators = {'and', 'or', 'not'}
|
|
@@ -13,7 +13,7 @@ class KotlinReader(CodeReader, CCppCommentsMixin, SwiftReplaceLabel):
|
|
|
13
13
|
|
|
14
14
|
ext = ['kt', 'kts']
|
|
15
15
|
language_names = ['kotlin']
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
# Separated condition categories
|
|
18
18
|
_control_flow_keywords = {'if', 'for', 'while', 'catch'}
|
|
19
19
|
_logical_operators = {'&&', '||'}
|
|
@@ -19,9 +19,9 @@ class PerlReader(CodeReader, ScriptLanguageMixIn):
|
|
|
19
19
|
|
|
20
20
|
ext = ['pl', 'pm']
|
|
21
21
|
language_names = ['perl']
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
# Separated condition categories
|
|
24
|
-
_control_flow_keywords = {'if', 'elsif', 'unless', 'while', 'until', 'for',
|
|
24
|
+
_control_flow_keywords = {'if', 'elsif', 'unless', 'while', 'until', 'for',
|
|
25
25
|
'foreach', 'when', 'given', 'default', 'do'}
|
|
26
26
|
_logical_operators = {'&&', '||'} # Perl also has 'and', 'or' with different precedence
|
|
27
27
|
_case_keywords = set()
|
|
@@ -242,7 +242,7 @@ class PHPReader(CodeReader, CCppCommentsMixin):
|
|
|
242
242
|
|
|
243
243
|
ext = ['php']
|
|
244
244
|
language_names = ['php']
|
|
245
|
-
|
|
245
|
+
|
|
246
246
|
# Separated condition categories
|
|
247
247
|
_control_flow_keywords = {'if', 'elseif', 'for', 'foreach', 'while', 'catch', 'match'}
|
|
248
248
|
_logical_operators = {'&&', '||'} # PHP also has 'and', 'or' with different precedence
|
|
@@ -29,7 +29,7 @@ class PythonReader(CodeReader, ScriptLanguageMixIn):
|
|
|
29
29
|
|
|
30
30
|
ext = ['py']
|
|
31
31
|
language_names = ['python']
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
# Separated condition categories
|
|
34
34
|
_control_flow_keywords = {'if', 'elif', 'for', 'while', 'except', 'finally'}
|
|
35
35
|
_logical_operators = {'and', 'or'}
|
|
@@ -98,7 +98,7 @@ class RubylikeReader(CodeReader, ScriptLanguageMixIn):
|
|
|
98
98
|
# pylint: disable=R0903
|
|
99
99
|
|
|
100
100
|
# Separated condition categories
|
|
101
|
-
_control_flow_keywords = {'if', 'elsif', 'elseif', 'until', 'for', 'while',
|
|
101
|
+
_control_flow_keywords = {'if', 'elsif', 'elseif', 'until', 'for', 'while',
|
|
102
102
|
'rescue', 'ensure', 'when'}
|
|
103
103
|
_logical_operators = {'and', 'or', '||', '&&'} # Both word and symbol forms
|
|
104
104
|
_case_keywords = set() # Ruby uses 'when' for case expressions
|
|
@@ -30,7 +30,7 @@ class SwiftReader(CodeReader, CCppCommentsMixin, SwiftReplaceLabel):
|
|
|
30
30
|
FUNC_KEYWORD = 'def'
|
|
31
31
|
ext = ['swift']
|
|
32
32
|
language_names = ['swift']
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
# Separated condition categories
|
|
35
35
|
_control_flow_keywords = {'if', 'for', 'while', 'catch', 'guard'}
|
|
36
36
|
_logical_operators = {'&&', '||'}
|
|
@@ -98,6 +98,11 @@ class TypeScriptReader(CodeReader, CCppCommentsMixin):
|
|
|
98
98
|
elif content[i] == '}':
|
|
99
99
|
brace_count -= 1
|
|
100
100
|
i += 1
|
|
101
|
+
|
|
102
|
+
if brace_count > 0:
|
|
103
|
+
yield token
|
|
104
|
+
return
|
|
105
|
+
|
|
101
106
|
expr = content[expr_start:i - 1]
|
|
102
107
|
yield expr
|
|
103
108
|
yield '}'
|
|
@@ -334,6 +339,8 @@ class TypeScriptStates(CodeStateMachine):
|
|
|
334
339
|
self._prev_token = token
|
|
335
340
|
return
|
|
336
341
|
if token == 'function':
|
|
342
|
+
if self.started_function and not self.as_object:
|
|
343
|
+
self._pop_function_from_stack()
|
|
337
344
|
self._state = self._function
|
|
338
345
|
elif token in ('if', 'switch', 'for', 'while', 'catch'):
|
|
339
346
|
self.next(self._expecting_condition_and_statement_block)
|
|
@@ -12,7 +12,7 @@ from .golike import GoLikeStates
|
|
|
12
12
|
class ZigReader(CodeReader, CCppCommentsMixin):
|
|
13
13
|
ext = ["zig"]
|
|
14
14
|
language_names = ["zig"]
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
# Separated condition categories
|
|
17
17
|
_control_flow_keywords = {"if", "for", "while", "try", "catch"}
|
|
18
18
|
_logical_operators = {"and", "or", "orelse"} # orelse is Zig's null coalescing
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|