@antoniocorraliza/foundry-arch-scanner 1.1.1 → 1.1.2
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/README.md +76 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,9 +7,6 @@ An ultra-fast, static enterprise architecture analysis and governance engine for
|
|
|
7
7
|
[](#)
|
|
8
8
|
[](#license)
|
|
9
9
|
|
|
10
|
-
> **[🚀 Explore the live application](https://foundry-sandbox.vercel.app/)**
|
|
11
|
-
> _Interactive execution, real-time component evaluation, and live technical specifications for the entire Foundry suite._
|
|
12
|
-
|
|
13
10
|
## 🌐 Overview
|
|
14
11
|
|
|
15
12
|
**Foundry arch scanner** is an enterprise-grade static code analysis engine designed to enforce clean architecture, modern reactivity, strict memory management in RxJS, and prevent performance bottlenecks in Angular applications.
|
|
@@ -65,6 +62,82 @@ The scanner evaluates codebases across four specialized analytical blocks:
|
|
|
65
62
|
|
|
66
63
|
- **Heavy initialization:** Flags expensive synchronous operations within class property initializers.
|
|
67
64
|
|
|
65
|
+
## 📊 Architecture scoring engine & quality gates
|
|
66
|
+
|
|
67
|
+
The **Foundry arch scanner** engine goes beyond simple vulnerability detection; it implements a statistical and deterministic model designed to quantify technical debt and evaluate the structural health of Angular applications. This approach allows Enterprise teams to establish strict, automated, and measurable **quality gates** in their continuous integration (CI/CD) cycles.
|
|
68
|
+
|
|
69
|
+
The internal mechanics of the _scoring engine_ for calculating architectural metrics are detailed below.
|
|
70
|
+
|
|
71
|
+
### 1. Violation severity weighting
|
|
72
|
+
|
|
73
|
+
Each violation detected in the source code is classified and penalized based on its direct impact on system stability, performance, or maintainability.
|
|
74
|
+
|
|
75
|
+
| Severity | Weight (Points) | Architectural Criterion |
|
|
76
|
+
| ------------ | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
77
|
+
| **CRITICAL** | $10$ | Severe violations (e.g., memory leaks, uncontrolled state mutations, circular dependencies). Potential system blockage. |
|
|
78
|
+
| **WARNING** | $3$ | Anti-patterns and excessive coupling. They don't break the app immediately but generate significant short-term technical debt. |
|
|
79
|
+
| **INFO** | $1$ | Refactoring opportunities and minor deviations from code conventions (e.g., missing use of modern primitives). |
|
|
80
|
+
|
|
81
|
+
### 2. Defect density calculation
|
|
82
|
+
|
|
83
|
+
To ensure fair evaluations regardless of repository size, the engine calculates a **defect density** for each analytical block.
|
|
84
|
+
|
|
85
|
+
To prevent a single error from disproportionately penalizing isolated components or very small projects, the engine implements a smoothing threshold (`SMALL_PROJECT_SMOOTHING_THRESHOLD = 15`). This ensures that the minimum divisor of evaluated files is always $15$.
|
|
86
|
+
|
|
87
|
+
$$
|
|
88
|
+
\text{Defect density} = \frac{\sum \text{Weights}}{\max(\text{Scanned files}, 15)}
|
|
89
|
+
$$
|
|
90
|
+
|
|
91
|
+
### 3. Block score formula
|
|
92
|
+
|
|
93
|
+
Each analytical block starts from a base score of 100 perfect points. A penalty proportional to the defect density multiplied by a strict severity factor (`DENSITY_PENALTY_MULTIPLIER = 15`) is applied. The final value is rounded and floored to avoid negative scores.
|
|
94
|
+
|
|
95
|
+
$$
|
|
96
|
+
\text{Block score} = \max\left(0, \text{round}\left(100 - (\text{Defect density} \times 15)\right)\right)
|
|
97
|
+
$$
|
|
98
|
+
|
|
99
|
+
### 4. Grade assignment
|
|
100
|
+
|
|
101
|
+
The obtained numeric score is translated into a standardized letter grade, providing an immediate reading of the project's risk level:
|
|
102
|
+
|
|
103
|
+
- **A (**$\ge 90$ **points):** Excellent architectural compliance. Clean, reactive, and highly optimized code.
|
|
104
|
+
|
|
105
|
+
- **B (**$\ge 80$ **points):** Good structural condition with minor observations.
|
|
106
|
+
|
|
107
|
+
- **C (**$\ge 70$ **points):** Moderate warnings. Technical debt detected that should be scheduled for refactoring.
|
|
108
|
+
|
|
109
|
+
- **D (**$\ge 60$ **points):** Significant architectural risk. Strongly discouraged practices present in the code.
|
|
110
|
+
|
|
111
|
+
- **F (**$< 60$ **points):** Critical non-compliance. Project integrity is compromised.
|
|
112
|
+
|
|
113
|
+
### 5. Overall project score
|
|
114
|
+
|
|
115
|
+
The overall state of the application is determined by the strict arithmetic mean of the scores obtained in the four analysis domains:
|
|
116
|
+
|
|
117
|
+
1. RxJS & Memory management
|
|
118
|
+
|
|
119
|
+
2. Clean architecture & Coupling
|
|
120
|
+
|
|
121
|
+
3. Angular signals & Modern reactivity
|
|
122
|
+
|
|
123
|
+
4. Optimization & Performance
|
|
124
|
+
|
|
125
|
+
$$
|
|
126
|
+
\text{Overall score} = \frac{\text{Score}_{\text{RxJS}} + \text{Score}_{\text{Arch}} + \text{Score}_{\text{Signals}} + \text{Score}_{\text{Perf}}}{4}
|
|
127
|
+
$$
|
|
128
|
+
|
|
129
|
+
### 🛑 CI/CD Pipeline & Quality Gate Impact
|
|
130
|
+
|
|
131
|
+
The _scorign engine_ is designed to act as an automated guardian in DevSecOps environments. The engine will automatically block the pipeline (via `process.exit(1)`) if any of the following _quality gate_ failure conditions are met:
|
|
132
|
+
|
|
133
|
+
- **Critical grade:** The overall project score drops below 60 points (Grade **F**).
|
|
134
|
+
|
|
135
|
+
- **Critical overflow:** The total number of issues categorized as `CRITICAL` exceeds the maximum limit configured in `foundry-arch-scanner.json` (`maxCriticalIssues`).
|
|
136
|
+
|
|
137
|
+
- **Warning overflow:** (Optional) If a limit for `maxWarnings` is defined and exceeded.
|
|
138
|
+
|
|
139
|
+
> **💡 CI/CD tip:** During early adoption phases or legacy code migrations, you can run the scanner with the `--warn-only` flag to generate full analytical reports without interrupting the deployment.
|
|
140
|
+
|
|
68
141
|
## 🚀 Installation & usage
|
|
69
142
|
|
|
70
143
|
The `foundry-arch-scanner` is distributed via NPM and can be executed directly or installed globally/locally within your Angular workspace.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antoniocorraliza/foundry-arch-scanner",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Enterprise static analysis engine for strict architectural governance, AST AST-aware AST validation, and clean architecture compliance in modern Angular and TypeScript applications.",
|
|
6
6
|
"main": "dist/index.js",
|