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

Add CodeScanningService.ListAnalysesForRepo and CodeScanningService.GetAnalysis #2210

Merged
merged 5 commits into from Dec 3, 2021

Conversation

yogur
Copy link
Contributor

@yogur yogur commented Nov 26, 2021

Add ListAnalysesForRepo and GetAnalysis to CodeScanningService, including unit tests.

@google-cla google-cla bot added the cla: no label Nov 26, 2021
@yogur
Copy link
Contributor Author

yogur commented Nov 26, 2021

I just submitted a CLA.

@yogur
Copy link
Contributor Author

yogur commented Nov 26, 2021

I noticed that most of the unit tests are prefixed with "TestActionsService", shouldn't these unit tests be prefixed with "TestCodeScanningService" instead?

@codecov
Copy link

codecov bot commented Nov 26, 2021

Codecov Report

Merging #2210 (94d6ae9) into master (b26fa8f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2210   +/-   ##
=======================================
  Coverage   97.79%   97.80%           
=======================================
  Files         112      112           
  Lines       10036    10078   +42     
=======================================
+ Hits         9815     9857   +42     
  Misses        154      154           
  Partials       67       67           
Impacted Files Coverage Δ
github/code-scanning.go 100.00% <100.00%> (ø)
github/actions_workflow_runs.go 100.00% <0.00%> (ø)
github/github.go 97.62% <0.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b26fa8f...94d6ae9. Read the comment docs.

@gmlewis
Copy link
Collaborator

gmlewis commented Nov 26, 2021

I noticed that most of the unit tests are prefixed with "TestActionsService", shouldn't these unit tests be prefixed with "TestCodeScanningService" instead?

Good catch! Yes indeed, these should be changed. Would you mind addressing these changes in this PR?
Thank you, @yogur !

@googlebot rescan.

@google-cla google-cla bot added cla: yes Indication that the PR author has signed a Google Contributor License Agreement. and removed cla: no labels Nov 26, 2021
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @yogur !
I have a couple questions about this. See below.

github/code-scanning.go Outdated Show resolved Hide resolved
github/code-scanning.go Outdated Show resolved Hide resolved
// Analysis represents an individual GitHub Code Scanning Analysis on a single repository.
//
// GitHub API docs: https://docs.github.com/en/rest/reference/code-scanning#list-code-scanning-analyses-for-a-repository
type Analysis struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be merged with the existing SarifAnalysis struct?
If not, can we give it a more specific name?

Copy link
Contributor Author

@yogur yogur Nov 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't because SarifAnalysis is used for POST request body params, while Analysis is used to unmarshal json response of listing code scanning analysis instances.

I thought about renaming to to ScanningAnalysis or CodeScanningAnalysis but I felt that was redundant with the service name. CodeScanningService. What are your thoughts on this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that this name is global throughout the package github namespace. So even though it is used within the CodeScanningService, it is really github.Analysis which is pretty general, so if you don't mind switching to ScanningAnalysis, I think that would be preferable. Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes you're right. I updated it. Thanks for the review!

github/code-scanning.go Outdated Show resolved Hide resolved
github/code-scanning.go Outdated Show resolved Hide resolved
@yogur
Copy link
Contributor Author

yogur commented Nov 26, 2021

I noticed that most of the unit tests are prefixed with "TestActionsService", shouldn't these unit tests be prefixed with "TestCodeScanningService" instead?

Good catch! Yes indeed, these should be changed. Would you mind addressing these changes in this PR? Thank you, @yogur !

@googlebot rescan.

@gmlewis No problem! I committed the name change.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @yogur !
LGTM.

Awaiting second LGTM before merging.

(Please note that ALL other contributors to this repo are welcome to provide the second PR review/comment/approval that we need for merging and that we are not waiting for any particular reviewer unless otherwise noted.)

Copy link
Contributor

@cpanato cpanato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
thanks!

@gmlewis
Copy link
Collaborator

gmlewis commented Dec 3, 2021

Thank you, @cpanato !
Merging.

@gmlewis gmlewis merged commit 44ae9a1 into google:master Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indication that the PR author has signed a Google Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants