scc icon indicating copy to clipboard operation
scc copied to clipboard

when using scc with github actions json2 does not produce json output

Open usmaniqbal998 opened this issue 1 year ago • 1 comments

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

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

    - name: Set up Node.js
      uses: actions/setup-node@v3
      with:
        node-version: "20.x"

    - name: Set up Go
      uses: actions/setup-go@v4
      with:
        go-version: "1.20"

    - name: Install scc
      shell: bash
      run: |
        go install github.com/boyter/scc@latest

    - name: Install dependencies
      shell: bash # <--- Add this line to specify the shell
      run: cd "${{ github.action_path }}" && yarn add @actions/github @actions/core

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

    - name: Upload SCC Results
      uses: actions/upload-artifact@v4
      with:
        name: scc_results
        path: scc_results.json 

Expected behavior

  • when using json cocomo results should be published in json file
  • when using json2 in github actions it should generate json as output

Desktop (please complete the following information):

  • OS: ubuntu-latest

usmaniqbal998 avatar Sep 24 '24 08:09 usmaniqbal998

I suspect that the action needs to be updated to the latest version of scc in order to get this.

boyter avatar Sep 24 '24 21:09 boyter