Analyze PatternFly usage across Red Hat products. Scans repositories for component imports, usage patterns, dependencies, and generates detailed analytics reports.
Static code analysis tool for tracking PatternFly component usage across Red Hat product repositories. Generates comprehensive analytics reports about imports, dependencies, versions, and deprecated components.
Analyzes PatternFly usage across multiple repositories by:
When working with this codebase, follow these guidelines:
1. **Analysis Pipeline**: The core static analysis engine lives in `src/static-analysis/`
- Entry point: `cli.js` orchestrates the collection process
- `getPatternflyStats.js`: Extracts component usage statistics
- `getPackageStats.js`: Analyzes package dependencies and versions
- `getSortedImports.js`: Categorizes and sorts import usage data
- `getDeprecatedComponents.js`: Identifies deprecated component usage
2. **Data Flow**:
- Repository list defined in `repos.json`
- Repositories cloned/updated in `/tmp` directory
- Static analysis modules scan each repository's source code
- Results written to `/stats-static/{YYYY-MM-DD}/` with multiple JSON outputs
- Python script `to_xls.py` converts JSON to Excel reports
3. **Output Files**: Each analysis run creates these files in `/stats-static/{date}/`:
- `_all.json`: Import path usage statistics
- `_all_dependencies.json`: Dependency analysis across products
- `all_pf_versions.json`: PatternFly package versions by repository
- `_all_product_uses.json`: Component usage by product with file locations
- `_all_sorted.json`: Components categorized by PatternFly package
- `_deprecated_usage.json`: Deprecated component usage tracking
4. **Dependents Analysis** (when `-d` flag used):
- `_dependents_analysis.json`: Complete analysis of all PatternFly package dependents
- `_suggested_repos.json`: Prioritized list of repositories to consider adding
- `_dependents_by_package.json`: Summary of missing dependents by PatternFly package
**Data Collection**:
```bash
npm run collect # Run complete analysis pipeline
npm run collect-with-dependents # Run analysis + GitHub dependents analysis
npm run collect -- -c # Clean /tmp directory before collection
npm run collect -- -j -d # Run with package stats and dependents analysis
```
**GitHub Dependents Analysis**:
```bash
npm run analyze-dependents # Compare GitHub dependents with local repos.json
npm run sync-dependents # Create PR to add missing dependents (requires GITHUB_TOKEN)
node src/github-dependents-analyzer.js --repo-url https://github.com/patternfly/patternfly-react
node src/github-dependents-analyzer.js --repo-url https://github.com/patternfly/patternfly-react --create-pr
```
**Report Generation**:
```bash
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
python3 to_xls.py
```
Edit `repos.json` with entries containing:
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/patternfly-analytics/raw