Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
usmaniqbal998 opened this issue Sep 24, 2024 · 1 comment

Comments

@usmaniqbal998
Copy link

usmaniqbal998 commented Sep 24, 2024

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
@boyter
Copy link
Owner

boyter commented Sep 24, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants