Skip to content

Commit 33f893b

Browse files
committed
Update readme instructions.
Signed-off-by: Rahul Krishna <[email protected]>
1 parent aa9f429 commit 33f893b

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

README.md

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,98 +10,105 @@ This project uses [uv](https://docs.astral.sh/uv/) for dependency management.
1010

1111
### Prerequisites
1212

13-
- Python 3.12 or higher
1413
- [uv](https://docs.astral.sh/uv/getting-started/installation/) installed
14+
- Python 3.12 or higher. You can use `uv` to install Python if it's not already installed:
15+
```bash
16+
uv python install 3.12
17+
```
1518

1619
### Setup
1720

1821
1. Clone the repository:
1922
```bash
20-
git clone <repository-url>
23+
git clone https://github.com/codellm-devkit/codeanalyzer-python
2124
cd codeanalyzer-python
2225
```
2326

2427
2. Install dependencies using uv:
2528
```bash
2629
uv sync --all-groups
2730
```
28-
2931
This will install all dependencies including development and test dependencies.
3032

31-
3. Install the package in development mode:
32-
```bash
33-
uv pip install -e .
34-
```
35-
3633
## Usage
3734

3835
The codeanalyzer provides a command-line interface for performing static analysis on Python projects.
3936

4037
### Basic Usage
4138

4239
```bash
43-
codeanalyzer --input /path/to/python/project
40+
uv run codeanalyzer --input /path/to/python/project
4441
```
4542

4643
### Command Line Options
4744

48-
- `-i, --input PATH`: **Required.** Path to the project root directory to analyze.
49-
- `-o, --output PATH`: Output directory for analysis artifacts. If specified, results will be saved to `analysis.json` in this directory.
50-
- `-a, --analysis-level INTEGER`: Analysis depth level (default: 1)
51-
- `1`: Symbol table generation
52-
- `2`: Call graph analysis
53-
- `--codeql/--no-codeql`: Enable or disable CodeQL-based analysis (default: disabled)
54-
- `--eager/--lazy`: Analysis mode (default: lazy)
55-
- `--eager`: Rebuild analysis cache at every run
56-
- `--lazy`: Use existing cache if available
57-
- `-c, --cache-dir PATH`: Directory to store analysis cache. Defaults to `.cache/codeanalyzer` in current working directory.
58-
- `--clear-cache/--keep-cache`: Clear cache after analysis (default: clear)
59-
- `-v/-q, --verbose/--quiet`: Enable or disable verbose output (default: verbose)
45+
To view the available options and commands, run `uv run codeanalyzer --help`. You should see output similar to the following:
46+
47+
```bash
48+
❯ uv run codeanalyzer --help
49+
50+
Usage: codeanalyzer [OPTIONS] COMMAND [ARGS]...
51+
52+
Static Analysis on Python source code using Jedi, CodeQL and Tree sitter.
53+
54+
55+
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
56+
* --input -i PATH Path to the project root directory. [default: None] [required] │
57+
│ --output -o PATH Output directory for artifacts. [default: None] │
58+
│ --analysis-level -a INTEGER 1: symbol table, 2: call graph. [default: 1] │
59+
│ --codeql --no-codeql Enable CodeQL-based analysis. [default: no-codeql] │
60+
│ --eager --lazy Enable eager or lazy analysis. Eager will rebuild the analysis cache at every run and lazy will use the cache if available. Defaults to lazy. [default: lazy] │
61+
│ --cache-dir -c PATH Directory to store analysis cache. If not specified, the cache will be stored in the current working directory under `.codeanalyzer`. Defaults to None. [default: None] │
62+
│ --clear-cache --keep-cache Clear cache after analysis. [default: clear-cache] │
63+
│ --verbose -v --quiet -q Enable verbose output. [default: v] │
64+
│ --help Show this message and exit. │
65+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
66+
```
6067
6168
### Examples
6269
6370
1. **Basic analysis with symbol table:**
6471
```bash
65-
codeanalyzer --input ./my-python-project
72+
uv run codeanalyzer --input ./my-python-project
6673
```
6774
6875
This will print the symbol table to stdout in JSON format to the standard output. If you want to save the output, you can use the `--output` option.
6976
7077
```bash
71-
codeanalyzer --input ./my-python-project --output /path/to/analysis-results
78+
uv run codeanalyzer --input ./my-python-project --output /path/to/analysis-results
7279
```
7380
7481
Now, you can find the analysis results in `analysis.json` in the specified directory.
7582
7683
2. **Toggle analysis levels with `--analysis-level`:**
7784
```bash
78-
codeanalyzer --input ./my-python-project --analysis-level 1 # Symbol table only
85+
uv run codeanalyzer --input ./my-python-project --analysis-level 1 # Symbol table only
7986
```
8087
Call graph analysis can be enabled by setting the level to `2`:
8188
```bash
82-
codeanalyzer --input ./my-python-project --analysis-level 2 # Symbol table + Call graph
89+
uv run codeanalyzer --input ./my-python-project --analysis-level 2 # Symbol table + Call graph
8390
```
8491
***Note: The `--analysis-level=2` is not yet implemented in this version.***
8592
8693
3. **Analysis with CodeQL enabled:**
8794
```bash
88-
codeanalyzer --input ./my-python-project --codeql
95+
uv run codeanalyzer --input ./my-python-project --codeql
8996
```
9097
This will perform CodeQL-based analysis in addition to the standard symbol table generation.
9198
9299
***Note: Not yet fully implemented. Please refrain from using this option until further notice.***
93100
94101
4. **Eager analysis with custom cache directory:**
95102
```bash
96-
codeanalyzer --input ./my-python-project --eager --cache-dir /path/to/custom-cache
103+
uv run codeanalyzer --input ./my-python-project --eager --cache-dir /path/to/custom-cache
97104
```
98105
This will rebuild the analysis cache at every run and store it in `/path/to/custom-cache/.codeanalyzer`. The cache will be cleared by default after analysis unless you specify `--keep-cache`.
99106
100107
If you provide --cache-dir, the cache will be stored in that directory. If not specified, it defaults to `.codeanalyzer` in the current working directory (`$PWD`).
101108
102109
5. **Quiet mode (minimal output):**
103110
```bash
104-
codeanalyzer --input /path/to/my-python-project --quiet
111+
uv run codeanalyzer --input /path/to/my-python-project --quiet
105112
```
106113
107114
### Output

0 commit comments

Comments
 (0)