Create code complexity (Cyclomatic complexity, Lines Of Code, Parameter Count, etc.) report for the activated code file.
Supported languages;
- C++
- C#
- Java
- Javascript
- Objective C
- PHP
- Python
- Ruby
- Swift
- Golang
pip install -r requirements.txt
pip install uvicorn
uvicorn main:app --reload
docker image build -t [YOUR_REPOSITORY_NAME]/[YOUR_IMAGE_NAME]:latest .
docker container run -d --name analyzer -p 8000:80 [YOUR_REPOSITORY_NAME]/[YOUR_IMAGE_NAME]:latest
Application has 3 specific endpoints:
curl --request GET 'http://127.0.0.1:8000/'
{
"Title": "Codalyze: Code Complexity Report",
"Description": "Create code complexity (Cyclomatic complexity, Lines Of Code, Parameter Count, etc.) report for the activated code file.",
"Support": "selcukusta(at)gmail(dot)com",
"API Documentation": "https://codalyze-api.selcukusta.com/docs",
"Credits": {
"lizard": "https://github.com/terryyin/lizard",
"fastapi": "https://github.com/tiangolo/fastapi"
}
}
curl --request POST 'http://127.0.0.1:8000/analyze/go' \
--header 'Content-Type: application/json' \
--data-raw '{
"html": "[PASTE_YOUR_CODE]",
"threshold": {
"cyclomatic_complexity": 200,
"lines_of_code": 50,
"parameter_count": 4
}
}'
{
"total_lines_of_code": 73,
"functions": [
{
"name": "AzureBlobHandler",
"cyclomatic_complexity": 6,
"lines_of_code": 52,
"start_line": 27,
"end_line": 86,
"parameter_count": 2
}
]
}
curl --request POST 'http://127.0.0.1:8000/output/go' \
--header 'Content-Type: application/json' \
--data-raw '{
"html": "[PASTE_YOUR_CODE]",
"threshold": {
"cyclomatic_complexity": 200,
"lines_of_code": 50,
"parameter_count": 4
}
}'
<!DOCTYPE html>
<html lang="en">
<head>
<title>Codalyze: Code Complexity Report</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
...
</body>
</html>
- terryyin/lizard for complexity calculation
- tiangolo/fastapi for web framework