Skip to content

Commit 6315e05

Browse files
committed
Added config file for lizard: #167
1 parent 883a73c commit 6315e05

2 files changed

Lines changed: 43 additions & 15 deletions

File tree

ci/lizard_config.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"directories": [
3+
{
4+
"directory": "knp",
5+
"nloc": 50,
6+
"cyclomatic_complexity": 10,
7+
"token_count": 300,
8+
"parameter_count": 4
9+
},
10+
{
11+
"directory": "examples",
12+
"nloc": 100,
13+
"cyclomatic_complexity": 15,
14+
"token_count": 500,
15+
"parameter_count": 6
16+
}
17+
]
18+
}

ci/run_lizard.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,51 @@
88
@copyright © 2026 AO Kaspersky Lab
99
@date 13.03.2026
1010
11-
Licensed under the Apache License, Version 2.0 (the "License");
11+
Licensed under the Apache License, Version 2.0 (the 'License');
1212
you may not use this file except in compliance with the License.
1313
You may obtain a copy of the License at
1414
1515
http://www.apache.org/licenses/LICENSE-2.0
1616
1717
Unless required by applicable law or agreed to in writing, software
18-
distributed under the License is distributed on an "AS IS" BASIS,
18+
distributed under the License is distributed on an 'AS IS' BASIS,
1919
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2020
See the License for the specific language governing permissions and
2121
limitations under the License.
2222
"""
2323

2424

2525
import subprocess
26+
import json
2627

2728

2829
def run_lizard(path: str, nloc: int, complexity: int, token_count: int, arguments: int) -> None:
29-
print(f"Running lizard in {path}")
30+
print(f'Running lizard in {path}')
3031
command = [
31-
"lizard",
32+
'lizard',
3233
path,
33-
"-T",
34-
f"nloc={nloc}",
35-
"-T",
36-
f"cyclomatic_complexity={complexity}",
37-
"-T",
38-
f"token_count={token_count}",
39-
"-T",
40-
f"parameter_count={arguments}",
41-
"-w",
34+
'-T',
35+
f'nloc={nloc}',
36+
'-T',
37+
f'cyclomatic_complexity={complexity}',
38+
'-T',
39+
f'token_count={token_count}',
40+
'-T',
41+
f'parameter_count={arguments}',
42+
'-w',
4243
]
4344
subprocess.run(command, check=False)
4445
print()
4546

4647

47-
run_lizard("knp", 50, 10, 300, 4)
48-
run_lizard("examples", 100, 15, 500, 6)
48+
# Parse config.
49+
with open('ci/lizard_config.json', encoding='UTF-8') as config_file:
50+
config = json.load(config_file)
51+
for directory in config['directories']:
52+
run_lizard(
53+
directory['directory'],
54+
directory['nloc'],
55+
directory['cyclomatic_complexity'],
56+
directory['token_count'],
57+
directory['parameter_count'],
58+
)

0 commit comments

Comments
 (0)