lizard 1.17.20__tar.gz → 1.17.21__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 (99) hide show
  1. {lizard-1.17.20 → lizard-1.17.21}/PKG-INFO +2 -1
  2. {lizard-1.17.20 → lizard-1.17.21}/README.rst +1 -0
  3. {lizard-1.17.20 → lizard-1.17.21}/lizard.egg-info/PKG-INFO +2 -1
  4. {lizard-1.17.20 → lizard-1.17.21}/lizard.egg-info/SOURCES.txt +1 -0
  5. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/version.py +1 -1
  6. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/__init__.py +2 -0
  7. lizard-1.17.21/lizard_languages/perl.py +103 -0
  8. {lizard-1.17.20 → lizard-1.17.21}/LICENSE.txt +0 -0
  9. {lizard-1.17.20 → lizard-1.17.21}/lizard.egg-info/dependency_links.txt +0 -0
  10. {lizard-1.17.20 → lizard-1.17.21}/lizard.egg-info/entry_points.txt +0 -0
  11. {lizard-1.17.20 → lizard-1.17.21}/lizard.egg-info/requires.txt +0 -0
  12. {lizard-1.17.20 → lizard-1.17.21}/lizard.egg-info/top_level.txt +0 -0
  13. {lizard-1.17.20 → lizard-1.17.21}/lizard.py +0 -0
  14. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/__init__.py +0 -0
  15. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/auto_open.py +0 -0
  16. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/csvoutput.py +0 -0
  17. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/default_ordered_dict.py +0 -0
  18. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/extension_base.py +0 -0
  19. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/htmloutput.py +0 -0
  20. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/keywords.py +0 -0
  21. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardboolcount.py +0 -0
  22. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardcomplextags.py +0 -0
  23. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardcpre.py +0 -0
  24. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizarddependencycount.py +0 -0
  25. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizarddumpcomments.py +0 -0
  26. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardduplicate.py +0 -0
  27. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardduplicated_param_list.py +0 -0
  28. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardexitcount.py +0 -0
  29. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardgotocount.py +0 -0
  30. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardignoreassert.py +0 -0
  31. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardio.py +0 -0
  32. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardmccabe.py +0 -0
  33. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardmodified.py +0 -0
  34. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardnd.py +0 -0
  35. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardnonstrict.py +0 -0
  36. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardns.py +0 -0
  37. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardoutside.py +0 -0
  38. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardstatementcount.py +0 -0
  39. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/lizardwordcount.py +0 -0
  40. {lizard-1.17.20 → lizard-1.17.21}/lizard_ext/xmloutput.py +0 -0
  41. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/clike.py +0 -0
  42. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/code_reader.py +0 -0
  43. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/csharp.py +0 -0
  44. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/erlang.py +0 -0
  45. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/fortran.py +0 -0
  46. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/gdscript.py +0 -0
  47. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/go.py +0 -0
  48. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/golike.py +0 -0
  49. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/java.py +0 -0
  50. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/javascript.py +0 -0
  51. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/js_style_language_states.py +0 -0
  52. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/js_style_regex_expression.py +0 -0
  53. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/jsx.py +0 -0
  54. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/kotlin.py +0 -0
  55. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/lua.py +0 -0
  56. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/objc.py +0 -0
  57. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/php.py +0 -0
  58. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/python.py +0 -0
  59. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/ruby.py +0 -0
  60. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/rubylike.py +0 -0
  61. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/rust.py +0 -0
  62. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/scala.py +0 -0
  63. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/script_language.py +0 -0
  64. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/solidity.py +0 -0
  65. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/swift.py +0 -0
  66. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/tnsdl.py +0 -0
  67. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/tsx.py +0 -0
  68. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/ttcn.py +0 -0
  69. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/typescript.py +0 -0
  70. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/vue.py +0 -0
  71. {lizard-1.17.20 → lizard-1.17.21}/lizard_languages/zig.py +0 -0
  72. {lizard-1.17.20 → lizard-1.17.21}/setup.cfg +0 -0
  73. {lizard-1.17.20 → lizard-1.17.21}/setup.py +0 -0
  74. {lizard-1.17.20 → lizard-1.17.21}/test/testApplication.py +0 -0
  75. {lizard-1.17.20 → lizard-1.17.21}/test/testAssertionExtension.py +0 -0
  76. {lizard-1.17.20 → lizard-1.17.21}/test/testBasicFunctionInfo.py +0 -0
  77. {lizard-1.17.20 → lizard-1.17.21}/test/testCOutsideComplexity.py +0 -0
  78. {lizard-1.17.20 → lizard-1.17.21}/test/testCPreprocessorExtension.py +0 -0
  79. {lizard-1.17.20 → lizard-1.17.21}/test/testCommentOptions.py +0 -0
  80. {lizard-1.17.20 → lizard-1.17.21}/test/testCyclomaticComplexity.py +0 -0
  81. {lizard-1.17.20 → lizard-1.17.21}/test/testExtension.py +0 -0
  82. {lizard-1.17.20 → lizard-1.17.21}/test/testFilesFilter.py +0 -0
  83. {lizard-1.17.20 → lizard-1.17.21}/test/testFunctionDependencyCount.py +0 -0
  84. {lizard-1.17.20 → lizard-1.17.21}/test/testFunctionExitCount.py +0 -0
  85. {lizard-1.17.20 → lizard-1.17.21}/test/testFunctionGotoCount.py +0 -0
  86. {lizard-1.17.20 → lizard-1.17.21}/test/testFunctionStatementCount.py +0 -0
  87. {lizard-1.17.20 → lizard-1.17.21}/test/testHelpers.py +0 -0
  88. {lizard-1.17.20 → lizard-1.17.21}/test/testLanguages.py +0 -0
  89. {lizard-1.17.20 → lizard-1.17.21}/test/testMcCabe.py +0 -0
  90. {lizard-1.17.20 → lizard-1.17.21}/test/testNestedStructures.py +0 -0
  91. {lizard-1.17.20 → lizard-1.17.21}/test/testNestingDepth.py +0 -0
  92. {lizard-1.17.20 → lizard-1.17.21}/test/testOutput.py +0 -0
  93. {lizard-1.17.20 → lizard-1.17.21}/test/testOutputCSV.py +0 -0
  94. {lizard-1.17.20 → lizard-1.17.21}/test/testOutputFile.py +0 -0
  95. {lizard-1.17.20 → lizard-1.17.21}/test/testOutputHTML.py +0 -0
  96. {lizard-1.17.20 → lizard-1.17.21}/test/testTokenizer.py +0 -0
  97. {lizard-1.17.20 → lizard-1.17.21}/test/test_analyzer.py +0 -0
  98. {lizard-1.17.20 → lizard-1.17.21}/test/test_auto_open.py +0 -0
  99. {lizard-1.17.20 → lizard-1.17.21}/test/test_options.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lizard
3
- Version: 1.17.20
3
+ Version: 1.17.21
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/
@@ -70,6 +70,7 @@ A list of supported languages:
70
70
  - Solidity
71
71
  - Erlang
72
72
  - Zig
73
+ - Perl
73
74
 
74
75
  By default lizard will search for any source code that it knows and mix
75
76
  all the results together. This might not be what you want. You can use
@@ -39,6 +39,7 @@ A list of supported languages:
39
39
  - Solidity
40
40
  - Erlang
41
41
  - Zig
42
+ - Perl
42
43
 
43
44
  By default lizard will search for any source code that it knows and mix
44
45
  all the results together. This might not be what you want. You can use
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lizard
3
- Version: 1.17.20
3
+ Version: 1.17.21
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/
@@ -70,6 +70,7 @@ A list of supported languages:
70
70
  - Solidity
71
71
  - Erlang
72
72
  - Zig
73
+ - Perl
73
74
 
74
75
  By default lizard will search for any source code that it knows and mix
75
76
  all the results together. This might not be what you want. You can use
@@ -54,6 +54,7 @@ lizard_languages/jsx.py
54
54
  lizard_languages/kotlin.py
55
55
  lizard_languages/lua.py
56
56
  lizard_languages/objc.py
57
+ lizard_languages/perl.py
57
58
  lizard_languages/php.py
58
59
  lizard_languages/python.py
59
60
  lizard_languages/ruby.py
@@ -3,4 +3,4 @@
3
3
  #
4
4
  # pylint: disable=missing-docstring,invalid-name
5
5
 
6
- version = "1.17.20"
6
+ version = "1.17.21"
@@ -24,6 +24,7 @@ from .solidity import SolidityReader
24
24
  from .jsx import JSXReader
25
25
  from .tsx import TSXReader
26
26
  from .vue import VueReader
27
+ from .perl import PerlReader
27
28
 
28
29
 
29
30
  def languages():
@@ -52,6 +53,7 @@ def languages():
52
53
  JSXReader,
53
54
  TSXReader,
54
55
  VueReader,
56
+ PerlReader,
55
57
  ]
56
58
 
57
59
 
@@ -0,0 +1,103 @@
1
+ '''
2
+ Language parser for Perl
3
+ '''
4
+
5
+ from .code_reader import CodeReader, CodeStateMachine
6
+ from .script_language import ScriptLanguageMixIn
7
+
8
+
9
+ class PerlCommentsMixin(object):
10
+ @staticmethod
11
+ def get_comment_from_token(token):
12
+ if token.startswith('#'):
13
+ return token # Return the entire comment including #
14
+ return None
15
+
16
+
17
+ class PerlReader(CodeReader, ScriptLanguageMixIn):
18
+ # pylint: disable=R0903
19
+
20
+ ext = ['pl', 'pm']
21
+ language_names = ['perl']
22
+ _conditions = set(['if', 'elsif', 'unless', 'while', 'until', 'for', 'foreach', '&&', '||', '?', 'when'])
23
+
24
+ def __init__(self, context):
25
+ super(PerlReader, self).__init__(context)
26
+ self.parallel_states = [PerlStates(context)]
27
+
28
+ def preprocess(self, tokens):
29
+ comment = None
30
+ for token in tokens:
31
+ if comment is not None:
32
+ if token == '\n':
33
+ yield comment
34
+ comment = None
35
+ yield token
36
+ else:
37
+ comment += token
38
+ elif token == '#':
39
+ comment = token
40
+ else:
41
+ yield token
42
+ if comment is not None:
43
+ yield comment
44
+
45
+ def _state(self, token):
46
+ current_state = self.parallel_states[-1]
47
+ if token == '\n':
48
+ return
49
+ return current_state.state(token)
50
+
51
+ @staticmethod
52
+ def get_comment_from_token(token):
53
+ if token.startswith('#'):
54
+ # For forgiveness comments, return the entire comment
55
+ stripped = token.lstrip('#').strip()
56
+ if stripped.startswith('lizard forgives') or stripped.startswith('#lizard forgives'):
57
+ return '#lizard forgives' # Return standardized forgiveness comment
58
+ return stripped # Return the stripped comment for other cases
59
+ return None
60
+
61
+ @staticmethod
62
+ def generate_tokens(source_code, addition='', token_class=None):
63
+ return ScriptLanguageMixIn.generate_common_tokens(source_code, addition, token_class)
64
+
65
+
66
+ class PerlStates(CodeStateMachine):
67
+ _conditions = set(['if', 'elsif', 'unless', 'while', 'until', 'for', 'foreach'])
68
+
69
+ def __init__(self, context):
70
+ super(PerlStates, self).__init__(context)
71
+ self.function_name = ''
72
+ self.brace_count = 0
73
+ self._state = self._state_global
74
+
75
+ def _state_global(self, token):
76
+ if token == 'sub':
77
+ self.function_name = ''
78
+ self.next(self._state_function_dec)
79
+ elif token == '{':
80
+ self.brace_count += 1
81
+ elif token == '}':
82
+ self.brace_count -= 1
83
+
84
+ def _state_function_dec(self, token):
85
+ if token == '{':
86
+ self.brace_count = 1
87
+ if self.function_name:
88
+ self.context.try_new_function(self.function_name)
89
+ self.context.confirm_new_function()
90
+ self.next(self._state_function_body)
91
+ elif token == ';':
92
+ self.next(self._state_global)
93
+ elif not token.isspace():
94
+ self.function_name = token
95
+
96
+ def _state_function_body(self, token):
97
+ if token == '{':
98
+ self.brace_count += 1
99
+ elif token == '}':
100
+ self.brace_count -= 1
101
+ if self.brace_count == 0:
102
+ self.context.end_of_function()
103
+ self.next(self._state_global)
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