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 link to source file from header comment #223

Open
PeterJohnson opened this issue Dec 20, 2021 · 4 comments · May be fixed by #224
Open

Add link to source file from header comment #223

PeterJohnson opened this issue Dec 20, 2021 · 4 comments · May be fixed by #224

Comments

@PeterJohnson
Copy link
Member

PeterJohnson commented Dec 20, 2021

For team discoverability of GitHub source code, it might be helpful to automatically add a link in the header to the file on GitHub, similar to what RTD does. E.g.

// Copyright block
//
// This file can be found on GitHub at the following location:
// https://github.com/wpilibsuite/allwpilib/blob/main/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL362.java

One problem with this is the link is almost certainly longer than the allowed line length, which may cause other formatters/style checkers (PMD, Checkstyle) to complain?

@calcmogul
Copy link
Member

calcmogul commented Dec 20, 2021

We could add a {file_url} tag to licenseupdate.py. Finding the right URL would be difficult since the origin remote isn't always upstream.

Or we could support something like the following in licenseupdate.py:

https://github.com/wpilibsuite/allwpilib/blob/main/{filename}

where {filename} expands to the file's path relative to the repo root.

@PeterJohnson
Copy link
Member Author

I think the latter might be better, as I'm not sure how it will know where to point the base URL in file_url to?

@calcmogul
Copy link
Member

Yep.

@PeterJohnson
Copy link
Member Author

I wonder if we still should have _url in there somewhere, because theoretically we might need to escape spaces (spaces are a terrible idea for other reasons though, of course, so maybe this is a non-issue).

calcmogul added a commit to calcmogul/styleguide that referenced this issue Dec 20, 2021
@calcmogul calcmogul linked a pull request Dec 20, 2021 that will close this issue
calcmogul added a commit to calcmogul/styleguide that referenced this issue Jul 15, 2022
calcmogul added a commit to calcmogul/styleguide that referenced this issue Jul 6, 2023
calcmogul added a commit to calcmogul/styleguide that referenced this issue May 6, 2024
calcmogul added a commit to calcmogul/styleguide that referenced this issue Nov 14, 2024
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 a pull request may close this issue.

2 participants