lizard 1.17.9__tar.gz → 1.17.12__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 (95) hide show
  1. lizard-1.17.12/LICENSE.txt +30 -0
  2. lizard-1.17.12/PKG-INFO +389 -0
  3. {lizard-1.17.9 → lizard-1.17.12}/README.rst +5 -2
  4. lizard-1.17.12/lizard.egg-info/PKG-INFO +389 -0
  5. {lizard-1.17.9 → lizard-1.17.12}/lizard.egg-info/SOURCES.txt +4 -0
  6. {lizard-1.17.9 → lizard-1.17.12}/lizard.py +19 -10
  7. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/version.py +1 -1
  8. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/__init__.py +7 -1
  9. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/clike.py +2 -1
  10. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/code_reader.py +22 -3
  11. lizard-1.17.12/lizard_languages/erlang.py +112 -0
  12. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/fortran.py +4 -3
  13. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/golike.py +28 -2
  14. lizard-1.17.12/lizard_languages/kotlin.py +92 -0
  15. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/python.py +10 -1
  16. lizard-1.17.12/lizard_languages/solidity.py +22 -0
  17. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/swift.py +18 -15
  18. {lizard-1.17.9 → lizard-1.17.12}/setup.py +7 -4
  19. {lizard-1.17.9 → lizard-1.17.12}/test/testLanguages.py +8 -1
  20. {lizard-1.17.9 → lizard-1.17.12}/test/testOutput.py +2 -2
  21. {lizard-1.17.9 → lizard-1.17.12}/test/testOutputCSV.py +6 -6
  22. {lizard-1.17.9 → lizard-1.17.12}/test/testOutputHTML.py +1 -2
  23. lizard-1.17.9/PKG-INFO +0 -382
  24. lizard-1.17.9/lizard.egg-info/PKG-INFO +0 -382
  25. {lizard-1.17.9 → lizard-1.17.12}/lizard.egg-info/dependency_links.txt +0 -0
  26. {lizard-1.17.9 → lizard-1.17.12}/lizard.egg-info/entry_points.txt +0 -0
  27. {lizard-1.17.9 → lizard-1.17.12}/lizard.egg-info/top_level.txt +0 -0
  28. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/__init__.py +0 -0
  29. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/auto_open.py +0 -0
  30. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/csvoutput.py +0 -0
  31. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/default_ordered_dict.py +0 -0
  32. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/extension_base.py +0 -0
  33. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/htmloutput.py +0 -0
  34. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/keywords.py +0 -0
  35. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardboolcount.py +0 -0
  36. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardcomplextags.py +0 -0
  37. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardcpre.py +0 -0
  38. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizarddependencycount.py +0 -0
  39. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizarddumpcomments.py +0 -0
  40. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardduplicate.py +0 -0
  41. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardduplicated_param_list.py +0 -0
  42. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardexitcount.py +0 -0
  43. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardgotocount.py +0 -0
  44. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardignoreassert.py +0 -0
  45. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardio.py +0 -0
  46. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardmccabe.py +0 -0
  47. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardmodified.py +0 -0
  48. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardnd.py +0 -0
  49. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardnonstrict.py +0 -0
  50. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardns.py +0 -0
  51. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardoutside.py +0 -0
  52. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardstatementcount.py +0 -0
  53. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/lizardwordcount.py +0 -0
  54. {lizard-1.17.9 → lizard-1.17.12}/lizard_ext/xmloutput.py +0 -0
  55. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/csharp.py +0 -0
  56. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/gdscript.py +0 -0
  57. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/go.py +0 -0
  58. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/java.py +0 -0
  59. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/javascript.py +0 -0
  60. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/js_style_language_states.py +0 -0
  61. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/js_style_regex_expression.py +0 -0
  62. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/lua.py +0 -0
  63. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/objc.py +0 -0
  64. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/php.py +0 -0
  65. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/ruby.py +0 -0
  66. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/rubylike.py +0 -0
  67. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/rust.py +0 -0
  68. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/scala.py +0 -0
  69. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/script_language.py +0 -0
  70. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/tnsdl.py +0 -0
  71. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/ttcn.py +0 -0
  72. {lizard-1.17.9 → lizard-1.17.12}/lizard_languages/typescript.py +0 -0
  73. {lizard-1.17.9 → lizard-1.17.12}/setup.cfg +0 -0
  74. {lizard-1.17.9 → lizard-1.17.12}/test/testApplication.py +0 -0
  75. {lizard-1.17.9 → lizard-1.17.12}/test/testAssertionExtension.py +0 -0
  76. {lizard-1.17.9 → lizard-1.17.12}/test/testBasicFunctionInfo.py +0 -0
  77. {lizard-1.17.9 → lizard-1.17.12}/test/testCOutsideComplexity.py +0 -0
  78. {lizard-1.17.9 → lizard-1.17.12}/test/testCPreprocessorExtension.py +0 -0
  79. {lizard-1.17.9 → lizard-1.17.12}/test/testCommentOptions.py +0 -0
  80. {lizard-1.17.9 → lizard-1.17.12}/test/testCyclomaticComplexity.py +0 -0
  81. {lizard-1.17.9 → lizard-1.17.12}/test/testExtension.py +0 -0
  82. {lizard-1.17.9 → lizard-1.17.12}/test/testFilesFilter.py +0 -0
  83. {lizard-1.17.9 → lizard-1.17.12}/test/testFunctionDependencyCount.py +0 -0
  84. {lizard-1.17.9 → lizard-1.17.12}/test/testFunctionExitCount.py +0 -0
  85. {lizard-1.17.9 → lizard-1.17.12}/test/testFunctionGotoCount.py +0 -0
  86. {lizard-1.17.9 → lizard-1.17.12}/test/testFunctionStatementCount.py +0 -0
  87. {lizard-1.17.9 → lizard-1.17.12}/test/testHelpers.py +0 -0
  88. {lizard-1.17.9 → lizard-1.17.12}/test/testMcCabe.py +0 -0
  89. {lizard-1.17.9 → lizard-1.17.12}/test/testNestedStructures.py +0 -0
  90. {lizard-1.17.9 → lizard-1.17.12}/test/testNestingDepth.py +0 -0
  91. {lizard-1.17.9 → lizard-1.17.12}/test/testOutputFile.py +0 -0
  92. {lizard-1.17.9 → lizard-1.17.12}/test/testTokenizer.py +0 -0
  93. {lizard-1.17.9 → lizard-1.17.12}/test/test_analyzer.py +0 -0
  94. {lizard-1.17.9 → lizard-1.17.12}/test/test_auto_open.py +0 -0
  95. {lizard-1.17.9 → lizard-1.17.12}/test/test_options.py +0 -0
@@ -0,0 +1,30 @@
1
+ Copyright Terry Yin and other contributors
2
+
3
+ This software consists of voluntary contributions made by many
4
+ individuals. For exact contribution history, see the revision history.
5
+
6
+ The following license applies to all parts of this software except as
7
+ documented below:
8
+
9
+ ====
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining
12
+ a copy of this software and associated documentation files (the
13
+ "Software"), to deal in the Software without restriction, including
14
+ without limitation the rights to use, copy, modify, merge, publish,
15
+ distribute, sublicense, and/or sell copies of the Software, and to
16
+ permit persons to whom the Software is furnished to do so, subject to
17
+ the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be
20
+ included in all copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
+
30
+ ====
@@ -0,0 +1,389 @@
1
+ Metadata-Version: 2.1
2
+ Name: lizard
3
+ Version: 1.17.12
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
+ Home-page: http://www.lizard.ws
6
+ Download-URL: https://pypi.python.org/lizard/
7
+ Author: Terry Yin
8
+ Author-email: terry@odd-e.com
9
+ License: MIT
10
+ Project-URL: Source, https://github.com/terryyin/lizard
11
+ Platform: any
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: License :: Freeware
16
+ Classifier: Operating System :: POSIX
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Operating System :: MacOS :: MacOS X
19
+ Classifier: Topic :: Software Development :: Quality Assurance
20
+ Classifier: Programming Language :: C
21
+ Classifier: Programming Language :: C++
22
+ Classifier: Programming Language :: Java
23
+ Classifier: Programming Language :: JavaScript
24
+ Classifier: Programming Language :: Objective C
25
+ Classifier: Programming Language :: Python
26
+ Classifier: Programming Language :: Python :: 3.8
27
+ Classifier: Programming Language :: Python :: 3.9
28
+ Classifier: Programming Language :: Python :: 3.10
29
+ Classifier: Programming Language :: Python :: 3.11
30
+ License-File: LICENSE.txt
31
+
32
+ |Web Site| Lizard
33
+ =================
34
+
35
+ .. image:: https://travis-ci.org/terryyin/lizard.png?branch=master
36
+ :target: https://travis-ci.org/terryyin/lizard
37
+ .. image:: https://badge.fury.io/py/lizard.svg
38
+ :target: https://badge.fury.io/py/lizard
39
+ .. |Web Site| image:: http://www.lizard.ws/website/static/img/logo-small.png
40
+ :target: http://www.lizard.ws
41
+
42
+ |
43
+
44
+ Lizard is an extensible Cyclomatic Complexity Analyzer for many programming languages
45
+ including C/C++ (doesn't require all the header files or Java imports). It also does
46
+ copy-paste detection (code clone detection/code duplicate detection) and many other forms of static
47
+ code analysis.
48
+
49
+ A list of supported languages:
50
+
51
+ - C/C++ (works with C++14)
52
+ - Java
53
+ - C# (C Sharp)
54
+ - JavaScript (With ES6 and JSX)
55
+ - TypeScript
56
+ - Objective-C
57
+ - Swift
58
+ - Python
59
+ - Ruby
60
+ - TTCN-3
61
+ - PHP
62
+ - Scala
63
+ - GDScript
64
+ - Golang
65
+ - Lua
66
+ - Rust
67
+ - Fortran
68
+ - Kotlin
69
+ - Solidity
70
+ - Erlang
71
+
72
+ By default lizard will search for any source code that it knows and mix
73
+ all the results together. This might not be what you want. You can use
74
+ the "-l" option to select language(s).
75
+
76
+ It counts
77
+
78
+ - the nloc (lines of code without comments),
79
+ - CCN (cyclomatic complexity number),
80
+ - token count of functions.
81
+ - parameter count of functions.
82
+
83
+ You can set limitation for CCN (-C), the number of parameters (-a).
84
+ Functions that exceed these limitations will generate warnings. The exit
85
+ code of lizard will be none-Zero if there are warnings.
86
+
87
+ This tool actually calculates how complex the code 'looks' rather than
88
+ how complex the code really 'is'. People will need this tool because it's
89
+ often very hard to get all the included folders and files right when
90
+ they are complicated. But we don't really need that kind of accuracy for
91
+ cyclomatic complexity.
92
+
93
+ It requires python3.8 or above (early versions are not verified).
94
+
95
+ Installation
96
+ ------------
97
+
98
+ lizard.py can be used as a stand alone Python script, most
99
+ functionalities are there. You can always use it without any
100
+ installation. To acquire all the functionalities of lizard, you will
101
+ need a proper install.
102
+
103
+ ::
104
+
105
+ python lizard.py
106
+
107
+ If you want a proper install:
108
+
109
+ ::
110
+
111
+ [sudo] pip install lizard
112
+
113
+ Or if you've got the source:
114
+
115
+ ::
116
+
117
+ [sudo] python setup.py install --prefix=/path/to/installation/directory/
118
+
119
+ Usage
120
+ -----
121
+
122
+ ::
123
+
124
+ lizard [options] [PATH or FILE] [PATH] ...
125
+
126
+ Run for the code under current folder (recursively):
127
+
128
+ ::
129
+
130
+ lizard
131
+
132
+ Exclude anything in the tests folder:
133
+
134
+ ::
135
+
136
+ lizard mySource/ -x"./tests/*"
137
+
138
+
139
+ Options
140
+ ~~~~~~~
141
+
142
+ ::
143
+
144
+ -h, --help show this help message and exit
145
+ --version show program's version number and exit
146
+ -l LANGUAGES, --languages LANGUAGES
147
+ List the programming languages you want to analyze. if left empty, it'll
148
+ search for all languages it knows. `lizard -l cpp -l java`searches for
149
+ C++ and Java code. The available languages are: cpp, java, csharp,
150
+ javascript, python, objectivec, ttcn, ruby, php, swift, scala, GDScript,
151
+ go, lua, rust, typescript
152
+ -V, --verbose Output in verbose mode (long function name)
153
+ -C CCN, --CCN CCN Threshold for cyclomatic complexity number warning. The default value is
154
+ 15. Functions with CCN bigger than it will generate warning
155
+ -f INPUT_FILE, --input_file INPUT_FILE
156
+ get a list of filenames from the given file
157
+ -o OUTPUT_FILE, --output_file OUTPUT_FILE
158
+ Output file. The output format is inferred from the file extension (e.g.
159
+ .html), unless it is explicitly specified (e.g. using --xml).
160
+ -L LENGTH, --length LENGTH
161
+ Threshold for maximum function length warning. The default value is 1000.
162
+ Functions length bigger than it will generate warning
163
+ -a ARGUMENTS, --arguments ARGUMENTS
164
+ Limit for number of parameters
165
+ -w, --warnings_only Show warnings only, using clang/gcc's warning format for printing
166
+ warnings. http://clang.llvm.org/docs/UsersManual.html#cmdoption-
167
+ fdiagnostics-format
168
+ --warning-msvs Show warnings only, using Visual Studio's warning format for printing
169
+ warnings. https://msdn.microsoft.com/en-us/library/yxkt8b26.aspx
170
+ -i NUMBER, --ignore_warnings NUMBER
171
+ If the number of warnings is equal or less than the number, the tool will
172
+ exit normally; otherwise, it will generate error. If the number is
173
+ negative, the tool exits normally regardless of the number of warnings.
174
+ Useful in makefile for legacy code.
175
+ -x EXCLUDE, --exclude EXCLUDE
176
+ Exclude files that match the pattern. * matches everything, ? matches any
177
+ single character, "./folder/*" exclude everything in the folder
178
+ recursively. Multiple patterns can be specified. Don't forget to add ""
179
+ around the pattern.
180
+ -t WORKING_THREADS, --working_threads WORKING_THREADS
181
+ number of working threads. The default value is 1. Using a bigger number
182
+ can fully utilize the CPU and often faster.
183
+ -X, --xml Generate XML in cppncss style instead of the tabular output. Useful to
184
+ generate report in Jenkins server
185
+ --csv Generate CSV output as a transform of the default output
186
+ -H, --html Output HTML report
187
+ -m, --modified Calculate modified cyclomatic complexity number , which count a
188
+ switch/case with multiple cases as one CCN.
189
+ -E EXTENSIONS, --extension EXTENSIONS
190
+ User the extensions. The available extensions are: -Ecpre: it will ignore
191
+ code in the #else branch. -Ewordcount: count word frequencies and
192
+ generate tag cloud. -Eoutside: include the global code as one function.
193
+ -EIgnoreAssert: to ignore all code in assert. -ENS: count nested control
194
+ structures.
195
+ -s SORTING, --sort SORTING
196
+ Sort the warning with field. The field can be nloc,
197
+ cyclomatic_complexity, token_count, parameter_count, etc. Or an customized field.
198
+ -T THRESHOLDS, --Threshold THRESHOLDS
199
+ Set the limit for a field. The field can be nloc, cyclomatic_complexity,
200
+ token_count, parameter_count, etc. Or an customized file. Lizard will
201
+ report warning if a function exceed the limit
202
+ -W WHITELIST, --whitelist WHITELIST
203
+ The path and file name to the whitelist file. It's './whitelizard.txt' by
204
+ default. Find more information in README.
205
+
206
+
207
+ Example use
208
+ -----------
209
+
210
+ Analyze a folder recursively: lizard mahjong\_game/src
211
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212
+
213
+ ::
214
+
215
+ ==============================================================
216
+ NLOC CCN token param function@line@file
217
+ --------------------------------------------------------------
218
+ 10 2 29 2 start_new_player@26@./html_game.c
219
+ ...
220
+ 6 1 3 0 set_shutdown_flag@449@./httpd.c
221
+ 24 3 61 1 server_main@454@./httpd.c
222
+ --------------------------------------------------------------
223
+ 2 file analyzed.
224
+ ==============================================================
225
+ LOC Avg.NLOC AvgCCN Avg.ttoken function_cnt file
226
+ --------------------------------------------------------------
227
+ 191 15 3 51 12 ./html_game.c
228
+ 363 24 4 86 15 ./httpd.c
229
+
230
+ ======================================
231
+ !!!! Warnings (CCN > 15) !!!!
232
+ ======================================
233
+ 66 19 247 1 accept_request@64@./httpd.c
234
+ =================================================================================
235
+ Total NLOC Avg.NLOC Avg CCN Avg token Fun Cnt Warning cnt Fun Rt NLOC Rt
236
+ --------------------------------------------------------------------------------
237
+ 554 20 4.07 71.15 27 1 0.04 0.12
238
+
239
+ Warnings only (in clang/gcc formation):lizard -w mahjong\_game
240
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
241
+
242
+ ::
243
+
244
+ ./src/html_ui/httpd.c:64: warning: accept_request has 19 CCN and 1 params (66 NLOC, 247 tokens)
245
+ ./src/mahjong_game/mj_table.c:109: warning: mj_table_update_state has 20 CCN and 1 params (72 NLOC, 255 tokens)
246
+
247
+
248
+ Set warning threshold for any field:lizard -T nloc=25
249
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250
+
251
+ The option `-Tcyclomatic_complexity=10` is equal to `-C10`.
252
+ The option `-Tlength=10` is equal to `-L10`.
253
+ The option `-Tparameter_count=10` is equal to `-a10`.
254
+
255
+ You can also do `-Tnloc=10` to set the limit of the NLOC. Any function that
256
+ has NLOC greater than 10 will generate a warning.
257
+
258
+ Generated code
259
+ -----------------------------
260
+
261
+ Lizard has a simple solution with generated code. Any code in a source file that is following
262
+ a comment containing "GENERATED CODE" will be ignored completely. The ignored code will not
263
+ generate any data, except the file counting.
264
+
265
+
266
+ Code Duplicate Detector
267
+ -----------------------------
268
+
269
+ ::
270
+
271
+ lizard -Eduplicate <path to your code>
272
+
273
+
274
+ Generate A Tag Cloud For Your Code
275
+ ----------------------------------
276
+
277
+ You can generate a "Tag cloud" of your code by the following command. It counts the identifiers in your code (ignoring the comments).
278
+
279
+ ::
280
+
281
+ lizard -EWordCount <path to your code>
282
+
283
+
284
+ Using lizard as Python module
285
+ -----------------------------
286
+
287
+ You can also use lizard as a Python module in your code:
288
+
289
+ .. code:: python
290
+
291
+ >>> import lizard
292
+ >>> i = lizard.analyze_file("../cpputest/tests/AllTests.cpp")
293
+ >>> print i.__dict__
294
+ {'nloc': 9, 'function_list': [<lizard.FunctionInfo object at 0x10bf7af10>], 'filename': '../cpputest/tests/AllTests.cpp'}
295
+ >>> print i.function_list[0].__dict__
296
+ {'cyclomatic_complexity': 1, 'token_count': 22, 'name': 'main', 'parameter_count': 2, 'nloc': 3, 'long_name': 'main( int ac , const char ** av )', 'start_line': 30}
297
+
298
+ You can also use source code string instead of file. But you need to
299
+ provide a file name (to identify the language).
300
+
301
+ .. code:: python
302
+
303
+ >>> i = lizard.analyze_file.analyze_source_code("AllTests.cpp", "int foo(){}")
304
+
305
+ Whitelist
306
+ ---------
307
+
308
+ If for some reason you would like to ignore the warnings, you can use
309
+ the whitelist. Add 'whitelizard.txt' to the current folder (or use -W to point to the whitelist file), then the
310
+ functions defined in the file will be ignored. Please notice that if you assign the file pathname, it needs to
311
+ be exactly the same relative path as Lizard to find the file. An easy way to get the file pathname is to copy it from
312
+ the Lizard warning output.
313
+ This is an example whitelist:
314
+
315
+ ::
316
+
317
+ #whitelizard.txt
318
+ #The file name can only be whitelizard.txt and put it in the current folder.
319
+ #You may have commented lines begin with #.
320
+ function_name1, function_name2 # list function names in multiple lines or split with comma.
321
+ file/path/name:function1, function2 # you can also specify the filename
322
+
323
+ Options in Comments
324
+ -------------------
325
+
326
+ You can use options in the comments of the source code to change the
327
+ behavior of lizard. By putting "#lizard forgives" inside a function or
328
+ before a function it will suppress the warning for that function.
329
+
330
+ ::
331
+
332
+ int foo() {
333
+ // #lizard forgives the complexity
334
+ ...
335
+ }
336
+
337
+
338
+ Limitations
339
+ -----------
340
+
341
+ Lizard requires syntactically correct code.
342
+ Upon processing input with incorrect or unknown syntax:
343
+
344
+ - Lizard guarantees to terminate eventually (i.e., no forever loops, hangs)
345
+ without hard failures (e.g., exit, crash, exceptions).
346
+
347
+ - There is a chance of a combination of the following soft failures:
348
+
349
+ - omission
350
+ - misinterpretation
351
+ - improper analysis / tally
352
+ - success (the code under consideration is not relevant, e.g., global macros in C)
353
+
354
+ This approach makes the Lizard implementation
355
+ simpler and more focused with partial parsers for various languages.
356
+ Developers of Lizard attempt to minimize the possibility of soft failures.
357
+ Hard failures are bugs in Lizard code,
358
+ while soft failures are trade-offs or potential bugs.
359
+
360
+ In addition to asserting the correct code,
361
+ Lizard may choose not to deal with some advanced or complicated language features:
362
+
363
+ - C/C++ digraphs and trigraphs are not recognized.
364
+ - C/C++ preprocessing or macro expansion is not performed.
365
+ For example, using macro instead of parentheses (or partial statements in macros)
366
+ can confuse Lizard's bracket stacks.
367
+ - Some C++ complicated templates may cause confusion with matching angle brackets
368
+ and processing less-than ``<`` or more-than ``>`` operators
369
+ inside of template arguments.
370
+
371
+
372
+ Literatures Referring to Lizard
373
+ -------------------------------
374
+
375
+ Lizard is often used in software related researches. If you used it to support your work, you may contact the lizard author to add your work in the following list.
376
+
377
+ - Software Quality in the ATLAS experiment at CERN, which refers to Lizard as one of the tools, has been published in the Journal of Physics: http://iopscience.iop.org/article/10.1088/1742-6596/898/7/072011
378
+
379
+ - S Martin-Haugh et al 2017 J. Phys.: Conf. Ser. 898 072011
380
+
381
+ Lizard is also used as a plugin for fastlane to help check code complexity and submit xml report to sonar.
382
+
383
+ - `fastlane-plugin-lizard <https://github.com/liaogz82/fastlane-plugin-lizard>`_
384
+ - `sonar <https://github.com/Backelite/sonar-swift/blob/develop/docs/sonarqube-fastlane.md>`_
385
+ - `European research project FASTEN (Fine-grained Analysis of SofTware Ecosystems as Networks, <http://fasten-project.eu/)>`_
386
+ - `for a quality analyzer <https://github.com/fasten-project/quality-analyzer>`_
387
+
388
+
389
+
@@ -34,6 +34,9 @@ A list of supported languages:
34
34
  - Lua
35
35
  - Rust
36
36
  - Fortran
37
+ - Kotlin
38
+ - Solidity
39
+ - Erlang
37
40
 
38
41
  By default lizard will search for any source code that it knows and mix
39
42
  all the results together. This might not be what you want. You can use
@@ -56,7 +59,7 @@ often very hard to get all the included folders and files right when
56
59
  they are complicated. But we don't really need that kind of accuracy for
57
60
  cyclomatic complexity.
58
61
 
59
- It requires python2.7 or above (early versions are not verified).
62
+ It requires python3.8 or above (early versions are not verified).
60
63
 
61
64
  Installation
62
65
  ------------
@@ -80,7 +83,7 @@ Or if you've got the source:
80
83
 
81
84
  ::
82
85
 
83
- [sudo] python setup.py install --install-dir=/path/to/installation/directory/
86
+ [sudo] python setup.py install --prefix=/path/to/installation/directory/
84
87
 
85
88
  Usage
86
89
  -----