java icon indicating copy to clipboard operation
java copied to clipboard

Getting errors on copyright comment when trying to build PR

Open JimClarke5 opened this issue 4 years ago • 6 comments

IDescribe the problem

I am getting errors on the copyright comment block when trying to build a PR. The only differences I see are "Copyright 2020" vs "Copyright 2020-2021" and some additional spaces. I made no change to the copyright block when I changed the code.

This is happening on many source files.

Provide the exact sequence of commands / steps that you executed before running into the problem

Create PR.

Any other info / logs Error: Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.11.1:check (spotless-check) on project tensorflow-framework: The following files had format violations: 3584 Error: src/main/java/org/tensorflow/framework/initializers/He.java 3585 Error: @@ -1,17 +1,18 @@ 3586 Error: -/?Copyright?2020?The?TensorFlow?Authors.?All?Rights?Reserved. 3587 Error: +/?Copyright?2020-2021?The?TensorFlow?Authors.?All?Rights?Reserved. 3588 Error:
3589 Error: -Licensed?under?the?Apache?License,?Version?2.0?(the?"License"); 3590 Error: -you?may?not?use?this?file?except?in?compliance?with?the?License. 3591 Error: -You?may?obtain?a?copy?of?the?License?at 3592 Error: +?Licensed?under?the?Apache?License,?Version?2.0?(the?"License"); 3593 Error: +?you?may?not?use?this?file?except?in?compliance?with?the?License. 3594 Error: +?You?may?obtain?a?copy?of?the?License?at 3595 Error:
3596 Error: -????http://www.apache.org/licenses/LICENSE-2.0 3597 Error: +?????http://www.apache.org/licenses/LICENSE-2.0 3598 Error:
3599 Error: -Unless?required?by?applicable?law?or?agreed?to?in?writing,?software 3600 Error: -distributed?under?the?License?is?distributed?on?an?"AS?IS"?BASIS, 3601 Error: -WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY?KIND,?either?express?or?implied. 3602 Error: -See?the?License?for?the?specific?language?governing?permissions?and 3603 Error: -limitations?under?the?License. 3604 Error: -=======================================================================/ 3605 Error: +?Unless?required?by?applicable?law?or?agreed?to?in?writing,?software 3606 Error: +?distributed?under?the?License?is?distributed?on?an?"AS?IS"?BASIS, 3607 Error: +?WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY?KIND,?either?express?or?implied. 3608 Error: +?See?the?License?for?the?specific?language?governing?permissions?and 3609 Error: +?limitations?under?the?License. 3610 Error: +?======================================================================= 3611 Error: +?/ 3612 Error: package?org.tensorflow.framework.initializers;

JimClarke5 avatar Jun 01 '21 16:06 JimClarke5

@rnett any quick idea?

karllessard avatar Jun 01 '21 18:06 karllessard

I think it would be best if we turned off the license checking in spotless. It's going to complain about all my PRs with Oracle copyright on.

Craigacp avatar Jun 01 '21 19:06 Craigacp

Another concern I have by running spotless by default is that all PRs we receive include a tons of changes unrelated to the feature being added, I've shared this comment with @rnett .

So what I was proposing is to skip by default executing spotless but before a PR is merged, the submitter can be asked to reformat his/her code using this plugin. Or we submit a huge PR that only contains reformatting changes at once instead of including them in each PR.

karllessard avatar Jun 01 '21 19:06 karllessard

Yeah, best idea for now is probably to disable the copyright block (it's in the root pom). I'm not sure why it's throwing errors. As for what @karllessard said, I think doing the formatting after approval is a good idea. We should split the CI steps, though: one quick-build w/o format, so we can make sure tests pass, and another format check that won't be done until merge time. I don't know if we need to reformat everything at once in the same PR, but it would be good to go through and bring everything into format spec.

rnett avatar Jun 01 '21 20:06 rnett

Also @JimClarke5 I don't think this is an error, it looks like it's just a check failure. What changes if you run spotless:apply (commit or save what you have, first)?

rnett avatar Jun 01 '21 20:06 rnett

And the reason for that error is that when you change a file with the copyright, it extends the time to the current year, so it wants to change 2020 to 2020-2021.

But regardless I don't know of a way to support multiple licenses, I think we will have to disable it. I can put it in a off-by-default profile, maybe.

rnett avatar Jun 01 '21 20:06 rnett