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

Augment where we insert baseline lines of code #624

Merged
merged 2 commits into from
Jul 21, 2021

Conversation

edoardopirovano
Copy link
Contributor

This PR updates the code that injects the baseline LOC count into the SARIF results to also inject it into any metricResult that references a rule which has the lines-of-code tag. This is the location that newer versions of Code Scanning will expect to find the LOC count. The old style (injecting into the metricResult with suffix /summary/lines-of-code) is also retained for backwards compatibility, but we should be able to remove this eventually.

I don't think we need a changelog entry as this change shouldn't really affect any users (unless they are manually uploading the SARIF to a non-Code Scanning endpoint, which I'm not sure is a scenario we support).

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@edoardopirovano edoardopirovano requested a review from a team as a code owner July 21, 2021 13:18
@edoardopirovano
Copy link
Contributor Author

Somehow one of the Node packages in main had managed to get out of sync with that the lockfile specified. This should be impossible due to the PR checks so I'm not quite sure how that happened. Anyway, I've pushed an additional commit to this PR to address that (probably no need to do it in a separate PR?).

@rneatherway
Copy link
Contributor

I've confirmed that this change gives the expected result in a test repository:

                                "metricResults": [
                                        {
                                                "rule": {
                                                        "toolComponent": {
                                                                "index": 22
                                                        },
                                                        "index": 70,
                                                        "id": "js/summary/lines-of-code"
                                                },
                                                "ruleId": "js/summary/lines-of-code",
                                                "baseline": 3,
                                                "value": 3
                                        },
                                        {
                                                "rule": {
                                                        "toolComponent": {
                                                                "index": 22
                                                        },
                                                        "index": 71,
                                                        "id": "js/summary/lines-of-user-code"
                                                },
                                                "ruleId": "js/summary/lines-of-user-code",
                                                "baseline": 3,
                                                "value": 3
                                        }
                                ],

@edoardopirovano edoardopirovano merged commit 3428407 into github:main Jul 21, 2021
@edoardopirovano edoardopirovano deleted the loc-location branch July 21, 2021 13:54
@github-actions github-actions bot mentioned this pull request Jul 21, 2021
5 tasks
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

Successfully merging this pull request may close these issues.

None yet

2 participants