autosar-calltree 0.3.0__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.
- autosar_calltree-0.3.0/LICENSE +21 -0
- autosar_calltree-0.3.0/MANIFEST.in +6 -0
- autosar_calltree-0.3.0/PKG-INFO +482 -0
- autosar_calltree-0.3.0/README.md +436 -0
- autosar_calltree-0.3.0/pyproject.toml +111 -0
- autosar_calltree-0.3.0/setup.cfg +4 -0
- autosar_calltree-0.3.0/setup.py +10 -0
- autosar_calltree-0.3.0/src/autosar_calltree/__init__.py +24 -0
- autosar_calltree-0.3.0/src/autosar_calltree/analyzers/__init__.py +5 -0
- autosar_calltree-0.3.0/src/autosar_calltree/analyzers/call_tree_builder.py +369 -0
- autosar_calltree-0.3.0/src/autosar_calltree/cli/__init__.py +5 -0
- autosar_calltree-0.3.0/src/autosar_calltree/cli/main.py +330 -0
- autosar_calltree-0.3.0/src/autosar_calltree/config/__init__.py +10 -0
- autosar_calltree-0.3.0/src/autosar_calltree/config/module_config.py +179 -0
- autosar_calltree-0.3.0/src/autosar_calltree/database/__init__.py +23 -0
- autosar_calltree-0.3.0/src/autosar_calltree/database/function_database.py +505 -0
- autosar_calltree-0.3.0/src/autosar_calltree/database/models.py +189 -0
- autosar_calltree-0.3.0/src/autosar_calltree/generators/__init__.py +5 -0
- autosar_calltree-0.3.0/src/autosar_calltree/generators/mermaid_generator.py +488 -0
- autosar_calltree-0.3.0/src/autosar_calltree/parsers/__init__.py +6 -0
- autosar_calltree-0.3.0/src/autosar_calltree/parsers/autosar_parser.py +314 -0
- autosar_calltree-0.3.0/src/autosar_calltree/parsers/c_parser.py +415 -0
- autosar_calltree-0.3.0/src/autosar_calltree/version.py +5 -0
- autosar_calltree-0.3.0/src/autosar_calltree.egg-info/PKG-INFO +482 -0
- autosar_calltree-0.3.0/src/autosar_calltree.egg-info/SOURCES.txt +27 -0
- autosar_calltree-0.3.0/src/autosar_calltree.egg-info/dependency_links.txt +1 -0
- autosar_calltree-0.3.0/src/autosar_calltree.egg-info/entry_points.txt +2 -0
- autosar_calltree-0.3.0/src/autosar_calltree.egg-info/requires.txt +19 -0
- autosar_calltree-0.3.0/src/autosar_calltree.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 melodypapa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: autosar-calltree
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A Python tool to analyze C/AUTOSAR codebases and generate function call trees with Mermaid and XMI output
|
|
5
|
+
Author-email: melodypapa <melodypapa@outlook.com>
|
|
6
|
+
Maintainer-email: melodypapa <melodypapa@outlook.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/yourusername/autosar-calltree
|
|
9
|
+
Project-URL: Documentation, https://autosar-calltree.readthedocs.io
|
|
10
|
+
Project-URL: Repository, https://github.com/yourusername/autosar-calltree
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/yourusername/autosar-calltree/issues
|
|
12
|
+
Keywords: autosar,c,call-tree,static-analysis,code-analysis,mermaid,xmi,uml,embedded,automotive
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
16
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: click>=8.0.0
|
|
29
|
+
Requires-Dist: rich>=10.0.0
|
|
30
|
+
Requires-Dist: pydantic>=2.0.0
|
|
31
|
+
Requires-Dist: jinja2>=3.0.0
|
|
32
|
+
Requires-Dist: pyyaml>=6.0
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black==24.8.0; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff>=0.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: mypy>=0.950; extra == "dev"
|
|
40
|
+
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
41
|
+
Provides-Extra: docs
|
|
42
|
+
Requires-Dist: sphinx>=4.0.0; extra == "docs"
|
|
43
|
+
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
|
|
44
|
+
Requires-Dist: sphinx-click>=3.0.0; extra == "docs"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# AUTOSAR Call Tree Analyzer
|
|
48
|
+
|
|
49
|
+
[](https://badge.fury.io/py/autosar-calltree)
|
|
50
|
+
[](https://pypi.org/project/autosar-calltree/)
|
|
51
|
+
[](https://opensource.org/licenses/MIT)
|
|
52
|
+
|
|
53
|
+
A powerful Python package to analyze C/AUTOSAR codebases and generate function call trees with multiple output formats.
|
|
54
|
+
|
|
55
|
+
## Features
|
|
56
|
+
|
|
57
|
+
- ✨ **AUTOSAR Support**: Full parsing of AUTOSAR macros (`FUNC`, `FUNC_P2VAR`, `FUNC_P2CONST`, `VAR`, `P2VAR`, etc.)
|
|
58
|
+
- 🔍 **Static Analysis**: Analyzes C source code without compilation
|
|
59
|
+
- 📊 **Multiple Output Formats**:
|
|
60
|
+
- Mermaid sequence diagrams (Markdown)
|
|
61
|
+
- XMI/UML 2.5 (importable to Enterprise Architect, MagicDraw, etc.) - *planned*
|
|
62
|
+
- JSON (for custom processing) - *planned*
|
|
63
|
+
- 🏗️ **SW Module Support**: Map C files to SW modules via YAML configuration for architecture-level diagrams
|
|
64
|
+
- 📈 **Module-Aware Diagrams**: Generate diagrams with SW module names as participants
|
|
65
|
+
- 🎯 **Parameter Display**: Function parameters shown in sequence diagram calls for better visibility
|
|
66
|
+
- 🚀 **Performance**: Intelligent caching for fast repeated analysis with file-by-file progress reporting
|
|
67
|
+
- 🎯 **Depth Control**: Configurable call tree depth
|
|
68
|
+
- 🔄 **Circular Dependency Detection**: Identifies recursive calls and cycles
|
|
69
|
+
- 📊 **Statistics**: Detailed analysis statistics including module distribution
|
|
70
|
+
- 📝 **Clean Diagrams**: Return statements omitted by default for cleaner sequence diagrams (configurable)
|
|
71
|
+
|
|
72
|
+
## Installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install autosar-calltree
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
For development:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/yourusername/autosar-calltree.git
|
|
82
|
+
cd autosar-calltree
|
|
83
|
+
pip install -e ".[dev]"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Quick Start
|
|
87
|
+
|
|
88
|
+
### Basic Usage
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Analyze a function with default settings (depth=3)
|
|
92
|
+
calltree --start-function Demo_Init --source-dir demo
|
|
93
|
+
|
|
94
|
+
# Use SW module configuration for architecture-level diagrams
|
|
95
|
+
calltree --start-function Demo_Init --source-dir demo --module-config demo/module_mapping.yaml --use-module-names --output demo/demo.md
|
|
96
|
+
|
|
97
|
+
# Specify depth and output
|
|
98
|
+
calltree --start-function Demo_Init --max-depth 2 -o output.md
|
|
99
|
+
|
|
100
|
+
# Verbose mode with detailed statistics and cache progress
|
|
101
|
+
calltree --start-function Demo_Init --verbose
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Python API
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from autosar_calltree.database.function_database import FunctionDatabase
|
|
108
|
+
from autosar_calltree.analyzers.call_tree_builder import CallTreeBuilder
|
|
109
|
+
from autosar_calltree.generators.mermaid_generator import MermaidGenerator
|
|
110
|
+
from autosar_calltree.config.module_config import ModuleConfig
|
|
111
|
+
from pathlib import Path
|
|
112
|
+
|
|
113
|
+
# Load module configuration (optional)
|
|
114
|
+
config = ModuleConfig(Path("demo/module_mapping.yaml"))
|
|
115
|
+
|
|
116
|
+
# Build function database (with caching and module config)
|
|
117
|
+
db = FunctionDatabase(source_dir="demo", module_config=config)
|
|
118
|
+
db.build_database(use_cache=True)
|
|
119
|
+
|
|
120
|
+
# Build call tree
|
|
121
|
+
builder = CallTreeBuilder(db)
|
|
122
|
+
result = builder.build_tree(
|
|
123
|
+
start_function="Demo_Init",
|
|
124
|
+
max_depth=3
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
# Generate Mermaid diagram with module names and parameters
|
|
128
|
+
# include_returns=False (default) omits return statements for cleaner diagrams
|
|
129
|
+
generator = MermaidGenerator(
|
|
130
|
+
use_module_names=True,
|
|
131
|
+
include_returns=False
|
|
132
|
+
)
|
|
133
|
+
generator.generate(result, output_path="call_tree.md")
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Command-Line Options
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
calltree [OPTIONS]
|
|
140
|
+
|
|
141
|
+
Options:
|
|
142
|
+
--start-function TEXT Starting function name [required]
|
|
143
|
+
--max-depth INTEGER Maximum call depth (default: 3)
|
|
144
|
+
--source-dir PATH Source code directory (default: ./demo)
|
|
145
|
+
--format [mermaid|xmi|both] Output format (default: mermaid)
|
|
146
|
+
--output PATH Output file path (default: call_tree.md)
|
|
147
|
+
--module-config PATH YAML file mapping C files to SW modules
|
|
148
|
+
--use-module-names Use SW module names as Mermaid participants
|
|
149
|
+
--cache-dir PATH Cache directory (default: <source-dir>/.cache)
|
|
150
|
+
--no-cache Disable cache usage
|
|
151
|
+
--rebuild-cache Force rebuild of cache
|
|
152
|
+
--no-abbreviate-rte Do not abbreviate RTE function names
|
|
153
|
+
--verbose, -v Enable verbose output
|
|
154
|
+
--list-functions, -l List all available functions and exit
|
|
155
|
+
--search TEXT Search for functions matching pattern
|
|
156
|
+
--help Show this message and exit
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Output Examples
|
|
160
|
+
|
|
161
|
+
### Mermaid Sequence Diagram
|
|
162
|
+
|
|
163
|
+
```mermaid
|
|
164
|
+
sequenceDiagram
|
|
165
|
+
participant DemoModule
|
|
166
|
+
participant CommunicationModule
|
|
167
|
+
participant HardwareModule
|
|
168
|
+
participant SoftwareModule
|
|
169
|
+
|
|
170
|
+
DemoModule->>CommunicationModule: COM_InitCommunication(baud_rate, buffer_size)
|
|
171
|
+
CommunicationModule->>CommunicationModule: COM_InitCAN
|
|
172
|
+
CommunicationModule->>CommunicationModule: COM_InitEthernet
|
|
173
|
+
CommunicationModule->>CommunicationModule: COM_InitLIN
|
|
174
|
+
DemoModule->>DemoModule: Demo_InitVariables(config_mode)
|
|
175
|
+
DemoModule->>HardwareModule: HW_InitHardware(clock_freq, gpio_mask)
|
|
176
|
+
HardwareModule->>HardwareModule: HW_InitADC
|
|
177
|
+
HardwareModule->>HardwareModule: HW_InitClock
|
|
178
|
+
HardwareModule->>HardwareModule: HW_InitGPIO
|
|
179
|
+
HardwareModule->>HardwareModule: HW_InitPWM
|
|
180
|
+
DemoModule->>SoftwareModule: SW_InitSoftware(state, config)
|
|
181
|
+
SoftwareModule->>SoftwareModule: SW_InitConfig
|
|
182
|
+
SoftwareModule->>SoftwareModule: SW_InitState
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Key Features**:
|
|
186
|
+
- Participants appear in the order they are first encountered in the call tree
|
|
187
|
+
- Function parameters are displayed in the call arrows (e.g., `COM_InitCommunication(baud_rate, buffer_size)`)
|
|
188
|
+
- Return statements are omitted by default for cleaner visualization
|
|
189
|
+
- Module names are used as participants when `--use-module-names` is enabled
|
|
190
|
+
|
|
191
|
+
### Generated Markdown Structure
|
|
192
|
+
|
|
193
|
+
The tool generates comprehensive Markdown files with:
|
|
194
|
+
- Metadata header (timestamp, settings, statistics)
|
|
195
|
+
- Mermaid sequence diagram with function parameters
|
|
196
|
+
- Function details table with parameter information
|
|
197
|
+
- Text-based call tree
|
|
198
|
+
- Circular dependency warnings
|
|
199
|
+
- Analysis statistics
|
|
200
|
+
|
|
201
|
+
**Note**: Return statements are omitted from sequence diagrams by default for cleaner visualization. This can be configured programmatically when using the Python API.
|
|
202
|
+
|
|
203
|
+
## Supported AUTOSAR Patterns
|
|
204
|
+
|
|
205
|
+
The tool recognizes and parses:
|
|
206
|
+
|
|
207
|
+
```c
|
|
208
|
+
// AUTOSAR function declarations
|
|
209
|
+
FUNC(void, RTE_CODE) Function_Name(void);
|
|
210
|
+
FUNC(Std_ReturnType, RTE_CODE) Com_Test(VAR(uint32, AUTOMATIC) timerId);
|
|
211
|
+
STATIC FUNC(uint8, CODE) Internal_Function(void);
|
|
212
|
+
|
|
213
|
+
// AUTOSAR pointer returns
|
|
214
|
+
FUNC_P2VAR(uint8, AUTOMATIC, APPL_VAR) Get_Buffer(void);
|
|
215
|
+
FUNC_P2CONST(ConfigType, AUTOMATIC, APPL_VAR) Get_Config(void);
|
|
216
|
+
|
|
217
|
+
// AUTOSAR parameters
|
|
218
|
+
VAR(uint32, AUTOMATIC) variable
|
|
219
|
+
P2VAR(uint8, AUTOMATIC, APPL_DATA) buffer
|
|
220
|
+
P2CONST(ConfigType, AUTOMATIC, APPL_DATA) config
|
|
221
|
+
CONST(uint16, AUTOMATIC) constant
|
|
222
|
+
|
|
223
|
+
// Traditional C (fallback)
|
|
224
|
+
void traditional_function(uint8 param);
|
|
225
|
+
static uint32 helper_function(void);
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## SW Module Configuration
|
|
229
|
+
|
|
230
|
+
Map C source files to SW modules using YAML configuration:
|
|
231
|
+
|
|
232
|
+
```yaml
|
|
233
|
+
# module_mapping.yaml
|
|
234
|
+
version: "1.0"
|
|
235
|
+
|
|
236
|
+
# Specific file mappings
|
|
237
|
+
file_mappings:
|
|
238
|
+
demo.c: DemoModule
|
|
239
|
+
|
|
240
|
+
# Pattern-based mappings (glob patterns)
|
|
241
|
+
pattern_mappings:
|
|
242
|
+
"hw_*.c": HardwareModule
|
|
243
|
+
"sw_*.c": SoftwareModule
|
|
244
|
+
"com_*.c": CommunicationModule
|
|
245
|
+
|
|
246
|
+
# Default module for unmapped files (optional)
|
|
247
|
+
default_module: "Other"
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Benefits**:
|
|
251
|
+
- Generate architecture-level diagrams showing module interactions
|
|
252
|
+
- Identify cross-module dependencies
|
|
253
|
+
- Verify architectural boundaries
|
|
254
|
+
- Support high-level design documentation
|
|
255
|
+
|
|
256
|
+
**Usage**:
|
|
257
|
+
```bash
|
|
258
|
+
calltree --start-function Demo_Init --module-config module_mapping.yaml --use-module-names --max-depth 3
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
This generates diagrams with:
|
|
262
|
+
- **Participants**: SW module names (HardwareModule, SoftwareModule, etc.) in the order they are first encountered
|
|
263
|
+
- **Arrows**: Function names with parameters being called between modules
|
|
264
|
+
- **Function Table**: Includes module column showing each function's SW module
|
|
265
|
+
- **Clean Visualization**: Return statements omitted by default
|
|
266
|
+
|
|
267
|
+
## Use Cases
|
|
268
|
+
|
|
269
|
+
- **Documentation**: Generate call flow diagrams for documentation
|
|
270
|
+
- **Code Review**: Visualize function dependencies
|
|
271
|
+
- **Impact Analysis**: Understand change impact before modifications
|
|
272
|
+
- **Onboarding**: Help new developers understand codebase structure
|
|
273
|
+
- **Compliance**: Generate diagrams for safety certification (ISO 26262)
|
|
274
|
+
- **Refactoring**: Identify tightly coupled components
|
|
275
|
+
- **Architecture**: Verify architectural boundaries
|
|
276
|
+
|
|
277
|
+
## Project Structure
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
autosar-calltree/
|
|
281
|
+
├── src/autosar_calltree/
|
|
282
|
+
│ ├── cli/ # Command-line interface
|
|
283
|
+
│ ├── config/ # Configuration management (module mappings)
|
|
284
|
+
│ ├── parsers/ # Code parsers (AUTOSAR, C)
|
|
285
|
+
│ ├── analyzers/ # Analysis logic (call tree, dependencies)
|
|
286
|
+
│ ├── database/ # Data models and caching
|
|
287
|
+
│ ├── generators/ # Output generators (Mermaid)
|
|
288
|
+
│ └── utils/ # Utilities (empty, for future use)
|
|
289
|
+
├── test_demo/ # Demo AUTOSAR C files for testing
|
|
290
|
+
│ ├── demo.c
|
|
291
|
+
│ ├── hardware.c
|
|
292
|
+
│ ├── software.c
|
|
293
|
+
│ ├── communication.c
|
|
294
|
+
│ └── module_mapping.yaml
|
|
295
|
+
├── tests/ # Test suite (empty, for future use)
|
|
296
|
+
├── docs/ # Documentation
|
|
297
|
+
│ └── requirements/ # Software requirements
|
|
298
|
+
└── examples/ # Example scripts (empty, for future use)
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Development
|
|
302
|
+
|
|
303
|
+
### Running Tests
|
|
304
|
+
|
|
305
|
+
The project has **comprehensive test coverage** with 278 tests across all modules:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Run all tests
|
|
309
|
+
pytest tests/
|
|
310
|
+
|
|
311
|
+
# Run with verbose output
|
|
312
|
+
pytest -vv tests/
|
|
313
|
+
|
|
314
|
+
# Run specific test module
|
|
315
|
+
pytest tests/test_models.py
|
|
316
|
+
pytest tests/test_parsers.py
|
|
317
|
+
pytest tests/test_database.py
|
|
318
|
+
pytest tests/test_analyzers.py
|
|
319
|
+
pytest tests/test_config.py
|
|
320
|
+
pytest tests/test_generators.py
|
|
321
|
+
pytest tests/test_cli.py
|
|
322
|
+
pytest tests/test_integration.py
|
|
323
|
+
|
|
324
|
+
# Run specific test case
|
|
325
|
+
pytest tests/test_models.py::TestFunctionType::test_function_type_enum_values
|
|
326
|
+
|
|
327
|
+
# Run tests with live stdout output (useful for debugging)
|
|
328
|
+
pytest -vv -s tests/
|
|
329
|
+
|
|
330
|
+
# Run tests and show coverage report
|
|
331
|
+
pytest --cov=autosar_calltree --cov-report=html --cov-report=term
|
|
332
|
+
|
|
333
|
+
# Run tests with coverage and omit tests from coverage report
|
|
334
|
+
pytest --cov=autosar_calltree --cov-report=html --cov-report=term --omit=tests/
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Test Coverage
|
|
338
|
+
|
|
339
|
+
The project maintains **94% code coverage** across all modules:
|
|
340
|
+
|
|
341
|
+
| Module | Coverage | Tests |
|
|
342
|
+
|--------|----------|-------|
|
|
343
|
+
| Models | 100% | 25 |
|
|
344
|
+
| AUTOSAR Parser | 97% | 15 |
|
|
345
|
+
| C Parser | 86% | 18 |
|
|
346
|
+
| Database | 80% | 20 |
|
|
347
|
+
| Analyzers | 94% | 20 |
|
|
348
|
+
| Config | 97% | 25 |
|
|
349
|
+
| Generators | 96% | 31 |
|
|
350
|
+
| CLI (Integration) | ~90% | 14 |
|
|
351
|
+
| End-to-End | ~90% | 110 |
|
|
352
|
+
| **Total** | **94%** | **278** |
|
|
353
|
+
|
|
354
|
+
### Code Quality
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
# Format code with Black
|
|
358
|
+
black src/ tests/
|
|
359
|
+
|
|
360
|
+
# Sort imports with isort
|
|
361
|
+
isort src/ tests/
|
|
362
|
+
|
|
363
|
+
# Lint with flake8
|
|
364
|
+
flake8 src/ tests/
|
|
365
|
+
|
|
366
|
+
# Type checking with mypy
|
|
367
|
+
mypy src/
|
|
368
|
+
|
|
369
|
+
# Run all quality checks (uses pre-configured scripts)
|
|
370
|
+
./scripts/run_quality.sh
|
|
371
|
+
|
|
372
|
+
# Check for traceability between requirements and tests
|
|
373
|
+
python scripts/check_traceability.py
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Slash Commands
|
|
377
|
+
|
|
378
|
+
The project provides convenient slash commands for common development tasks:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# Run all tests
|
|
382
|
+
/test
|
|
383
|
+
|
|
384
|
+
# Run quality checks
|
|
385
|
+
/quality
|
|
386
|
+
|
|
387
|
+
# Test requirement management
|
|
388
|
+
/req
|
|
389
|
+
|
|
390
|
+
# Merge a pull request
|
|
391
|
+
/merge-pr
|
|
392
|
+
|
|
393
|
+
# Generate GitHub workflow
|
|
394
|
+
/gh-workflow
|
|
395
|
+
|
|
396
|
+
# Parse and update documentation
|
|
397
|
+
/parse
|
|
398
|
+
|
|
399
|
+
# Sync documentation
|
|
400
|
+
/sync-docs
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
These commands are documented in `.claude/commands/` and can be used from within Claude Code.
|
|
404
|
+
|
|
405
|
+
### Requirements Traceability
|
|
406
|
+
|
|
407
|
+
The project maintains 100% traceability between requirements and tests:
|
|
408
|
+
|
|
409
|
+
```bash
|
|
410
|
+
# Check traceability matrix
|
|
411
|
+
python scripts/check_traceability.py
|
|
412
|
+
|
|
413
|
+
# View traceability documentation
|
|
414
|
+
cat docs/TRACEABILITY.md
|
|
415
|
+
|
|
416
|
+
# View requirements index
|
|
417
|
+
cat docs/requirements/README.md
|
|
418
|
+
|
|
419
|
+
# View test index
|
|
420
|
+
cat docs/tests/README.md
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Building Documentation
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
cd docs
|
|
427
|
+
make html
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
## Contributing
|
|
431
|
+
|
|
432
|
+
Contributions are welcome! Please:
|
|
433
|
+
|
|
434
|
+
1. Fork the repository
|
|
435
|
+
2. Create a feature branch
|
|
436
|
+
3. Add tests for new functionality
|
|
437
|
+
4. Ensure all tests pass
|
|
438
|
+
5. Submit a pull request
|
|
439
|
+
|
|
440
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
|
|
441
|
+
|
|
442
|
+
## License
|
|
443
|
+
|
|
444
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
445
|
+
|
|
446
|
+
## Authors
|
|
447
|
+
|
|
448
|
+
- Melodypapa <melodypapa@outlook.com>
|
|
449
|
+
|
|
450
|
+
## Acknowledgments
|
|
451
|
+
|
|
452
|
+
- Inspired by the need for better AUTOSAR code analysis tools
|
|
453
|
+
- Built for the automotive embedded systems community
|
|
454
|
+
|
|
455
|
+
## Related Projects
|
|
456
|
+
|
|
457
|
+
- [PlantUML](https://plantuml.com/) - UML diagram generator
|
|
458
|
+
- [Doxygen](https://www.doxygen.nl/) - Documentation generator
|
|
459
|
+
- [cflow](https://www.gnu.org/software/cflow/) - C call graph generator
|
|
460
|
+
|
|
461
|
+
## Roadmap
|
|
462
|
+
|
|
463
|
+
- [ ] PlantUML output format
|
|
464
|
+
- [ ] GraphViz DOT format
|
|
465
|
+
- [ ] HTML interactive viewer
|
|
466
|
+
- [ ] VS Code extension
|
|
467
|
+
- [ ] GitHub Actions integration
|
|
468
|
+
- [x] Configuration file support (YAML for module mappings)
|
|
469
|
+
- [ ] Multi-threading for large codebases
|
|
470
|
+
- [ ] Function complexity metrics
|
|
471
|
+
- [ ] Dead code detection
|
|
472
|
+
- [ ] XMI/UML 2.5 output format
|
|
473
|
+
|
|
474
|
+
## Support
|
|
475
|
+
|
|
476
|
+
- **Issues**: [GitHub Issues](https://github.com/yourusername/autosar-calltree/issues)
|
|
477
|
+
- **Documentation**: [Read the Docs](https://autosar-calltree.readthedocs.io)
|
|
478
|
+
- **Discussions**: [GitHub Discussions](https://github.com/yourusername/autosar-calltree/discussions)
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
**Made with ❤️ for the embedded systems community**
|