lizard 1.17.23__py2.py3-none-any.whl → 1.17.24__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.23
3
+ Version: 1.17.24
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/
@@ -336,13 +336,28 @@ Options in Comments
336
336
  -------------------
337
337
 
338
338
  You can use options in the comments of the source code to change the
339
- behavior of lizard. By putting "#lizard forgives" inside a function or
340
- before a function it will suppress the warning for that function.
339
+ behavior of lizard. There are two types of forgiveness comments:
340
+
341
+ 1. Function forgiveness: Put "#lizard forgives" inside a function or before a function to suppress warnings for that function.
341
342
 
342
343
  ::
343
344
 
344
345
  int foo() {
345
- // #lizard forgives the complexity
346
+ // #lizard forgives
347
+ ...
348
+ }
349
+
350
+ 2. Global code forgiveness: Put "#lizard forgive global" before global code to suppress warnings for all code outside of functions.
351
+
352
+ ::
353
+
354
+ // #lizard forgive global
355
+ int global_var = 0;
356
+ if (condition) { // This complexity won't be counted
357
+ ...
358
+ }
359
+
360
+ int foo() { // Functions are still counted normally
346
361
  ...
347
362
  }
348
363
 
@@ -1,4 +1,4 @@
1
- lizard.py,sha256=0ntBLDrWbIPa_yGusTXX91P3fjbrg9RcB-pxhCfVWK4,39999
1
+ lizard.py,sha256=8Um-Twbq0JgVn3V_YQNl5iyNH9-Xno8U-zD_Jb5F22g,40247
2
2
  lizard_ext/__init__.py,sha256=Cz0pvH6QHyadK-rAeeEhQVsm0hW5M-fBQgV4FBaX9zk,500
3
3
  lizard_ext/auto_open.py,sha256=byD_RbeVhvSUhR2bJMRitvA3zcKEapFwv0-XaDJ6GFo,1096
4
4
  lizard_ext/csvoutput.py,sha256=43fhmo8kB85qcdujCwySGNuTC4FkKUPLqIApPeljPnA,2663
@@ -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=8OYSScMy6WgCedG7UcZmt7GxKDmCpya3NUQHG12M8_w,182
28
+ lizard_ext/version.py,sha256=5EWG0zrw8uPuX6Rn7CaOTVJa6kB-qGS0Tk91MFU8t7o,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
@@ -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.23.dist-info/LICENSE.txt,sha256=05ZjgQ8Cl1dD9p0BhW-Txzkc5rhCogGJVEuf1GT2Y_M,1303
64
- lizard-1.17.23.dist-info/METADATA,sha256=RSP5Eq3wzytjP5T8yFmfWZaDaI9Xkd5iFCRg65yeGtE,15753
65
- lizard-1.17.23.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
66
- lizard-1.17.23.dist-info/entry_points.txt,sha256=ZBqPhu-J3NoGGW5vn2Gfyoo0vdVlgBgM-wlNm0SGYUQ,39
67
- lizard-1.17.23.dist-info/top_level.txt,sha256=5NTrTaOLhHuTzXaGcZPKfuaOgUv7WafNGe0Zl5aycpg,35
68
- lizard-1.17.23.dist-info/RECORD,,
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,,
lizard.py CHANGED
@@ -418,6 +418,7 @@ class FileInfoBuilder(object):
418
418
  self.fileinfo = FileInformation(filename, 0)
419
419
  self.current_line = 0
420
420
  self.forgive = False
421
+ self.forgive_global = False
421
422
  self.newline = True
422
423
  self.global_pseudo_function = FunctionInfo('*global*', filename, 0)
423
424
  self.current_function = self.global_pseudo_function
@@ -481,7 +482,8 @@ class FileInfoBuilder(object):
481
482
 
482
483
  def end_of_function(self):
483
484
  if not self.forgive:
484
- self.fileinfo.function_list.append(self.current_function)
485
+ if self.current_function.name != '*global*' or not self.forgive_global:
486
+ self.fileinfo.function_list.append(self.current_function)
485
487
  self.forgive = False
486
488
  if self.stacked_functions:
487
489
  self.current_function = self.stacked_functions.pop()
@@ -501,7 +503,9 @@ def comment_counter(tokens, reader):
501
503
  if comment is not None:
502
504
  for _ in comment.splitlines()[1:]:
503
505
  yield '\n'
504
- if comment.strip().startswith("#lizard forgive"):
506
+ if comment.strip().startswith("#lizard forgive global"):
507
+ reader.context.forgive_global = True
508
+ elif comment.strip().startswith("#lizard forgive"):
505
509
  reader.context.forgive = True
506
510
  if "GENERATED CODE" in comment:
507
511
  return
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.23"
6
+ version = "1.17.24"