bootspring_quality
Run quality gates to ensure code meets standards before committing, pushing, or deploying.
Overview#
The bootspring_quality tool runs automated quality checks on your code. It supports different gates for different stages of development.
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
gate | string | Yes | Quality gate: pre-commit, pre-push, pre-deploy, full |
files | array | No | Specific files to check (defaults to changed files) |
options | object | No | Gate options |
Options Object#
| Option | Type | Default | Description |
|---|---|---|---|
autoFix | boolean | false | Auto-fix issues when possible |
failOnWarning | boolean | false | Treat warnings as errors |
verbose | boolean | false | Show detailed output |
exclude | array | [] | Patterns to exclude |
Quality Gates#
Pre-commit Gate#
Fast checks suitable for every commit:
Use the bootspring_quality tool with:
- gate: "pre-commit"
- options: { autoFix: true }
Checks included:
- Linting (ESLint)
- Formatting (Prettier)
- Type checking (TypeScript)
- Import sorting
- File naming conventions
Pre-push Gate#
More thorough checks before pushing:
Use the bootspring_quality tool with:
- gate: "pre-push"
Checks included:
- All pre-commit checks
- Unit tests
- Test coverage threshold
- Build verification
- Bundle size check
Pre-deploy Gate#
Comprehensive checks before deployment:
Use the bootspring_quality tool with:
- gate: "pre-deploy"
Checks included:
- All pre-push checks
- Integration tests
- E2E tests
- Security scan
- Performance audit
- Accessibility check
Full Gate#
All available checks:
Use the bootspring_quality tool with:
- gate: "full"
Response Format#
Success Response#
1{
2 "success": true,
3 "data": {
4 "gate": "pre-commit",
5 "passed": true,
6 "checks": [
7 {
8 "name": "lint",
9 "status": "passed",
10 "duration": 1250,
11 "issues": []
12 },
13 {
14 "name": "format",
15 "status": "passed",
16 "duration": 450,
17 "fixed": 3
18 },
19 {
20 "name": "types",
21 "status": "passed",
22 "duration": 2100,
23 "issues": []
24 }
25 ],
26 "summary": {
27 "total": 3,
28 "passed": 3,
29 "failed": 0,
30 "warnings": 0,
31 "duration": 3800
32 }
33 }
34}Failure Response#
1{
2 "success": true,
3 "data": {
4 "gate": "pre-commit",
5 "passed": false,
6 "checks": [
7 {
8 "name": "lint",
9 "status": "failed",
10 "duration": 1250,
11 "issues": [
12 {
13 "file": "src/components/Button.tsx",
14 "line": 15,
15 "column": 10,
16 "severity": "error",
17 "rule": "no-unused-vars",
18 "message": "'onClick' is defined but never used"
19 }
20 ]
21 }
22 ],
23 "summary": {
24 "total": 3,
25 "passed": 2,
26 "failed": 1,
27 "warnings": 0,
28 "duration": 3800
29 },
30 "suggestions": [
31 "Run with autoFix: true to automatically fix 1 issue"
32 ]
33 }
34}Check Types#
Lint Check#
1// Configuration in bootspring.config.js
2module.exports = {
3 quality: {
4 lint: {
5 extends: ['eslint:recommended', 'next/core-web-vitals'],
6 rules: {
7 'no-console': 'warn',
8 'no-unused-vars': 'error',
9 },
10 },
11 },
12};Format Check#
1module.exports = {
2 quality: {
3 format: {
4 printWidth: 100,
5 tabWidth: 2,
6 singleQuote: true,
7 trailingComma: 'es5',
8 },
9 },
10};Type Check#
1module.exports = {
2 quality: {
3 types: {
4 strict: true,
5 noImplicitAny: true,
6 },
7 },
8};Test Check#
1module.exports = {
2 quality: {
3 tests: {
4 minCoverage: 80,
5 testMatch: ['**/*.test.ts', '**/*.spec.ts'],
6 },
7 },
8};Security Check#
1module.exports = {
2 quality: {
3 security: {
4 scanDependencies: true,
5 checkSecrets: true,
6 auditLevel: 'moderate',
7 },
8 },
9};Custom Checks#
Add custom quality checks:
1// bootspring.config.js
2module.exports = {
3 quality: {
4 customChecks: [
5 {
6 name: 'no-todo-comments',
7 description: 'Ensure no TODO comments in production code',
8 pattern: /\/\/\s*TODO/i,
9 exclude: ['**/*.test.ts'],
10 severity: 'warning',
11 message: 'TODO comment found - resolve before committing',
12 },
13 {
14 name: 'max-file-size',
15 description: 'Files should not exceed 500 lines',
16 check: async (file) => {
17 const lines = file.content.split('\n').length;
18 return lines <= 500;
19 },
20 severity: 'warning',
21 message: 'File exceeds 500 lines - consider splitting',
22 },
23 ],
24 },
25};Git Hooks Integration#
Set up automatic quality gates with git hooks:
1# Install husky
2npm install -D husky
3
4# Initialize husky
5npx husky init
6
7# Add pre-commit hook
8echo 'npx bootspring quality --gate pre-commit' > .husky/pre-commit
9
10# Add pre-push hook
11echo 'npx bootspring quality --gate pre-push' > .husky/pre-pushCI/CD Integration#
GitHub Actions#
1# .github/workflows/quality.yml
2name: Quality Gates
3
4on: [push, pull_request]
5
6jobs:
7 quality:
8 runs-on: ubuntu-latest
9 steps:
10 - uses: actions/checkout@v4
11
12 - name: Setup Node.js
13 uses: actions/setup-node@v4
14 with:
15 node-version: '20'
16 cache: 'npm'
17
18 - name: Install dependencies
19 run: npm ci
20
21 - name: Run quality gates
22 run: npx bootspring quality --gate pre-deployBest Practices#
Gate Selection#
| Stage | Gate | Frequency |
|---|---|---|
| Every commit | pre-commit | High |
| Before PR | pre-push | Medium |
| Before deploy | pre-deploy | Low |
Performance#
- Use
pre-commitfor fast feedback - Run heavier checks in CI
- Cache results when possible
Configuration#
- Start strict, relax if needed
- Document exceptions
- Review thresholds regularly
Related Tools#
- bootspring_analyze - Deeper code analysis
- bootspring_config - Configure quality settings