git-repo-analyzer-test 1.0.0
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.
- package/.github/copilot-instructions.md +108 -0
- package/.idea/aianalyzer.iml +9 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/API_REFERENCE.md +244 -0
- package/ENHANCEMENTS.md +282 -0
- package/README.md +179 -0
- package/USAGE.md +189 -0
- package/analysis.txt +0 -0
- package/bin/cli.js +135 -0
- package/docs/SONARCLOUD_ANALYSIS_COVERED.md +144 -0
- package/docs/SonarCloud_Presentation_Points.md +81 -0
- package/docs/UI_IMPROVEMENTS.md +117 -0
- package/package-lock_cmd.json +542 -0
- package/package.json +44 -0
- package/package_command.json +16 -0
- package/public/analysis-options.json +31 -0
- package/public/images/README.txt +2 -0
- package/public/images/rws-logo.png +0 -0
- package/public/index.html +2433 -0
- package/repositories.example.txt +17 -0
- package/sample-repos.txt +20 -0
- package/src/analyzers/accessibility.js +47 -0
- package/src/analyzers/cicd-enhanced.js +113 -0
- package/src/analyzers/codeReview-enhanced.js +599 -0
- package/src/analyzers/codeReview-enhanced.js:Zone.Identifier +3 -0
- package/src/analyzers/codeReview.js +171 -0
- package/src/analyzers/codeReview.js:Zone.Identifier +3 -0
- package/src/analyzers/documentation-enhanced.js +137 -0
- package/src/analyzers/performance-enhanced.js +747 -0
- package/src/analyzers/performance-enhanced.js:Zone.Identifier +3 -0
- package/src/analyzers/performance.js +211 -0
- package/src/analyzers/performance.js:Zone.Identifier +3 -0
- package/src/analyzers/performance_cmd.js +216 -0
- package/src/analyzers/quality-enhanced.js +386 -0
- package/src/analyzers/quality-enhanced.js:Zone.Identifier +3 -0
- package/src/analyzers/quality.js +92 -0
- package/src/analyzers/quality.js:Zone.Identifier +3 -0
- package/src/analyzers/security-enhanced.js +512 -0
- package/src/analyzers/security-enhanced.js:Zone.Identifier +3 -0
- package/src/analyzers/snyk-ai.js:Zone.Identifier +3 -0
- package/src/analyzers/sonarcloud.js +928 -0
- package/src/analyzers/vulnerability.js +185 -0
- package/src/analyzers/vulnerability.js:Zone.Identifier +3 -0
- package/src/cli.js:Zone.Identifier +3 -0
- package/src/config.js +43 -0
- package/src/core/analyzerEngine.js +68 -0
- package/src/core/reportGenerator.js +21 -0
- package/src/gemini.js +321 -0
- package/src/github/client.js +124 -0
- package/src/github/client.js:Zone.Identifier +3 -0
- package/src/index.js +93 -0
- package/src/index_cmd.js +130 -0
- package/src/openai.js +297 -0
- package/src/report/generator.js +459 -0
- package/src/report/generator_cmd.js +459 -0
- package/src/report/pdf-generator.js +387 -0
- package/src/report/pdf-generator.js:Zone.Identifier +3 -0
- package/src/server.js +431 -0
- package/src/server.js:Zone.Identifier +3 -0
- package/src/server_cmd.js +434 -0
- package/src/sonarcloud/client.js +365 -0
- package/src/sonarcloud/scanner.js +171 -0
- package/src.zip +0 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# GitHub Repository Analyzer - Copilot Instructions
|
|
2
|
+
|
|
3
|
+
- [x] Create copilot-instructions.md file in .github directory
|
|
4
|
+
- [x] Scaffold the Node.js Project
|
|
5
|
+
- [x] Customize the Project with analysis modules
|
|
6
|
+
- [x] Install Required Dependencies
|
|
7
|
+
- [x] Verify Project Compilation and Setup
|
|
8
|
+
- [x] Create and Document the Project
|
|
9
|
+
- [x] Ensure Documentation is Complete
|
|
10
|
+
|
|
11
|
+
## Project Overview
|
|
12
|
+
|
|
13
|
+
Git Repository Analyzer is a comprehensive Node.js tool that analyzes GitHub repositories across four critical dimensions:
|
|
14
|
+
|
|
15
|
+
1. **Code Quality**: Stars, forks, issues, documentation, activity
|
|
16
|
+
2. **Security & Vulnerabilities**: Risk assessment, security features, maintenance status
|
|
17
|
+
3. **Code Review & Collaboration**: PR metrics, review velocity, team collaboration
|
|
18
|
+
4. **Performance & Releases**: Release frequency, development velocity, code activity
|
|
19
|
+
|
|
20
|
+
## Key Features Implemented
|
|
21
|
+
|
|
22
|
+
✓ GitHub API client for repository data collection
|
|
23
|
+
✓ Quality analysis engine with comprehensive metrics
|
|
24
|
+
✓ Vulnerability and security risk assessment
|
|
25
|
+
✓ Code review and collaboration analyzer
|
|
26
|
+
✓ Performance and release pattern analysis
|
|
27
|
+
✓ Formatted console reports with visual indicators
|
|
28
|
+
✓ JSON report export capability
|
|
29
|
+
✓ Batch analysis support for multiple repositories
|
|
30
|
+
✓ CLI interface with Commander.js
|
|
31
|
+
|
|
32
|
+
## Project Structure
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
src/
|
|
36
|
+
├── index.js # Main analysis entry point
|
|
37
|
+
├── cli.js # Command-line interface
|
|
38
|
+
├── github/
|
|
39
|
+
│ └── client.js # GitHub API wrapper
|
|
40
|
+
├── analyzers/
|
|
41
|
+
│ ├── quality.js # Code quality analyzer
|
|
42
|
+
│ ├── vulnerability.js # Security analyzer
|
|
43
|
+
│ ├── codeReview.js # Code review metrics
|
|
44
|
+
│ └── performance.js # Performance analyzer
|
|
45
|
+
└── report/
|
|
46
|
+
└── generator.js # Report formatting and generation
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Installation Complete
|
|
50
|
+
|
|
51
|
+
All dependencies installed successfully (137 packages):
|
|
52
|
+
- axios: HTTP client for API calls
|
|
53
|
+
- dotenv: Environment variable management
|
|
54
|
+
- commander: CLI framework
|
|
55
|
+
- chalk: Terminal colors and formatting
|
|
56
|
+
- table: Formatted table output
|
|
57
|
+
- eslint & prettier: Code quality tools
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
Add your GitHub personal access token to `.env` file for authenticated requests:
|
|
62
|
+
```
|
|
63
|
+
GITHUB_TOKEN=your_token_here
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Usage Commands
|
|
67
|
+
|
|
68
|
+
**Single Repository Analysis:**
|
|
69
|
+
```bash
|
|
70
|
+
npm run analyze -- analyze owner/repo
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Save Report to File:**
|
|
74
|
+
```bash
|
|
75
|
+
npm run analyze -- analyze owner/repo --output ./reports/report.json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Batch Analysis:**
|
|
79
|
+
```bash
|
|
80
|
+
npm run analyze -- batch repos.txt --output-dir ./reports
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**View Configuration Help:**
|
|
84
|
+
```bash
|
|
85
|
+
npm run analyze -- config
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Testing Results
|
|
89
|
+
|
|
90
|
+
✓ Successfully tested with vuejs/vue repository
|
|
91
|
+
✓ All four analyzers working correctly
|
|
92
|
+
✓ Report generation functioning as expected
|
|
93
|
+
✓ Console output formatting verified
|
|
94
|
+
✓ Error handling operational
|
|
95
|
+
|
|
96
|
+
## Next Steps for Users
|
|
97
|
+
|
|
98
|
+
1. Set GitHub token in `.env` for full API access
|
|
99
|
+
2. Run analysis on target repositories
|
|
100
|
+
3. Review generated reports
|
|
101
|
+
4. Export reports to JSON for further processing
|
|
102
|
+
5. Use batch mode for analyzing multiple repositories
|
|
103
|
+
|
|
104
|
+
## Project Status
|
|
105
|
+
|
|
106
|
+
✅ **COMPLETE AND READY TO USE**
|
|
107
|
+
|
|
108
|
+
The project is fully functional and can begin analyzing GitHub repositories immediately.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
6
|
+
<orderEntry type="inheritedJdk" />
|
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
+
</component>
|
|
9
|
+
</module>
|
package/.idea/misc.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
|
|
4
|
+
<output url="file://$PROJECT_DIR$/out" />
|
|
5
|
+
</component>
|
|
6
|
+
</project>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/aianalyzer.iml" filepath="$PROJECT_DIR$/.idea/aianalyzer.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
package/API_REFERENCE.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
## Classes and Methods
|
|
4
|
+
|
|
5
|
+
### GitHubClient
|
|
6
|
+
|
|
7
|
+
GitHub API wrapper for fetching repository data.
|
|
8
|
+
|
|
9
|
+
#### Methods
|
|
10
|
+
|
|
11
|
+
- `getRepository(owner, repo)` - Get basic repository information
|
|
12
|
+
- `getCommits(owner, repo, options)` - Fetch commit history
|
|
13
|
+
- `getPullRequests(owner, repo, options)` - Fetch pull requests
|
|
14
|
+
- `getIssues(owner, repo, options)` - Fetch issues
|
|
15
|
+
- `getCodeFrequency(owner, repo)` - Get code frequency statistics
|
|
16
|
+
- `getContributors(owner, repo)` - Get list of contributors
|
|
17
|
+
- `getLanguages(owner, repo)` - Get programming languages used
|
|
18
|
+
- `getReleases(owner, repo)` - Get release history
|
|
19
|
+
|
|
20
|
+
### QualityAnalyzer
|
|
21
|
+
|
|
22
|
+
Analyzes code quality metrics of a repository.
|
|
23
|
+
|
|
24
|
+
#### Method
|
|
25
|
+
- `analyzeCodeQuality(owner, repo)` - Returns quality score and metrics
|
|
26
|
+
|
|
27
|
+
#### Score Factors (0-100)
|
|
28
|
+
- Stars contribution: 0-15 points
|
|
29
|
+
- Forks contribution: 0-10 points
|
|
30
|
+
- Issues management: 0-10 points
|
|
31
|
+
- Documentation: 0-10 points
|
|
32
|
+
- Activity level: 0-10 points
|
|
33
|
+
- Base score: 50 points
|
|
34
|
+
|
|
35
|
+
### VulnerabilityAnalyzer
|
|
36
|
+
|
|
37
|
+
Assesses security risks and vulnerabilities.
|
|
38
|
+
|
|
39
|
+
#### Method
|
|
40
|
+
- `analyzeVulnerabilities(owner, repo)` - Returns risk level and recommendations
|
|
41
|
+
|
|
42
|
+
#### Risk Levels
|
|
43
|
+
- **Critical**: Score ≥ 75
|
|
44
|
+
- **High**: Score ≥ 50
|
|
45
|
+
- **Medium**: Score ≥ 25
|
|
46
|
+
- **Low**: Score < 25
|
|
47
|
+
|
|
48
|
+
#### Risk Factors Checked
|
|
49
|
+
- Repository archival status
|
|
50
|
+
- Security scanning enabled
|
|
51
|
+
- Dependabot updates
|
|
52
|
+
- Age since last update
|
|
53
|
+
- Open issues count
|
|
54
|
+
- Documentation coverage
|
|
55
|
+
- Public/private status
|
|
56
|
+
|
|
57
|
+
### CodeReviewAnalyzer
|
|
58
|
+
|
|
59
|
+
Analyzes code review practices and collaboration metrics.
|
|
60
|
+
|
|
61
|
+
#### Method
|
|
62
|
+
- `analyzeCodeReview(owner, repo)` - Returns collaboration score and metrics
|
|
63
|
+
|
|
64
|
+
#### Collaboration Score Factors (0-100)
|
|
65
|
+
- Contributors count: 0-20 points
|
|
66
|
+
- Pull request activity: 0-20 points
|
|
67
|
+
- PR closure rate: 0-20 points
|
|
68
|
+
- Recent activity: 0-20 points
|
|
69
|
+
- Base score: 50 points
|
|
70
|
+
|
|
71
|
+
#### Metrics Provided
|
|
72
|
+
- Total pull requests
|
|
73
|
+
- PR closure rate
|
|
74
|
+
- Average review time (hours)
|
|
75
|
+
- Contributor count
|
|
76
|
+
- Commit patterns
|
|
77
|
+
- Unique authors
|
|
78
|
+
|
|
79
|
+
### PerformanceAnalyzer
|
|
80
|
+
|
|
81
|
+
Analyzes performance metrics and release patterns.
|
|
82
|
+
|
|
83
|
+
#### Method
|
|
84
|
+
- `analyzePerformance(owner, repo)` - Returns performance score and metrics
|
|
85
|
+
|
|
86
|
+
#### Performance Score Factors (0-100)
|
|
87
|
+
- Release frequency: 0-30 points
|
|
88
|
+
- Code activity: 0-20 points
|
|
89
|
+
- Repository size/maturity: 0-20 points
|
|
90
|
+
- Network metrics (forks + watchers): 0-30 points
|
|
91
|
+
- Base score: 50 points
|
|
92
|
+
|
|
93
|
+
#### Release Frequency Categories
|
|
94
|
+
- Very High: ≥24 releases per year (2+ per month)
|
|
95
|
+
- High: ≥12 releases per year (1+ per month)
|
|
96
|
+
- Medium: ≥4 releases per year (1 per quarter)
|
|
97
|
+
- Low: >0 releases
|
|
98
|
+
- None: No releases
|
|
99
|
+
|
|
100
|
+
### ReportGenerator
|
|
101
|
+
|
|
102
|
+
Generates formatted reports from analysis data.
|
|
103
|
+
|
|
104
|
+
#### Static Methods
|
|
105
|
+
|
|
106
|
+
- `generateReport(repoName, analysis)` - Generate JSON report object
|
|
107
|
+
- `generateTextReport(repoName, analysis)` - Generate console-formatted report
|
|
108
|
+
- `generateSummary(analysis)` - Generate summary with overall scores
|
|
109
|
+
|
|
110
|
+
#### Report Output Includes
|
|
111
|
+
- Timestamp
|
|
112
|
+
- Repository name
|
|
113
|
+
- Overall score (0-100)
|
|
114
|
+
- Summary health status
|
|
115
|
+
- Detailed analysis for all dimensions
|
|
116
|
+
- Recommendations and key takeaways
|
|
117
|
+
|
|
118
|
+
## Return Data Structures
|
|
119
|
+
|
|
120
|
+
### Quality Analysis
|
|
121
|
+
```javascript
|
|
122
|
+
{
|
|
123
|
+
score: 94,
|
|
124
|
+
metrics: {
|
|
125
|
+
stars: 209903,
|
|
126
|
+
forks: 33899,
|
|
127
|
+
watchers: 209903,
|
|
128
|
+
openIssues: 619,
|
|
129
|
+
hasWiki: boolean,
|
|
130
|
+
hasPages: boolean,
|
|
131
|
+
languages: 5,
|
|
132
|
+
primaryLanguage: "TypeScript",
|
|
133
|
+
lastUpdate: "2026-02-10T...",
|
|
134
|
+
daysInactive: 0,
|
|
135
|
+
description: "...",
|
|
136
|
+
topics: ["framework", "frontend", ...]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Vulnerability Analysis
|
|
142
|
+
```javascript
|
|
143
|
+
{
|
|
144
|
+
score: 50,
|
|
145
|
+
riskLevel: "High",
|
|
146
|
+
riskFactors: [
|
|
147
|
+
"High number of open issues (619)",
|
|
148
|
+
"Repository is public - ensure no sensitive data",
|
|
149
|
+
...
|
|
150
|
+
],
|
|
151
|
+
recommendations: [
|
|
152
|
+
"Enable GitHub security features...",
|
|
153
|
+
...
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Code Review Analysis
|
|
159
|
+
```javascript
|
|
160
|
+
{
|
|
161
|
+
score: 100,
|
|
162
|
+
reviewMetrics: {
|
|
163
|
+
totalPullRequests: 100,
|
|
164
|
+
mergedPullRequests: 3,
|
|
165
|
+
openPullRequests: 29,
|
|
166
|
+
prClosureRate: 71,
|
|
167
|
+
averageReviewTimeHours: 8
|
|
168
|
+
},
|
|
169
|
+
commitMetrics: {
|
|
170
|
+
totalCommits: 100,
|
|
171
|
+
uniqueAuthors: 35,
|
|
172
|
+
averageCommitSize: 1234,
|
|
173
|
+
commitFrequency: "Active"
|
|
174
|
+
},
|
|
175
|
+
contributors: 100,
|
|
176
|
+
recommendations: [...]
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Performance Analysis
|
|
181
|
+
```javascript
|
|
182
|
+
{
|
|
183
|
+
score: 100,
|
|
184
|
+
releaseMetrics: {
|
|
185
|
+
totalReleases: 100,
|
|
186
|
+
preReleases: 27,
|
|
187
|
+
draftReleases: 0,
|
|
188
|
+
averageDaysBetweenReleases: 55,
|
|
189
|
+
releaseFrequency: "Very High (2+ per month)"
|
|
190
|
+
},
|
|
191
|
+
developmentVelocity: {
|
|
192
|
+
trend: "increasing|decreasing|stable|unknown",
|
|
193
|
+
additionsPerWeek: 1234,
|
|
194
|
+
deletionsPerWeek: 567,
|
|
195
|
+
netChangePerWeek: 667
|
|
196
|
+
},
|
|
197
|
+
recommendations: [...]
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Usage Example
|
|
202
|
+
|
|
203
|
+
```javascript
|
|
204
|
+
import { GitHubClient } from './src/github/client.js';
|
|
205
|
+
import QualityAnalyzer from './src/analyzers/quality.js';
|
|
206
|
+
|
|
207
|
+
const client = new GitHubClient();
|
|
208
|
+
const analyzer = new QualityAnalyzer(client);
|
|
209
|
+
|
|
210
|
+
const analysis = await analyzer.analyzeCodeQuality('facebook', 'react');
|
|
211
|
+
console.log(analysis.score); // 94
|
|
212
|
+
console.log(analysis.metrics); // { stars: ..., forks: ..., ... }
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Error Handling
|
|
216
|
+
|
|
217
|
+
All analyzers throw errors with descriptive messages:
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
try {
|
|
221
|
+
const analysis = await analyzer.analyzeCodeQuality('invalid', 'repo');
|
|
222
|
+
} catch (error) {
|
|
223
|
+
console.error(error.message);
|
|
224
|
+
// "Quality analysis failed: Request failed with status code 404"
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Rate Limiting
|
|
229
|
+
|
|
230
|
+
GitHub API rate limits:
|
|
231
|
+
- Without token: 60 requests/hour
|
|
232
|
+
- With token: 5000 requests/hour
|
|
233
|
+
|
|
234
|
+
Implement token in `.env`:
|
|
235
|
+
```
|
|
236
|
+
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Performance Notes
|
|
240
|
+
|
|
241
|
+
- Single repository analysis: 3-5 seconds
|
|
242
|
+
- API calls made: 4-6 (one per analyzer)
|
|
243
|
+
- No data is cached
|
|
244
|
+
- Fresh data obtained on each run
|
package/ENHANCEMENTS.md
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# GitHub Repository Analyzer - Enhanced Version
|
|
2
|
+
|
|
3
|
+
## Comprehensive Enhancements Summary
|
|
4
|
+
|
|
5
|
+
### Phase 1: Enhanced Analyzers Implementation
|
|
6
|
+
|
|
7
|
+
Successfully implemented four comprehensive analyzers with detailed scoring systems:
|
|
8
|
+
|
|
9
|
+
#### 1. **Code Quality Analyzer (`quality-enhanced.js`)**
|
|
10
|
+
- **Scoring System**: 0-10 point scale with letter grades (A+ to F)
|
|
11
|
+
- **Issue Detection** (8 categories):
|
|
12
|
+
- ARCHIVED_REPOSITORY (HIGH severity)
|
|
13
|
+
- NO_LICENSE (MEDIUM severity)
|
|
14
|
+
- STALE_CODEBASE (MEDIUM severity) - tracks >1 year inactive
|
|
15
|
+
- UNRESOLVED_ISSUES (MEDIUM severity) - tracks specific count
|
|
16
|
+
- POOR_DOCUMENTATION (MEDIUM severity)
|
|
17
|
+
- EXCESSIVE_LANGUAGES (LOW severity) - >8 languages
|
|
18
|
+
- NO_PRIMARY_LANGUAGE (LOW severity)
|
|
19
|
+
- LARGE_REPOSITORY (LOW severity)
|
|
20
|
+
- **Analysis Dimensions**:
|
|
21
|
+
- Identifies code quality issues with specific locations
|
|
22
|
+
- Code standards analysis (linter, formatter, test, build, CI/CD detection)
|
|
23
|
+
- Library audit with package manager analysis
|
|
24
|
+
- Documentation quality assessment (12-point scale)
|
|
25
|
+
- Maintenance status classification (Active/Moderate/Dormant/Inactive)
|
|
26
|
+
- **Scoring Calculation**:
|
|
27
|
+
- Base: 100 points → Normalized to 0-10
|
|
28
|
+
- Deductions: HIGH -20, MEDIUM -10, LOW -3
|
|
29
|
+
- Bonuses for good practices (+3 for license, +2 for wiki/pages)
|
|
30
|
+
|
|
31
|
+
#### 2. **Security Analyzer (`security-enhanced.js`)**
|
|
32
|
+
- **OWASP Top 10 Coverage** (A01-A10):
|
|
33
|
+
- A01: Broken Access Control (HIGH, 7 points)
|
|
34
|
+
- A02: Cryptographic Failures (CRITICAL, 9 points)
|
|
35
|
+
- A03: Injection (HIGH, 8 points)
|
|
36
|
+
- A04: Insecure Design (MEDIUM, 6 points)
|
|
37
|
+
- A05: Security Misconfiguration (HIGH, 7 points)
|
|
38
|
+
- A06: Vulnerable & Outdated Components (HIGH, 8 points)
|
|
39
|
+
- A07: Authentication & Session Management (MEDIUM, 6 points)
|
|
40
|
+
- A08: Software & Data Integrity (MEDIUM, 5 points)
|
|
41
|
+
- A09: Logging & Monitoring (MEDIUM, 5 points)
|
|
42
|
+
- A10: Server-Side Request Forgery (MEDIUM, 5 points)
|
|
43
|
+
- **Detailed Vulnerability Information**:
|
|
44
|
+
- Rank, severity, title, description
|
|
45
|
+
- Specific fault locations
|
|
46
|
+
- Indicators of vulnerability
|
|
47
|
+
- Detailed remediation steps (3-5 per vulnerability)
|
|
48
|
+
- Scoring impact per vulnerability
|
|
49
|
+
- **Security Features Assessment**:
|
|
50
|
+
- Secret scanning status
|
|
51
|
+
- Dependabot security updates
|
|
52
|
+
- Branch protection rules
|
|
53
|
+
- CodeQL analysis
|
|
54
|
+
- License presence
|
|
55
|
+
- **Risk Levels**: CRITICAL (<40), HIGH (40-60), MEDIUM (60-80), LOW (80+)
|
|
56
|
+
- **Scoring**: 0-10 point scale with A+ to F ratings
|
|
57
|
+
|
|
58
|
+
#### 3. **Code Review Analyzer (`codeReview-enhanced.js`)**
|
|
59
|
+
- **Review Metrics**:
|
|
60
|
+
- Total PRs, closed, open, merged, draft counts
|
|
61
|
+
- Average review time (hours)
|
|
62
|
+
- PR closure rate percentage
|
|
63
|
+
- Approval rate tracking
|
|
64
|
+
- **Coding Style Analysis**:
|
|
65
|
+
- Commit convention adherence percentage (conventional vs total)
|
|
66
|
+
- Commit message quality assessment
|
|
67
|
+
- Primary language identification
|
|
68
|
+
- Recommendations for standards compliance
|
|
69
|
+
- **Collaboration Metrics**:
|
|
70
|
+
- Contributor count and activity levels
|
|
71
|
+
- Core team size identification
|
|
72
|
+
- Team diversity calculation
|
|
73
|
+
- Collaboration health assessment
|
|
74
|
+
- **Code Standards**:
|
|
75
|
+
- Language-specific linter/formatter recommendations
|
|
76
|
+
- Testing framework suggestions
|
|
77
|
+
- CI/CD and build configuration checks
|
|
78
|
+
- **Pull Request Patterns**:
|
|
79
|
+
- Average PR size tracking
|
|
80
|
+
- Largest/smallest PRs identified
|
|
81
|
+
- PR status breakdown
|
|
82
|
+
- **Scoring**: 0-10 point scale based on PR velocity, review quality, contributor engagement
|
|
83
|
+
|
|
84
|
+
#### 4. **Performance Analyzer (`performance-enhanced.js`)**
|
|
85
|
+
- **Release Velocity Analysis**:
|
|
86
|
+
- Total releases and pre-releases count
|
|
87
|
+
- Releases per year calculation
|
|
88
|
+
- Release cadence determination
|
|
89
|
+
- Days since last release
|
|
90
|
+
- Release status (RECENT/CURRENT/AGING/STALE)
|
|
91
|
+
- **Development Velocity**:
|
|
92
|
+
- Total additions/deletions tracking
|
|
93
|
+
- Net code changes calculation
|
|
94
|
+
- Average lines per commit
|
|
95
|
+
- Recent activity assessment
|
|
96
|
+
- Code stability evaluation (additions vs deletions ratio)
|
|
97
|
+
- **Release Quality**:
|
|
98
|
+
- Assets per release average
|
|
99
|
+
- Documentation percentage (release notes quality)
|
|
100
|
+
- Changelog presence detection
|
|
101
|
+
- Release automation detection
|
|
102
|
+
- **Maintenance Pattern**:
|
|
103
|
+
- Days since last commit
|
|
104
|
+
- Maintenance level classification (ACTIVE/MODERATE/DORMANT/INACTIVE)
|
|
105
|
+
- Projected maintenance health
|
|
106
|
+
- Update frequency analysis
|
|
107
|
+
- Sustainability assessment
|
|
108
|
+
- **Scoring**: 0-10 point scale with A+ to F ratings
|
|
109
|
+
|
|
110
|
+
### Phase 2: User Interface Enhancements
|
|
111
|
+
|
|
112
|
+
#### Enhanced Web Interface (`public/index.html`)
|
|
113
|
+
- **Comprehensive Score Display**:
|
|
114
|
+
- Overall repository score (0-100) with rating (A+ to F)
|
|
115
|
+
- Individual section scores (0-10 each) with corresponding ratings
|
|
116
|
+
- Visual score bars showing percentage
|
|
117
|
+
- Color-coded cards (green for excellent, red for poor)
|
|
118
|
+
- **Detailed Results Display**:
|
|
119
|
+
1. **Code Quality Section**:
|
|
120
|
+
- Quality issues list with severity levels
|
|
121
|
+
- Issue locations and specific recommendations
|
|
122
|
+
- Quality metrics grid
|
|
123
|
+
2. **Security Section**:
|
|
124
|
+
- Risk level indicator (CRITICAL/HIGH/MEDIUM/LOW)
|
|
125
|
+
- OWASP Top 10 findings with detailed information
|
|
126
|
+
- Remediation steps for each vulnerability
|
|
127
|
+
- Security feature status
|
|
128
|
+
3. **Code Review Section**:
|
|
129
|
+
- PR metrics and collaboration statistics
|
|
130
|
+
- Commit convention adherence percentage
|
|
131
|
+
- Team dynamics and contributor information
|
|
132
|
+
4. **Performance Section**:
|
|
133
|
+
- Release velocity and cadence metrics
|
|
134
|
+
- Maintenance status and health assessment
|
|
135
|
+
- Development activity indicators
|
|
136
|
+
|
|
137
|
+
- **User Experience Features**:
|
|
138
|
+
- Quick example buttons for popular repositories
|
|
139
|
+
- Loading spinner during analysis
|
|
140
|
+
- Error display with clear messages
|
|
141
|
+
- Responsive grid layout
|
|
142
|
+
- Color-coded severity badges
|
|
143
|
+
- Collapsible recommendation sections
|
|
144
|
+
- PDF export functionality preserved
|
|
145
|
+
|
|
146
|
+
### Phase 3: Report Generation Updates
|
|
147
|
+
|
|
148
|
+
#### Updated Report Generator (`src/report/generator.js`)
|
|
149
|
+
- **Consolidated Scoring**:
|
|
150
|
+
- Displays scores out of 10 (not 100)
|
|
151
|
+
- Shows letter grades for each section
|
|
152
|
+
- Overall rating based on average of all sections
|
|
153
|
+
- **Enhanced Text Reports**:
|
|
154
|
+
- Quality analysis with issue severity breakdown
|
|
155
|
+
- Security findings with OWASP details
|
|
156
|
+
- Code review collaboration metrics
|
|
157
|
+
- Performance and maintenance status
|
|
158
|
+
- Formatted tables for easy reading
|
|
159
|
+
- **Summary Statistics**:
|
|
160
|
+
- Per-section scores and ratings
|
|
161
|
+
- Risk level indicators
|
|
162
|
+
- Maintenance status
|
|
163
|
+
- Actionable recommendations
|
|
164
|
+
|
|
165
|
+
### Phase 4: System Integration
|
|
166
|
+
|
|
167
|
+
#### Updated Main Analyzer (`src/index.js`)
|
|
168
|
+
- Imports all four enhanced analyzers
|
|
169
|
+
- Runs analyzers sequentially with error handling
|
|
170
|
+
- Provides detailed error messages for each analyzer
|
|
171
|
+
- Generates comprehensive reports with new scoring format
|
|
172
|
+
|
|
173
|
+
#### API Endpoints (Maintained)
|
|
174
|
+
- `GET /` - Serves enhanced HTML interface
|
|
175
|
+
- `POST /api/analyze` - Processes repository analysis with enhanced analyzers
|
|
176
|
+
- `POST /api/export-pdf` - Generates PDF with new scoring format
|
|
177
|
+
|
|
178
|
+
### Scoring System Details
|
|
179
|
+
|
|
180
|
+
#### 10-Point Scoring Per Section
|
|
181
|
+
All four analyzers use a 0-10 point scale:
|
|
182
|
+
- **90+ (A+)**: Excellent - Highly recommended
|
|
183
|
+
- **80-90 (A)**: Very Good - Strong implementation
|
|
184
|
+
- **70-80 (B+)**: Good - Meets standards
|
|
185
|
+
- **60-70 (B)**: Fair - Some improvements needed
|
|
186
|
+
- **50-60 (C+)**: Needs Work - Multiple issues
|
|
187
|
+
- **40-50 (C)**: Poor - Significant concerns
|
|
188
|
+
- **<40 (F)**: Critical - Urgent action needed
|
|
189
|
+
|
|
190
|
+
#### Overall Rating Calculation
|
|
191
|
+
Average of all four section scores:
|
|
192
|
+
- Overall = (Quality + Security + CodeReview + Performance) / 4
|
|
193
|
+
- Then converted to letter grade using same scale
|
|
194
|
+
|
|
195
|
+
### New Features Implemented
|
|
196
|
+
|
|
197
|
+
✅ **Issue Localization**: All findings include specific locations (files, configuration areas, etc.)
|
|
198
|
+
✅ **Actionable Recommendations**: 3-5 detailed remediation steps per finding
|
|
199
|
+
✅ **OWASP Top 10 Mapping**: Security vulnerabilities mapped to specific OWASP categories
|
|
200
|
+
✅ **Severity Classification**: All issues categorized as CRITICAL, HIGH, MEDIUM, or LOW
|
|
201
|
+
✅ **Comprehensive Metrics**: Detailed metrics for all four analysis dimensions
|
|
202
|
+
✅ **Visual Scoring Display**: Color-coded cards with progress bars for each metric
|
|
203
|
+
✅ **Detailed PDF Export**: PDF reports now include all enhanced analysis details
|
|
204
|
+
✅ **CLI Support**: Command-line interface works with new analyzers
|
|
205
|
+
|
|
206
|
+
### Testing & Validation
|
|
207
|
+
|
|
208
|
+
- ✅ All analyzers tested independently with sample repositories
|
|
209
|
+
- ✅ Full integration tested (all 4 analyzers running in sequence)
|
|
210
|
+
- ✅ Report generation validated with enhanced scoring format
|
|
211
|
+
- ✅ Web UI tested and displays new scoring format correctly
|
|
212
|
+
- ✅ PDF export functionality verified
|
|
213
|
+
- ✅ Error handling implemented for each analyzer
|
|
214
|
+
|
|
215
|
+
### Files Modified/Created
|
|
216
|
+
|
|
217
|
+
**Created:**
|
|
218
|
+
- `src/analyzers/quality-enhanced.js` - 350+ lines
|
|
219
|
+
- `src/analyzers/security-enhanced.js` - 450+ lines
|
|
220
|
+
- `src/analyzers/codeReview-enhanced.js` - 600+ lines
|
|
221
|
+
- `src/analyzers/performance-enhanced.js` - 750+ lines
|
|
222
|
+
|
|
223
|
+
**Modified:**
|
|
224
|
+
- `src/index.js` - Updated to use enhanced analyzers
|
|
225
|
+
- `src/report/generator.js` - Updated for 0-10 scoring system
|
|
226
|
+
- `public/index.html` - Complete redesign for new scoring display
|
|
227
|
+
|
|
228
|
+
### Performance Metrics
|
|
229
|
+
|
|
230
|
+
- Average analysis time: ~3-5 seconds per repository
|
|
231
|
+
- GitHub API calls: ~15-20 per analysis
|
|
232
|
+
- Generated report size: ~50-100KB JSON
|
|
233
|
+
- PDF report generation: ~2-3 seconds
|
|
234
|
+
|
|
235
|
+
### Future Enhancements
|
|
236
|
+
|
|
237
|
+
Potential additions:
|
|
238
|
+
- Machine learning-based score predictions
|
|
239
|
+
- Historical trend analysis
|
|
240
|
+
- Comparative analysis between repositories
|
|
241
|
+
- Custom scoring weights
|
|
242
|
+
- Integration with CI/CD pipelines
|
|
243
|
+
- Batch analysis with progress tracking
|
|
244
|
+
- Advanced filtering and sorting of findings
|
|
245
|
+
- Custom report templates
|
|
246
|
+
|
|
247
|
+
### Usage Examples
|
|
248
|
+
|
|
249
|
+
**CLI Analysis:**
|
|
250
|
+
```bash
|
|
251
|
+
npm run analyze -- analyze owner/repo
|
|
252
|
+
npm run analyze -- analyze owner/repo --output ./report.json
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Web Interface:**
|
|
256
|
+
1. Navigate to http://localhost:3000
|
|
257
|
+
2. Enter repository URL or owner/repo format
|
|
258
|
+
3. Click "Analyze" button
|
|
259
|
+
4. View detailed analysis results
|
|
260
|
+
5. Export to PDF using "Export to PDF" button
|
|
261
|
+
|
|
262
|
+
**Batch Analysis:**
|
|
263
|
+
```bash
|
|
264
|
+
npm run analyze -- batch repos.txt --output-dir ./reports
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Summary
|
|
270
|
+
|
|
271
|
+
The GitHub Repository Analyzer has been successfully enhanced with comprehensive analysis capabilities including:
|
|
272
|
+
|
|
273
|
+
- **10-point scoring system** across 4 critical dimensions
|
|
274
|
+
- **OWASP Top 10 vulnerability mapping** with detailed remediation
|
|
275
|
+
- **Specific issue locations** for all findings
|
|
276
|
+
- **Actionable recommendations** with implementation steps
|
|
277
|
+
- **Enhanced web UI** with color-coded scoring display
|
|
278
|
+
- **Detailed PDF export** with full analysis results
|
|
279
|
+
- **Letter grade ratings** (A+ to F) for easy interpretation
|
|
280
|
+
|
|
281
|
+
The system now provides organizations with actionable, detailed insights into their GitHub repositories' quality, security, collaboration practices, and release velocity - enabling data-driven decisions for continuous improvement.
|
|
282
|
+
|