@gulu9527/code-trust 0.3.1 → 0.3.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-CN.md CHANGED
@@ -81,6 +81,21 @@ CodeTrust 从五个维度评估代码,加权计算总分(0-100):
81
81
  | 覆盖 | 15% | 测试文件覆盖 |
82
82
  | 风格 | 10% | 命名一致性 |
83
83
 
84
+ ### 评分模型
85
+
86
+ 每个问题按严重度扣分,相同严重度的重复问题使用**递减惩罚**:
87
+
88
+ | 严重度 | 基础扣分 | 递减因子 |
89
+ |--------|---------|---------|
90
+ | high | 15 | × 0.7 每次重复 |
91
+ | medium | 8 | × 0.7 每次重复 |
92
+ | low | 3 | × 0.7 每次重复 |
93
+ | info | 0 | — |
94
+
95
+ 例如,3 个 high 级别问题扣分为 15 + 10.5 + 7.35 = 32.85(而非 45),避免单一规则类别过度主导总分。
96
+
97
+ 每个问题通过**内容哈希指纹**(SHA256 of 规则ID + 文件路径 + 代码片段)标识,使发现结果在无关行号变动时保持稳定。
98
+
84
99
  ### 等级
85
100
 
86
101
  | 分数 | 等级 | 含义 |
package/README.md CHANGED
@@ -81,6 +81,21 @@ CodeTrust evaluates code across five dimensions, weighted into a total score (0-
81
81
  | Coverage | 15% | Test file coverage |
82
82
  | Style | 10% | Naming consistency |
83
83
 
84
+ ### Scoring Model
85
+
86
+ Each issue deducts points based on severity, with **diminishing penalties** for repeated issues of the same severity:
87
+
88
+ | Severity | Base Penalty | Diminishing Factor |
89
+ |----------|-------------|-------------------|
90
+ | high | 15 | × 0.7 per repeat |
91
+ | medium | 8 | × 0.7 per repeat |
92
+ | low | 3 | × 0.7 per repeat |
93
+ | info | 0 | — |
94
+
95
+ For example, 3 high-severity issues deduct 15 + 10.5 + 7.35 = 32.85 (not 45). This prevents a single rule category from dominating the score unfairly.
96
+
97
+ Each issue is identified by a **content-hash fingerprint** (SHA256 of rule ID + file path + code snippet), making findings stable across unrelated line shifts.
98
+
84
99
  ### Grades
85
100
 
86
101
  | Score | Grade | Meaning |
package/action.yml CHANGED
@@ -38,5 +38,9 @@ runs:
38
38
 
39
39
  - name: Run CodeTrust scan
40
40
  shell: bash
41
+ env:
42
+ DIFF_REF: ${{ inputs.diff-ref }}
43
+ FORMAT: ${{ inputs.format }}
44
+ MIN_SCORE: ${{ inputs.min-score }}
41
45
  run: |
42
- codetrust scan --diff ${{ inputs.diff-ref }} --format ${{ inputs.format }} --min-score ${{ inputs.min-score }}
46
+ codetrust scan --diff "$DIFF_REF" --format "$FORMAT" --min-score "$MIN_SCORE"