class-metrix 1.0.1 → 1.1.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.
- checksums.yaml +4 -4
- data/.prettierrc.json +41 -0
- data/.qlty/.gitignore +7 -0
- data/.qlty/configs/.yamllint.yaml +8 -0
- data/.qlty/qlty.toml +108 -0
- data/.rubocop.yml +31 -25
- data/.vscode/README.md +230 -78
- data/.vscode/extensions.json +1 -9
- data/.vscode/keybindings.json +0 -26
- data/.vscode/settings.json +57 -11
- data/.vscode/tasks.json +90 -0
- data/CHANGELOG.md +31 -1
- data/README.md +63 -9
- data/Rakefile +64 -1
- data/config/brakeman.yml +37 -0
- data/docs/ARCHITECTURE.md +90 -48
- data/docs/QLTY_INTEGRATION.md +181 -0
- data/docs/RELEASE_GUIDE.md +318 -0
- data/docs/SLACK_INTEGRATION.md +227 -0
- data/examples/README.md +23 -17
- data/examples/basic_usage.rb +19 -19
- data/examples/debug_levels_demo.rb +15 -16
- data/examples/debug_mode_demo.rb +12 -13
- data/examples/inheritance_and_modules.rb +45 -45
- data/lib/class_metrix/version.rb +1 -1
- data/sig/manifest.yaml +12 -12
- metadata +52 -4
- data/.vscode/rbs.code-snippets +0 -61
- data/RELEASE_GUIDE.md +0 -158
data/.vscode/extensions.json
CHANGED
|
@@ -4,17 +4,13 @@
|
|
|
4
4
|
"shopify.ruby-lsp",
|
|
5
5
|
|
|
6
6
|
// RBS and Steep support (type checking)
|
|
7
|
-
"soutaro.rbs-syntax",
|
|
8
7
|
"soutaro.steep-vscode",
|
|
9
|
-
"mateuszdrewniak.rbs-snippets",
|
|
10
8
|
|
|
11
9
|
// Debugging support
|
|
12
10
|
"koichisasada.vscode-rdbg",
|
|
13
11
|
|
|
14
12
|
// Markdown support
|
|
15
13
|
"esbenp.prettier-vscode",
|
|
16
|
-
"yzhang.markdown-all-in-one",
|
|
17
|
-
"davidanson.vscode-markdownlint",
|
|
18
14
|
|
|
19
15
|
// General productivity
|
|
20
16
|
"ms-vscode.vscode-json",
|
|
@@ -22,10 +18,6 @@
|
|
|
22
18
|
"editorconfig.editorconfig",
|
|
23
19
|
|
|
24
20
|
// Git integration
|
|
25
|
-
"eamodio.gitlens"
|
|
26
|
-
|
|
27
|
-
// Additional helpful extensions
|
|
28
|
-
"ms-vscode.test-adapter-converter",
|
|
29
|
-
"hbenl.vscode-test-explorer"
|
|
21
|
+
"eamodio.gitlens"
|
|
30
22
|
]
|
|
31
23
|
}
|
data/.vscode/keybindings.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"key": "ctrl+shift+r ctrl+v",
|
|
4
|
-
"command": "workbench.action.tasks.runTask",
|
|
5
|
-
"args": "RBS: Validate",
|
|
6
|
-
"when": "editorTextFocus"
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"key": "ctrl+shift+r ctrl+s",
|
|
10
|
-
"command": "workbench.action.tasks.runTask",
|
|
11
|
-
"args": "Steep: Type Check",
|
|
12
|
-
"when": "editorTextFocus"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"key": "ctrl+shift+r ctrl+w",
|
|
16
|
-
"command": "workbench.action.tasks.runTask",
|
|
17
|
-
"args": "Steep: Watch Mode",
|
|
18
|
-
"when": "editorTextFocus"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"key": "ctrl+shift+r ctrl+r",
|
|
22
|
-
"command": "workbench.action.tasks.runTask",
|
|
23
|
-
"args": "Rubocop: Fix",
|
|
24
|
-
"when": "editorTextFocus"
|
|
25
|
-
}
|
|
26
|
-
]
|
data/.vscode/settings.json
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
// Ruby language settings
|
|
3
|
-
"ruby.format": "rubocop",
|
|
4
|
-
"ruby.lint": {
|
|
5
|
-
"rubocop": {
|
|
6
|
-
"useBundler": true
|
|
7
|
-
}
|
|
8
|
-
},
|
|
9
|
-
"ruby.useLanguageServer": true,
|
|
10
|
-
"ruby.intellisense": "rubyLsp",
|
|
11
|
-
|
|
12
2
|
// Auto-formatting settings
|
|
13
3
|
"editor.formatOnSave": true,
|
|
14
4
|
"editor.formatOnPaste": true,
|
|
@@ -48,6 +38,50 @@
|
|
|
48
38
|
"editor.rulers": [120],
|
|
49
39
|
"editor.trimAutoWhitespace": true
|
|
50
40
|
},
|
|
41
|
+
"[json]": {
|
|
42
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
43
|
+
"editor.formatOnSave": true,
|
|
44
|
+
"editor.tabSize": 2,
|
|
45
|
+
"editor.insertSpaces": true,
|
|
46
|
+
"editor.quickSuggestions": {
|
|
47
|
+
"strings": true
|
|
48
|
+
},
|
|
49
|
+
"editor.suggest.insertMode": "replace"
|
|
50
|
+
},
|
|
51
|
+
"[jsonc]": {
|
|
52
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
53
|
+
"editor.formatOnSave": true,
|
|
54
|
+
"editor.tabSize": 2,
|
|
55
|
+
"editor.insertSpaces": true,
|
|
56
|
+
"editor.quickSuggestions": {
|
|
57
|
+
"strings": true
|
|
58
|
+
},
|
|
59
|
+
"editor.suggest.insertMode": "replace"
|
|
60
|
+
},
|
|
61
|
+
"[yaml]": {
|
|
62
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
63
|
+
"editor.formatOnSave": true,
|
|
64
|
+
"editor.tabSize": 2,
|
|
65
|
+
"editor.insertSpaces": true,
|
|
66
|
+
"editor.autoIndent": "advanced",
|
|
67
|
+
"editor.quickSuggestions": {
|
|
68
|
+
"other": true,
|
|
69
|
+
"comments": false,
|
|
70
|
+
"strings": true
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"[yml]": {
|
|
74
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
75
|
+
"editor.formatOnSave": true,
|
|
76
|
+
"editor.tabSize": 2,
|
|
77
|
+
"editor.insertSpaces": true,
|
|
78
|
+
"editor.autoIndent": "advanced",
|
|
79
|
+
"editor.quickSuggestions": {
|
|
80
|
+
"other": true,
|
|
81
|
+
"comments": false,
|
|
82
|
+
"strings": true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
51
85
|
|
|
52
86
|
// File associations
|
|
53
87
|
"files.associations": {
|
|
@@ -56,7 +90,19 @@
|
|
|
56
90
|
"Rakefile": "ruby",
|
|
57
91
|
".rubocop.yml": "yaml",
|
|
58
92
|
"*.rbs": "rbs",
|
|
59
|
-
"Steepfile": "ruby"
|
|
93
|
+
"Steepfile": "ruby",
|
|
94
|
+
"*.yaml": "yaml",
|
|
95
|
+
"*.yml": "yaml",
|
|
96
|
+
".yamllint": "yaml",
|
|
97
|
+
".yamllint.yaml": "yaml",
|
|
98
|
+
".yamllint.yml": "yaml",
|
|
99
|
+
"*.json": "json",
|
|
100
|
+
"*.jsonc": "jsonc",
|
|
101
|
+
".vscode/*.json": "jsonc",
|
|
102
|
+
"tsconfig*.json": "jsonc",
|
|
103
|
+
".eslintrc": "jsonc",
|
|
104
|
+
".babelrc": "jsonc",
|
|
105
|
+
".prettierrc": "jsonc"
|
|
60
106
|
},
|
|
61
107
|
|
|
62
108
|
// Auto-save settings
|
data/.vscode/tasks.json
CHANGED
|
@@ -235,6 +235,96 @@
|
|
|
235
235
|
"panel": "shared"
|
|
236
236
|
},
|
|
237
237
|
"problemMatcher": []
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"label": "Qlty: Check All",
|
|
241
|
+
"type": "shell",
|
|
242
|
+
"command": "./bin/qlty",
|
|
243
|
+
"args": ["check"],
|
|
244
|
+
"group": "test",
|
|
245
|
+
"presentation": {
|
|
246
|
+
"echo": true,
|
|
247
|
+
"reveal": "always",
|
|
248
|
+
"focus": false,
|
|
249
|
+
"panel": "shared"
|
|
250
|
+
},
|
|
251
|
+
"problemMatcher": []
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"label": "Qlty: Check Critical",
|
|
255
|
+
"type": "shell",
|
|
256
|
+
"command": "./bin/qlty",
|
|
257
|
+
"args": ["check-critical"],
|
|
258
|
+
"group": "test",
|
|
259
|
+
"presentation": {
|
|
260
|
+
"echo": true,
|
|
261
|
+
"reveal": "always",
|
|
262
|
+
"focus": false,
|
|
263
|
+
"panel": "shared"
|
|
264
|
+
},
|
|
265
|
+
"problemMatcher": []
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"label": "Qlty: Summary",
|
|
269
|
+
"type": "shell",
|
|
270
|
+
"command": "./bin/qlty",
|
|
271
|
+
"args": ["summary"],
|
|
272
|
+
"group": "test",
|
|
273
|
+
"presentation": {
|
|
274
|
+
"echo": true,
|
|
275
|
+
"reveal": "always",
|
|
276
|
+
"focus": false,
|
|
277
|
+
"panel": "shared"
|
|
278
|
+
},
|
|
279
|
+
"problemMatcher": []
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"label": "Qlty: Fix",
|
|
283
|
+
"type": "shell",
|
|
284
|
+
"command": "./bin/qlty",
|
|
285
|
+
"args": ["fix"],
|
|
286
|
+
"group": "build",
|
|
287
|
+
"presentation": {
|
|
288
|
+
"echo": true,
|
|
289
|
+
"reveal": "always",
|
|
290
|
+
"focus": false,
|
|
291
|
+
"panel": "shared"
|
|
292
|
+
},
|
|
293
|
+
"problemMatcher": []
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"label": "Format: All JSON Files",
|
|
297
|
+
"type": "shell",
|
|
298
|
+
"command": "npx",
|
|
299
|
+
"args": ["prettier", "--write", "**/*.json", "**/*.jsonc"],
|
|
300
|
+
"group": "build",
|
|
301
|
+
"presentation": {
|
|
302
|
+
"echo": true,
|
|
303
|
+
"reveal": "silent",
|
|
304
|
+
"focus": false,
|
|
305
|
+
"panel": "shared"
|
|
306
|
+
},
|
|
307
|
+
"options": {
|
|
308
|
+
"cwd": "${workspaceFolder}"
|
|
309
|
+
},
|
|
310
|
+
"problemMatcher": []
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"label": "Format: All YAML Files",
|
|
314
|
+
"type": "shell",
|
|
315
|
+
"command": "npx",
|
|
316
|
+
"args": ["prettier", "--write", "**/*.yaml", "**/*.yml"],
|
|
317
|
+
"group": "build",
|
|
318
|
+
"presentation": {
|
|
319
|
+
"echo": true,
|
|
320
|
+
"reveal": "silent",
|
|
321
|
+
"focus": false,
|
|
322
|
+
"panel": "shared"
|
|
323
|
+
},
|
|
324
|
+
"options": {
|
|
325
|
+
"cwd": "${workspaceFolder}"
|
|
326
|
+
},
|
|
327
|
+
"problemMatcher": []
|
|
238
328
|
}
|
|
239
329
|
]
|
|
240
330
|
}
|
data/CHANGELOG.md
CHANGED
|
@@ -7,13 +7,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.1.0] - 2025-06-08
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Enhance changelog generation and update release guide for automated workflows
|
|
15
|
+
- Update CI and release workflows with Slack notifications and refine branch handling
|
|
16
|
+
- [EXPERIMENT] feat: Enhance release workflow with version validation and dry run support
|
|
17
|
+
- Add skip CI job for draft PRs and dependency updates in workflow
|
|
18
|
+
- Enhance CI workflow with Brakeman security scans and coverage reporting
|
|
19
|
+
- Enable test coverage reporting in CI workflow
|
|
20
|
+
- Integrate Qlty for code quality checks, add Brakeman for security scanning, and enhance coverage reporting
|
|
21
|
+
- Add Qlty integration and various formatting tasks to VS Code
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Deps-dev(deps-dev): update brakeman requirement from ~> 6.0 to ~> 7.0
|
|
26
|
+
- Bump the production-dependencies group with 2 updates
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Exclude Rakefile from RuboCop checks
|
|
31
|
+
- Correct conditional syntax for Qlty coverage upload and update RuboCop exclusions
|
|
32
|
+
- Correct syntax for accessing QLTY coverage token in CI workflow
|
|
33
|
+
- Update dependabot assignee to dependabot[bot] and adjust RuboCop naming configurations
|
|
34
|
+
- Adjust coverage thresholds for improved test accuracy
|
|
35
|
+
|
|
36
|
+
### Maintenance
|
|
37
|
+
|
|
38
|
+
- Bump version to 1.0.2 in Gemfile.lock and version.rb
|
|
39
|
+
|
|
10
40
|
## [1.0.1] - 2025-06-08
|
|
11
41
|
|
|
12
42
|
## [1.0.0] - 2025-06-07
|
|
13
43
|
|
|
14
44
|
### 🎉 Major Release - Production Ready
|
|
15
45
|
|
|
16
|
-
This marks the first stable release of ClassMetrix with a comprehensive feature set and robust architecture.
|
|
46
|
+
This marks the first stable release of `ClassMetrix` with a comprehensive feature set and robust architecture.
|
|
17
47
|
|
|
18
48
|
### Added
|
|
19
49
|
|
data/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/class-metrix)
|
|
4
4
|
[](https://github.com/patrick204nqh/class-metrix/actions/workflows/main.yml)
|
|
5
|
+
[](https://qlty.sh/gh/patrick204nqh/projects/class-metrix)
|
|
5
6
|
|
|
6
7
|
**ClassMetrix** is a Ruby gem that extracts and compares class behaviors (constants, class methods, and more) across multiple classes, generating clean markdown reports for analysis, documentation, and compliance auditing.
|
|
7
8
|
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
- **📄 CSV Export**: Data analysis-friendly CSV output with hash flattening
|
|
18
19
|
- **⚙️ Highly Configurable**: Customize every aspect of the output
|
|
19
20
|
- **🚀 Simple API**: Chainable, intuitive interface
|
|
21
|
+
- **🔒 Type Safe**: Full RBS type annotations with Steep type checking
|
|
20
22
|
|
|
21
23
|
## 🚀 Quick Start
|
|
22
24
|
|
|
@@ -430,16 +432,37 @@ ClassMetrix uses a modular component architecture for maximum flexibility:
|
|
|
430
432
|
|
|
431
433
|
```
|
|
432
434
|
MarkdownFormatter
|
|
433
|
-
├── HeaderComponent
|
|
434
|
-
├── TableComponent
|
|
435
|
-
├── MissingBehaviorsComponent
|
|
436
|
-
└── FooterComponent
|
|
435
|
+
├── HeaderComponent # Title, classes, extraction info
|
|
436
|
+
├── TableComponent # Table formatting and hash expansion
|
|
437
|
+
├── MissingBehaviorsComponent # Missing behavior analysis
|
|
438
|
+
└── FooterComponent # Footer with various styles
|
|
437
439
|
```
|
|
438
440
|
|
|
439
|
-
|
|
441
|
+
### Key Design Principles
|
|
442
|
+
|
|
443
|
+
- **Type Safety**: All components have complete RBS type annotations
|
|
444
|
+
- **Modularity**: Each component is independently configurable
|
|
445
|
+
- **Extensibility**: Easy to add new extractors and formatters
|
|
446
|
+
- **Error Resilience**: Graceful handling of edge cases and errors
|
|
447
|
+
- **Performance**: Optimized for processing large class hierarchies
|
|
448
|
+
|
|
449
|
+
### Type System
|
|
450
|
+
|
|
451
|
+
The entire codebase is fully typed using RBS (Ruby Signature) format:
|
|
452
|
+
|
|
453
|
+
- **Public APIs**: Complete type contracts for all user-facing methods
|
|
454
|
+
- **Internal Components**: Type safety for all internal class interactions
|
|
455
|
+
- **Error Handling**: Typed exception handling with specific error types
|
|
456
|
+
- **Configuration**: Strongly typed configuration objects
|
|
457
|
+
|
|
458
|
+
This ensures reliability and provides excellent IDE support with autocompletion and type checking.
|
|
440
459
|
|
|
441
460
|
## 🧪 Development
|
|
442
461
|
|
|
462
|
+
ClassMetrix uses modern Ruby development practices with comprehensive type checking and VS Code integration.
|
|
463
|
+
|
|
464
|
+
### Quick Setup
|
|
465
|
+
|
|
443
466
|
```bash
|
|
444
467
|
# Clone the repository
|
|
445
468
|
git clone https://github.com/patrick204nqh/class-metrix.git
|
|
@@ -451,15 +474,47 @@ bundle install
|
|
|
451
474
|
# Run tests
|
|
452
475
|
bundle exec rspec
|
|
453
476
|
|
|
477
|
+
# Run type checking
|
|
478
|
+
bundle exec steep check
|
|
479
|
+
|
|
480
|
+
# Run linting
|
|
481
|
+
bundle exec rubocop
|
|
482
|
+
|
|
454
483
|
# Run examples
|
|
455
484
|
ruby examples/basic/01_simple_constants.rb
|
|
456
485
|
ruby examples/advanced/hash_expansion.rb
|
|
457
486
|
```
|
|
458
487
|
|
|
488
|
+
### Type Safety
|
|
489
|
+
|
|
490
|
+
ClassMetrix maintains **100% type coverage** using:
|
|
491
|
+
|
|
492
|
+
- **RBS Type Annotations**: Complete type signatures for all public APIs
|
|
493
|
+
- **Steep Type Checking**: Static analysis for type correctness
|
|
494
|
+
- **Comprehensive Type Tests**: Ensuring type safety across all components
|
|
495
|
+
|
|
496
|
+
```bash
|
|
497
|
+
# Check type coverage
|
|
498
|
+
bundle exec steep stats
|
|
499
|
+
|
|
500
|
+
# Watch mode for development
|
|
501
|
+
bundle exec steep watch
|
|
502
|
+
|
|
503
|
+
# Validate RBS files
|
|
504
|
+
bundle exec rbs validate
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### Code Quality
|
|
508
|
+
|
|
509
|
+
- **RuboCop**: Enforced code style and best practices
|
|
510
|
+
- **RSpec**: Comprehensive test suite with >95% coverage
|
|
511
|
+
- **CI/CD**: Automated testing across Ruby 3.2+ versions
|
|
512
|
+
|
|
459
513
|
## 📋 Requirements
|
|
460
514
|
|
|
461
|
-
- Ruby
|
|
462
|
-
- No runtime dependencies (
|
|
515
|
+
- **Ruby 3.1+** (Required for full RBS and Steep support)
|
|
516
|
+
- **No runtime dependencies** (Pure Ruby implementation)
|
|
517
|
+
- **Development dependencies**: RBS (~> 3.0), Steep (~> 1.0), RuboCop (~> 1.0)
|
|
463
518
|
|
|
464
519
|
## 🤝 Contributing
|
|
465
520
|
|
|
@@ -476,6 +531,5 @@ This gem is available as open source under the terms of the [MIT License](LICENS
|
|
|
476
531
|
## 🔗 Links
|
|
477
532
|
|
|
478
533
|
- [Documentation](https://github.com/patrick204nqh/class-metrix/wiki)
|
|
479
|
-
- [Examples](examples/)
|
|
480
|
-
- [Build Guide](BUILD_GUIDE.md)
|
|
481
534
|
- [Changelog](CHANGELOG.md)
|
|
535
|
+
- [Examples](examples/)
|
data/Rakefile
CHANGED
|
@@ -9,4 +9,67 @@ require "rubocop/rake_task"
|
|
|
9
9
|
|
|
10
10
|
RuboCop::RakeTask.new
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
# Add Brakeman security scanner
|
|
13
|
+
begin
|
|
14
|
+
require "brakeman"
|
|
15
|
+
|
|
16
|
+
desc "Run Brakeman security scanner"
|
|
17
|
+
task :brakeman do
|
|
18
|
+
puts "🔍 Running Brakeman security scan..."
|
|
19
|
+
# Ensure tmp directory exists
|
|
20
|
+
Dir.mkdir("tmp") unless Dir.exist?("tmp")
|
|
21
|
+
|
|
22
|
+
# Run with non-zero exit to avoid breaking CI but still capture issues
|
|
23
|
+
result = system("brakeman --force --format json --output tmp/brakeman.json --no-exit-on-warn")
|
|
24
|
+
unless result
|
|
25
|
+
puts "⚠️ Brakeman found potential security issues - check tmp/brakeman.json"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Also create human-readable output
|
|
29
|
+
system("brakeman --force --format text --output tmp/brakeman.txt --no-exit-on-warn")
|
|
30
|
+
|
|
31
|
+
puts "✅ Brakeman security scan completed"
|
|
32
|
+
puts "📄 Reports saved to: tmp/brakeman.json and tmp/brakeman.txt"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
desc "Run Brakeman security scanner with HTML output"
|
|
36
|
+
task :brakeman_html do
|
|
37
|
+
puts "🔍 Running Brakeman security scan (HTML output)..."
|
|
38
|
+
Dir.mkdir("tmp") unless Dir.exist?("tmp")
|
|
39
|
+
|
|
40
|
+
system("brakeman --force --format html --output tmp/brakeman.html --no-exit-on-warn")
|
|
41
|
+
puts "✅ Brakeman HTML report generated: tmp/brakeman.html"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
desc "Run comprehensive security check"
|
|
45
|
+
task :security => [:brakeman] do
|
|
46
|
+
puts "🔒 Security check completed"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
rescue LoadError
|
|
50
|
+
desc "Brakeman not available"
|
|
51
|
+
task :brakeman do
|
|
52
|
+
puts "⚠️ Brakeman not available - install with: gem install brakeman"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
task :security => [] do
|
|
56
|
+
puts "⚠️ Security tools not available"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Coverage task for local development
|
|
61
|
+
desc "Run tests with coverage report"
|
|
62
|
+
task :coverage do
|
|
63
|
+
ENV["COVERAGE"] = "true"
|
|
64
|
+
Rake::Task[:spec].invoke
|
|
65
|
+
puts "📊 Coverage report generated in coverage/"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Quality check task combining multiple checks
|
|
69
|
+
desc "Run all quality checks"
|
|
70
|
+
task :quality => [:rubocop, :security] do
|
|
71
|
+
puts "✅ All quality checks completed"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Add security to default tasks for better security
|
|
75
|
+
task default: %i[spec rubocop security]
|
data/config/brakeman.yml
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Brakeman configuration for ClassMetrix (Ruby Gem)
|
|
2
|
+
# https://brakemanscanner.org/docs/options/
|
|
3
|
+
|
|
4
|
+
# Application settings
|
|
5
|
+
app_path: "."
|
|
6
|
+
rails: false
|
|
7
|
+
|
|
8
|
+
# Files to scan (gem-specific)
|
|
9
|
+
only_files:
|
|
10
|
+
- "lib/**/*.rb"
|
|
11
|
+
|
|
12
|
+
# Skip certain files
|
|
13
|
+
skip_files:
|
|
14
|
+
- "spec/**/*.rb"
|
|
15
|
+
- "test/**/*.rb"
|
|
16
|
+
- "examples/**/*.rb"
|
|
17
|
+
- "bin/**/*"
|
|
18
|
+
- "vendor/**/*"
|
|
19
|
+
- "tmp/**/*"
|
|
20
|
+
- "coverage/**/*"
|
|
21
|
+
|
|
22
|
+
# Security check configuration
|
|
23
|
+
min_confidence: 2
|
|
24
|
+
exit_on_warn: false
|
|
25
|
+
exit_on_error: false
|
|
26
|
+
|
|
27
|
+
# Output configuration
|
|
28
|
+
format: text
|
|
29
|
+
output_file: "tmp/brakeman-report.txt"
|
|
30
|
+
ignore_file: ".brakeman.ignore"
|
|
31
|
+
|
|
32
|
+
# Display options
|
|
33
|
+
quiet: false
|
|
34
|
+
summary: true
|
|
35
|
+
|
|
36
|
+
# Force scan even for non-Rails apps
|
|
37
|
+
force: true
|