#510·scc

在使用 scc 与 GitHub Actions json2 时,不会生成 json 输出

作者: usmaniqbal998创建于 2024年9月24日更新于 2024年9月24日

Describe the bug when i use scc -f json2 -o scc_results.json in my GitHub Actions i do not get json results instead in a raw text format To Reproduce

  - name: Run scc
    shell: bash
    id: scc
    working-directory: ${{ GitHub.workspace }}
    run: |
      scc -f json2 -o scc_results.json

This is how i am collectiong scc results . I am using bash and i have go-version: "1.20"

the output i get is plain text as following

Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
TypeScript                 654     42267     4805       723    36739       2702
Sass                        97      4724      681        14     4029          0
JSON                        57     44214        1         0    44213          0
JavaScript                  30      4107      339      1121     2647        140
YAML                        18       725       79        14      632          0
Markdown                     9      1649      645         0     1004          0
SVG                          8        25        0         0       25          0
Shell                        3        18        5         6        7          0
Plain Text                   2        43        5         0       38          0
TypeScript Typings           2        97       17         7       73          3
CSV                          1       428        0         0      428          0
Docker ignore                1        36        2         4       30          0
Dockerfile                   1         8        2         0        6          0
HTML                         1        44        4        13       27          0
License                      1         0        0         0        0          0
gitignore                    1        35        7         5       23          0
───────────────────────────────────────────────────────────────────────────────
Total                      886     98420     6592      1907    89921       2845
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop $3,041,932
Estimated Schedule Effort 23.414646 months
Estimated People Required 15.389219
───────────────────────────────────────────────────────────────────────────────

If i switch to json instead of json2 output then i dont get COCOMO estimations following is full code for my GitHub action

name
description: "Run scc, display results"
inputs:
  fail-threshold:
    description: "Threshold for failing the build based on complexity"
    required: false
    default: 100
outputs:
  complexity:
    description: "The total complexity of the codebase"
runs:
  using: "composite"
  steps:
    - name: Check out repository
      uses: actions/checkout@v3
…