Skip to content

Commit 2b8d428

Browse files
committed
v0.4.0: Trend analysis, team metrics, CI/CD integrations (SARIF, Checkstyle, JUnit)
1 parent cff1389 commit 2b8d428

7 files changed

Lines changed: 2814 additions & 1 deletion

File tree

CODE_OF_CONDUCT.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
[INSERT CONTACT METHOD].
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.1, available at
119+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120+
121+
Community Impact Guidelines were inspired by
122+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123+
124+
For answers to common questions about this code of conduct, see the FAQ at
125+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
126+
at [https://www.contributor-covenant.org/translations][translations].
127+
128+
[homepage]: https://www.contributor-covenant.org
129+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130+
[Mozilla CoC]: https://github.com/mozilla/diversity
131+
[FAQ]: https://www.contributor-covenant.org/faq
132+
[translations]: https://www.contributor-covenant.org/translations

README.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ Zero external dependencies — pure Python stdlib.
6060
| `codevista git-stats ./project/` | Git repository statistics |
6161
| `codevista languages ./project/` | Language distribution breakdown |
6262
| `codevista complexity ./project/` | Complexity analysis and top functions |
63+
| `codevista snapshot ./project/` | Save analysis snapshot for trend tracking |
64+
| `codevista trends ./project/` | Show project health trends over time |
65+
| `codevista diff-snapshots ./project/ 1 2` | Compare two snapshots |
66+
| `codevista team ./project/` | Team productivity & collaboration analysis |
67+
| `codevista ci-output ./project/ -f sarif` | CI/CD output (SARIF, Checkstyle, etc.) |
6368

6469
## 📊 What It Analyzes
6570

@@ -169,6 +174,81 @@ Track file age, change frequency, and identify files most likely to have bugs:
169174
codevista code-age ./my-project/
170175
```
171176

177+
## 📈 Trend Analysis
178+
179+
Track code quality over time with snapshots and trend visualization.
180+
181+
### How It Works
182+
183+
1. **Save snapshots** after each analysis run
184+
2. **Compare snapshots** to see how your codebase evolves
185+
3. **Get alerted** when metrics cross critical thresholds
186+
4. **Track technical debt** ratio over time
187+
188+
```bash
189+
# Save a snapshot of the current state
190+
codevista snapshot ./my-project/
191+
192+
# Save with a label
193+
codevista snapshot ./my-project/ --label "before-refactor"
194+
195+
# View trends
196+
codevista trends ./my-project/
197+
198+
# Compare two specific snapshots
199+
codevista diff-snapshots ./my-project/ 1 2
200+
```
201+
202+
### ASCII Timeline Example
203+
204+
```
205+
📈 Health Score Timeline
206+
100 ┤████████████████████
207+
│████████████████████
208+
│████████████████████
209+
│████████████████████
210+
│████████████████████
211+
│████████████████████
212+
│████████████████████
213+
│████████████████████
214+
│████████████████████
215+
│████████████████████
216+
│████████████████████
217+
│████████████████████
218+
0 ┤─────────────────────
219+
Current: 78/100 ↑
220+
```
221+
222+
### Features
223+
224+
- **Trend arrows**: ↑ improving, ↓ degrading, → stable
225+
- **Threshold alerts**: Get warned when health drops or security issues spike
226+
- **Technical debt tracking**: Monitor debt ratio over time
227+
- **Review cadence**: Suggests optimal review frequency based on change rate
228+
- **Code age distribution**: Track how your codebase ages
229+
230+
## 👥 Team Metrics
231+
232+
Analyze developer productivity and collaboration patterns.
233+
234+
```bash
235+
codevista team ./my-project/
236+
```
237+
238+
### What It Analyzes
239+
240+
| Metric | Description |
241+
|--------|-------------|
242+
| **Lines per Author** | Added/removed/net per developer |
243+
| **Commit Frequency** | Commits per day, burst vs steady patterns |
244+
| **Files Touched** | Unique files per author |
245+
| **Bus Factor** | People needed to understand 50% of code |
246+
| **Code Ownership** | Pie chart data showing contribution share |
247+
| **Review Coverage** | Estimate from commit messages |
248+
| **Pair Programming** | Co-authored commit detection |
249+
| **Time Zone Distribution** | When the team commits |
250+
| **Onboarding Complexity** | How hard for a new contributor to ramp up |
251+
172252
## 📤 Export Formats
173253

174254
Export analysis results in multiple formats for different use cases:
@@ -192,6 +272,55 @@ codevista export ./project/ -f sarif -o results.sarif.json
192272
codevista export ./project/ -o ./reports/codevista --all
193273
```
194274

275+
## 🔌 CI/CD Integration
276+
277+
CodeVista provides dedicated CI output formats with threshold-based pass/fail.
278+
279+
### Supported Formats
280+
281+
| Format | Platform | Command |
282+
|--------|----------|---------|
283+
| **SARIF** | GitHub Code Scanning | `codevista ci-output . -f sarif` |
284+
| **GitLab Code Quality** | GitLab | `codevista ci-output . -f gitlab` |
285+
| **Checkstyle XML** | Jenkins, GitHub Actions | `codevista ci-output . -f checkstyle` |
286+
| **JUnit XML** | Any CI with JUnit support | `codevista ci-output . -f junit` |
287+
| **Markdown** | PR comments | `codevista ci-output . -f markdown` |
288+
| **Terminal** | Quick terminal output | `codevista ci-output . -f terminal` |
289+
290+
### Exit Codes
291+
292+
| Code | Meaning | Description |
293+
|------|---------|-------------|
294+
| `0` | Clean | All thresholds passed |
295+
| `1` | Warnings | Medium-severity threshold violations |
296+
| `2` | Errors | High-severity violations (health, complexity) |
297+
| `3` | Critical | Critical security issues or severe degradation |
298+
299+
### Threshold Configuration
300+
301+
Create `.codevista.json` in your project root:
302+
303+
```json
304+
{
305+
"max_security_critical": 0,
306+
"max_security_high": 0,
307+
"max_security_medium": 5,
308+
"max_security_total": 10,
309+
"max_avg_complexity": 10,
310+
"max_technical_debt_ratio": 0.25,
311+
"min_health_score": 60,
312+
"max_duplicates": 10,
313+
"max_circular_deps": 0,
314+
"max_todo_count": 50
315+
}
316+
```
317+
318+
```bash
319+
# Run with exit codes (CI will fail if thresholds violated)
320+
codevista ci-output ./project/ -f sarif -o results.sarif.json
321+
echo "Exit code: $?" # 0=clean, 1=warnings, 2=errors, 3=critical
322+
```
323+
195324
## 🐳 Docker
196325

197326
```bash
@@ -263,6 +392,9 @@ codevista/
263392
├── security.py # Secret/vulnerability scanning
264393
├── dependencies.py # Dependency parsing & analysis
265394
├── git_analysis.py # Git stats extraction
395+
├── trends.py # Trend analysis & snapshot tracking
396+
├── team.py # Team metrics & collaboration analysis
397+
├── integrations.py # CI/CD output (SARIF, Checkstyle, JUnit, GitLab)
266398
├── languages.py # Language definitions & colors
267399
├── config.py # Configuration & ignore patterns
268400
├── utils.py # Utilities & color schemes

SECURITY.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 1.0.x | :white_check_mark: |
8+
| < 1.0 | :x: |
9+
10+
## Reporting a Vulnerability
11+
12+
We take the security of CodeVista seriously. If you believe you have found a
13+
security vulnerability, please report it responsibly.
14+
15+
### How to Report
16+
17+
1. **Do not** open a public issue for the vulnerability.
18+
2. Send an email to [INSERT SECURITY EMAIL] with the subject line
19+
`[Security] CodeVista Vulnerability Report`.
20+
3. Include as much information as possible:
21+
- Description of the vulnerability
22+
- Steps to reproduce
23+
- Potential impact
24+
- Any suggested fixes (optional)
25+
26+
### What to Expect
27+
28+
- We will acknowledge receipt of your report within **48 hours**.
29+
- We will provide an initial assessment within **7 business days**.
30+
- We will keep you updated on the progress of the fix.
31+
- If the vulnerability is accepted, we will release a fix as soon as possible.
32+
33+
### Disclosure Policy
34+
35+
- We follow **Coordinated Disclosure** — we will work with you to determine a
36+
timeline for public disclosure.
37+
- Credit will be given to the reporter (unless anonymity is requested).
38+
- We will not disclose the vulnerability publicly until a fix is released.
39+
40+
## Security Best Practices
41+
42+
When using CodeVista, follow these best practices:
43+
44+
### Input Files
45+
- Only analyze codebases you trust or have permission to analyze.
46+
- CodeVista reads source files — be aware of what you're pointing it at.
47+
48+
### Output Files
49+
- HTML reports contain code excerpts — do not share reports publicly if the
50+
codebase contains sensitive information.
51+
- JSON exports may contain security findings — handle with care.
52+
53+
### Snapshots
54+
- Snapshots are stored in `~/.codevista/snapshots/` — they contain analysis
55+
metadata but not source code content.
56+
- Review snapshot content before sharing.
57+
58+
### CI/CD Integration
59+
- SARIF output may contain file paths and line numbers from your codebase.
60+
- Ensure CI/CD logs are properly secured if your codebase is private.
61+
62+
## Security Features
63+
64+
CodeVista itself includes security scanning capabilities:
65+
66+
- **Secret Detection**: Identifies hardcoded API keys, passwords, tokens
67+
- **Dangerous Function Detection**: Flags `eval()`, `exec()`, `pickle`, etc.
68+
- **Private Key Detection**: Finds private keys committed to source
69+
70+
These features help you secure **your** codebase, not CodeVista itself.

0 commit comments

Comments
 (0)