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 support for cmake files #90

Merged
merged 2 commits into from
Nov 15, 2021
Merged

Conversation

willnorris
Copy link
Collaborator

@willnorris willnorris commented Aug 10, 2021

Add support for cmake files, adapted from #67

Slight refactoring in licenseHeader() and fileExtension() to make this and other future logic for determining license comment prefix a little cleaner.

Closes #67

@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2021

Codecov Report

Merging #90 (9e09af5) into master (944049f) will increase coverage by 1.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #90      +/-   ##
==========================================
+ Coverage   47.56%   48.60%   +1.04%     
==========================================
  Files           2        2              
  Lines         246      251       +5     
==========================================
+ Hits          117      122       +5     
  Misses        122      122              
  Partials        7        7              
Impacted Files Coverage Δ
main.go 41.62% <100.00%> (+1.43%) ⬆️

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 944049f...9e09af5. Read the comment docs.

@willnorris willnorris requested a review from mco-gh August 10, 2021 00:18
@willnorris willnorris mentioned this pull request Aug 10, 2021
main.go Outdated Show resolved Hide resolved
func fileExtension(name string) string {
if v := filepath.Ext(name); v != "" {
return strings.ToLower(v)
return v
Copy link
Contributor

Choose a reason for hiding this comment

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

why not lowercase here, once, to avoid forcing all downstream users to do that? Are there one or more downstream users that need extension case preserved?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

well, there's only one downstream user right now, which is licenseHeader above. I have licenseHeader doing the lowercasing itself because it's going to need that anyway for #67. We could do it in both places, it'd just be a noop.

This matters less since there is only a single caller of this func, but I also kind of like the idea of this func not assuming what is going to be done with the file extension. In the one case we have, we are wanting to do a case-insensitive comparison, but that seems like it should be out of scope of a function whose job is just to return a file extension.

@willnorris
Copy link
Collaborator Author

GitHub is having issues right now, so can't push new commits (https://www.githubstatus.com/)

@willnorris
Copy link
Collaborator Author

hmm, I was updating my suggested edit in #67 (comment) in light of these edits, and I'm now thinking it might be clearer to combine these changes. I'll repurpose this PR to just include cmake support as well, since I think that will make some things clearer.

@google-cla
Copy link

google-cla bot commented Aug 10, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@willnorris willnorris changed the title refactor: prep for additional licenseHeader logic add support for cmake files Aug 10, 2021
@willnorris
Copy link
Collaborator Author

okay, take a look now. Sorry for the churn and complete repurposing of this PR 😄

Regarding CLA, co-author consent can be implied from #67.

@srgbtl
Copy link
Contributor

srgbtl commented Aug 10, 2021

@googlebot I consent.

@srgbtl
Copy link
Contributor

srgbtl commented Sep 1, 2021

@willnorris any updates on this PR?

willnorris and others added 2 commits September 2, 2021 13:04
this refactors licenseHeader to make it easier to add additional logic
to determine prefix, beyond just file extension.
Co-authored-by: Sergii Baitala <sbaitala@gmail.com>
@willnorris
Copy link
Collaborator Author

rebased onto master. @mco-gh, you had a question about where we to the string lowercasing. See my comment from before and let me know what you think.

@mco-gh
Copy link
Contributor

mco-gh commented Sep 3, 2021 via email

@willnorris
Copy link
Collaborator Author

looks good, thanks

could you do a formal code review approval? That's required on the master branch.

@mco-gh
Copy link
Contributor

mco-gh commented Oct 1, 2021 via email

@willnorris
Copy link
Collaborator Author

#67 is closed, but this one (#90) is still open. This supersedes #67, so @srgbtl just went ahead and closed the other one preemptively.

@srgbtl
Copy link
Contributor

srgbtl commented Nov 15, 2021

@willnorris any updates on this PR?

Copy link
Contributor

@mco-gh mco-gh left a comment

Choose a reason for hiding this comment

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

Sorry about the delay

@willnorris willnorris merged commit 2b44b36 into google:master Nov 15, 2021
@willnorris willnorris deleted the licenseheader branch November 15, 2021 16:31
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

4 participants