Skip to content

Commit cf42f72

Browse files
committed
Merge remote-tracking branch 'upstream/master' into voyager
2 parents c478d30 + b585a89 commit cf42f72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2867
-119
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"makefile.configureOnOpen": false
3+
}

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Change Log
22

3+
## 1.19.0
4+
5+
### New Features
6+
- Add PL/SQL language support with comprehensive parsing for procedures, functions, and triggers
7+
- Add support for schema-qualified names in PL/SQL parser
8+
9+
### Improvements
10+
- Enhanced JavaScript and TypeScript parsing with improved static and async method detection
11+
- Better method call detection to avoid false positives in JavaScript/TypeScript
12+
- Improved previous token context tracking for accurate function detection
13+
- Reorganized supported languages list in README alphabetically
14+
15+
### Bug Fixes
16+
- Fix line count calculation issue when encountering empty lines after macro definition continuation markers
17+
18+
### Documentation
19+
- Add contribution guidelines to README
20+
321
## 1.18.0
422

523
### New Features

README.rst

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,32 @@ code analysis.
1717

1818
A list of supported languages:
1919

20+
- C# (C Sharp)
2021
- C/C++ (works with C++14)
22+
- Erlang
23+
- Fortran
24+
- GDScript
25+
- Golang
2126
- Java
22-
- C# (C Sharp)
2327
- JavaScript (With ES6 and JSX)
24-
- TypeScript (With TSX)
25-
- VueJS
28+
- Kotlin
29+
- Lua
2630
- Objective-C
27-
- Swift
31+
- Perl
32+
- PHP
33+
- PL/SQL
2834
- Python
35+
- R
2936
- Ruby
30-
- TTCN-3
31-
- PHP
32-
- Scala
33-
- GDScript
34-
- Golang
35-
- Lua
3637
- Rust
37-
- Fortran
38-
- Kotlin
38+
- Scala
3939
- Solidity
40-
- Erlang
41-
- Zig
42-
- Perl
4340
- Structured Text (St)
44-
- R
41+
- Swift
42+
- TTCN-3
43+
- TypeScript (With TSX)
44+
- VueJS
45+
- Zig
4546

4647
By default lizard will search for any source code that it knows and mix
4748
all the results together. This might not be what you want. You can use
@@ -129,7 +130,7 @@ Options
129130
search for all languages it knows. `lizard -l cpp -l java`searches for
130131
C++ and Java code. The available languages are: cpp, java, csharp,
131132
javascript, python, objectivec, ttcn, ruby, php, swift, scala, GDScript,
132-
go, lua, rust, typescript
133+
go, lua, rust, typescript, plsql
133134
-V, --verbose Output in verbose mode (long function name)
134135
-C CCN, --CCN CCN Threshold for cyclomatic complexity number warning. The default value is
135136
15. Functions with CCN bigger than it will generate warning
@@ -382,3 +383,12 @@ Lizard is also used as a plugin for fastlane to help check code complexity and s
382383
- `European research project FASTEN (Fine-grained Analysis of SofTware Ecosystems as Networks, <http://fasten-project.eu/)>`_
383384
- `for a quality analyzer <https://github.com/fasten-project/quality-analyzer>`_
384385

386+
How To Contribute
387+
-----------------
388+
389+
Contributions are welcome. Please refer to the rules and development workflow in:
390+
391+
- https://github.com/terryyin/lizard/tree/master/.cursor/rules
392+
393+
These guidelines are usable by both AI assistants and human contributors — what works for AI works for "I" as well — to keep changes cohesive, simple, and well-tested.
394+

lizard_ext/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def print_csv(results, options, _, total_factory):
2121

2222
def print_checkstyle(results, options, _, total_factory, file=None):
2323
import sys
24-
print("DEBUG: print_checkstyle called", file=sys.stderr)
2524
output = checkstyle_output(total_factory(list(results)), options.verbose)
2625
if file is None:
2726
file = sys.stdout

lizard_ext/lizardcomplextags.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
55

66

77
class LizardExtension(object): # pylint: disable=R0903
8+
"""
9+
Complex tags extension: records all complexity-adding keywords and their line numbers.
10+
Uses reader.conditions (combined set of all condition types) to track all
11+
complexity contributors: control flow, logical operators, case labels, and ternary.
12+
"""
813

914
# pylint: disable=W0221
1015
def __call__(self, tokens, reader):
1116
context = reader.context
17+
# Use combined conditions set - intentionally includes all types
1218
conditions = reader.conditions
1319
for token in tokens:
1420
yield token

lizard_ext/lizardmccabe.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@
1414

1515

1616
class LizardExtension(ExtensionBase): # pylint: disable=R0903
17+
"""
18+
McCabe extension: only counts the first 'case' in a switch statement.
19+
Consecutive cases without code between them don't add to complexity.
20+
Works by detecting case tokens (conceptually from reader.case_keywords).
21+
"""
1722

1823
def _state_global(self, token):
19-
if token == "case":
24+
if token == "case": # Detect case keywords
2025
self._state = self._in_case
2126

2227
def _in_case(self, token):

lizard_ext/lizardmodified.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@
66

77

88
class LizardExtension(object): # pylint: disable=R0903
9+
"""
10+
Modified CCN extension: counts entire switch/case as 1 complexity.
11+
Adds +1 for 'switch', subtracts -1 for each 'case'.
12+
Works with switch/case keywords (conceptually from reader.case_keywords).
13+
"""
914

1015
def __call__(self, tokens, reader):
1116
for token in tokens:
12-
if token == 'switch':
17+
if token == 'switch': # Add complexity for switch statement
1318
reader.context.add_condition()
1419
if hasattr(reader.context, "add_nd_condition"):
1520
reader.context.add_nd_condition()
16-
elif token == 'case':
21+
elif token == 'case': # Subtract complexity for each case
1722
reader.context.add_condition(-1)
1823
if hasattr(reader.context, "add_nd_condition"):
1924
reader.context.add_nd_condition(-1)

lizard_ext/lizardnonstrict.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ class LizardExtension(object): # pylint: disable=R0903
99

1010
# pylint: disable=W0221
1111
def __call__(self, tokens, reader):
12-
reader.conditions -= set(['&&', '||', 'and', 'or'])
12+
# Remove logical operators from conditions (non-strict mode)
13+
reader.conditions -= reader.logical_operators
1314
return tokens

lizard_ext/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
#
44
# pylint: disable=missing-docstring,invalid-name
55

6-
version = "1.18.0"
6+
version = "1.19.0"

lizard_languages/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from .perl import PerlReader
2727
from .st import StReader
2828
from .r import RReader
29+
from .plsql import PLSQLReader
2930

3031

3132
def languages():
@@ -56,6 +57,7 @@ def languages():
5657
PerlReader,
5758
StReader,
5859
RReader,
60+
PLSQLReader,
5961
]
6062

6163

0 commit comments

Comments
 (0)