-
Notifications
You must be signed in to change notification settings - Fork 898
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
[unstable option] license_template_path #3352
Comments
|
Hi, I am using this feature and it helps me a lot in general with the license headers in my project.
This works and successfully validates date ranges such as
Maybe I am doing something wrong. (I am not used to work with regex.) |
Hi @Robbepop, if still relevant, this works for me |
Thanks I will try that out! :) |
Multiline template isn't working... |
Looks like my issue is using Windows and the break lines, I cloned repositories with that and still failing, I'm using the last nightly version |
Switched CRLF to LF in the template file and now is working, I was using visual studio code |
I was confused about what regex formatting options were allowed. The comment at license.rs#L70 proved useful. |
Thanks for sharing @mrbianchi! line endings are a bit of a pain for rustfmt to work with as the rustc parser normalizes everything to unix style endings in the source map that rustfmt works with, and we then go back in towards the latter formatting phases (after the license template check is performed) to perform line ending checks and, if necessary, the converted value. It could be possible with a refactor to shift that check after the line ending conversions, if you or anyone else is interested in investigating. In the meantime, I imagine it'd be helpful if the documentation for the Lines 206 to 227 in 30bda45
Lines 308 to 328 in 30bda45
|
@DMATS - Thanks for sharing! Do you think the wording of the description/help text for the config option could be phrased differently to better express this? |
The template path appears to be resolved relative to the current directory when running This causes an error when running the command from a sub-directory in a workspace:
I was not expecting My expectation:
|
Hmm, got a few different licenses in one workspace. Seems like the regex's only span one line. Ideally I don't mind which line they put this in their header as long as they've got one. (Alternatively if It seems I can copy my .rustfmt into a subdir and remove a license check (is there a way I can avoid duplicating all the other settings? Ideally I'd like to use all the previous settings and then drop the check: |
@cbarrick agree with you about the relative dir. Here's an attempt at fixing that: rust-lang/rust#87627 |
Going to close this because stabilization doesn't make sense given our intent to deprecate and remove the option, refs #5103 |
Adds string handling back into pre-commit to drop quotes for rustfmt --config option to be able to use the string values as unquoted. This change additionally drops the license-template-path formatting parameter as it is no longer supported by the rust toolchain. See github discussion: rust-lang/rustfmt#3352 Signed-off-by: Matthew Schlebusch <schlebus@amazon.com>
Drops string handling from pre-commit entirely. rustfmt --config option can't be used with the parameters 'as is' (string values as unquoted). Instead use rustfmt --config-path that takes the whole fmt.toml file. To be able to use --config-path requires the nightly toolchain to be added to the docker dev container as well. This change additionally drops the license-template-path formatting parameter as it is no longer supported by the rust toolchain. See github discussion: rust-lang/rustfmt#3352 Signed-off-by: Matthew Schlebusch <schlebus@amazon.com>
Drops string handling from pre-commit entirely. rustfmt --config option can't be used with the parameters 'as is' (string values as unquoted). Instead use rustfmt --config-path that takes the whole fmt.toml file. To be able to use --config-path requires the nightly toolchain to be added to the docker dev container as well. This change additionally drops the license-template-path formatting parameter as it is no longer supported by the rust toolchain. See github discussion: rust-lang/rustfmt#3352 Signed-off-by: Matthew Schlebusch <schlebus@amazon.com>
Drops string handling from pre-commit entirely. rustfmt --config option can't be used with the parameters 'as is' (string values as unquoted). Instead use rustfmt --config-path that takes the whole fmt.toml file. To be able to use --config-path requires the nightly toolchain to be added to the docker dev container as well. This change additionally drops the license-template-path formatting parameter as it is no longer supported by the rust toolchain. See github discussion: rust-lang/rustfmt#3352 Signed-off-by: Matthew Schlebusch <schlebus@amazon.com>
Drops string handling from pre-commit entirely. rustfmt --config option can't be used with the parameters 'as is' (string values as unquoted). Instead use rustfmt --config-path that takes the whole fmt.toml file. To be able to use --config-path requires the nightly toolchain to be added to the docker dev container as well. This change additionally drops the license-template-path formatting parameter as it is no longer supported by the rust toolchain. See github discussion: rust-lang/rustfmt#3352 Signed-off-by: Matthew Schlebusch <schlebus@amazon.com>
Drops string handling from pre-commit entirely. rustfmt --config option can't be used with the parameters 'as is' (string values as unquoted). Instead use rustfmt --config-path that takes the whole fmt.toml file. To be able to use --config-path requires the nightly toolchain to be added to the docker dev container as well. This change additionally drops the license-template-path formatting parameter as it is no longer supported by the rust toolchain. See github discussion: rust-lang/rustfmt#3352 Signed-off-by: Matthew Schlebusch <schlebus@amazon.com>
Drops string handling from pre-commit entirely. rustfmt --config option can't be used with the parameters 'as is' (string values as unquoted). Instead use rustfmt --config-path that takes the whole fmt.toml file. To be able to use --config-path requires the nightly toolchain to be added to the docker dev container as well. This change additionally drops the license-template-path formatting parameter as it is no longer supported by the rust toolchain. See github discussion: rust-lang/rustfmt#3352 Signed-off-by: Matthew Schlebusch <schlebus@amazon.com>
Tracking issue for unstable option: license_template_path
The text was updated successfully, but these errors were encountered: