General Coding rule to detect usages of old time and date classes (#1384 / #1385)#1385
Conversation
|
Thanks for your contribution! I think that your confusion is that
is part of the rule description, but you're testing the violation description, which is
|
Thanks that helped! |
|
Hey @Bukama, thanks a lot for your support, we really appreciate it 😃 Could you do me a favor and sign off your commits according to the DCO? (-> https://github.com/TNG/ArchUnit/blob/main/DCO) It's basically some legal thing where you confirm that you contribute the code under the project license and are allowed to contribute it. I think the easiest would be to squash your commits(I think this change in the end is small enough for a single commit, right?) and then run |
…G#1384 / TNG#1385) With this commit new general rules are added which detect the usages of old time and date classes, e.g. java.util.Date. closes TNG#1384 > Developer's Certificate of Origin 1.1 > > By making a contribution to this project, I certify that: > > (a) The contribution was created in whole or in part by me and I > have the right to submit it under the open source license > indicated in the file; or > > (b) The contribution is based upon previous work that, to the best > of my knowledge, is covered under an appropriate open source > license and I have the right under that license to submit that > work with modifications, whether created in whole or in part > by me, under the same open source license (unless I am > permitted to submit under a different license), as indicated > in the file; or > > (c) The contribution was provided directly to me by some other > person who certified (a), (b) or (c) and I have not modified > it. > > (d) I understand and agree that this project and the contribution > are public and that a record of the contribution (including all > personal information I submit with it, including my sign-off) is > maintained indefinitely and may be redistributed consistent with > this project or the open source license(s) involved. Signed-off-by: Matthias Bünger <[email protected]>
Hey, thanks for the response. |
…G#1384 / TNG#1385) With this commit new general rules are added which detect the usages of old time and date classes, e.g. java.util.Date. closes TNG#1384 > Developer's Certificate of Origin 1.1 > > By making a contribution to this project, I certify that: > > (a) The contribution was created in whole or in part by me and I > have the right to submit it under the open source license > indicated in the file; or > > (b) The contribution is based upon previous work that, to the best > of my knowledge, is covered under an appropriate open source > license and I have the right under that license to submit that > work with modifications, whether created in whole or in part > by me, under the same open source license (unless I am > permitted to submit under a different license), as indicated > in the file; or > > (c) The contribution was provided directly to me by some other > person who certified (a), (b) or (c) and I have not modified > it. > > (d) I understand and agree that this project and the contribution > are public and that a record of the contribution (including all > personal information I submit with it, including my sign-off) is > maintained indefinitely and may be redistributed consistent with > this project or the open source license(s) involved. Signed-off-by: Matthias Bünger <[email protected]>
…G#1384 / TNG#1385) With this commit new general rules are added which detect the usages of old time and date classes, e.g. java.util.Date. closes TNG#1384 > Developer's Certificate of Origin 1.1 > > By making a contribution to this project, I certify that: > > (a) The contribution was created in whole or in part by me and I > have the right to submit it under the open source license > indicated in the file; or > > (b) The contribution is based upon previous work that, to the best > of my knowledge, is covered under an appropriate open source > license and I have the right under that license to submit that > work with modifications, whether created in whole or in part > by me, under the same open source license (unless I am > permitted to submit under a different license), as indicated > in the file; or > > (c) The contribution was provided directly to me by some other > person who certified (a), (b) or (c) and I have not modified > it. > > (d) I understand and agree that this project and the contribution > are public and that a record of the contribution (including all > personal information I submit with it, including my sign-off) is > maintained indefinitely and may be redistributed consistent with > this project or the open source license(s) involved. Signed-off-by: Matthias Bünger <[email protected]>
/ #1385) With this commit new general rules are added which detect the usages of old time and date classes, e.g. java.util.Date. closes #1384 > Developer's Certificate of Origin 1.1 > > By making a contribution to this project, I certify that: > > (a) The contribution was created in whole or in part by me and I > have the right to submit it under the open source license > indicated in the file; or > > (b) The contribution is based upon previous work that, to the best > of my knowledge, is covered under an appropriate open source > license and I have the right under that license to submit that > work with modifications, whether created in whole or in part > by me, under the same open source license (unless I am > permitted to submit under a different license), as indicated > in the file; or > > (c) The contribution was provided directly to me by some other > person who certified (a), (b) or (c) and I have not modified > it. > > (d) I understand and agree that this project and the contribution > are public and that a record of the contribution (including all > personal information I submit with it, including my sign-off) is > maintained indefinitely and may be redistributed consistent with > this project or the open source license(s) involved. Signed-off-by: Matthias Bünger <[email protected]>
hankem
left a comment
There was a problem hiding this comment.
I've reformatted your commit according to the code style of the project (cf. CONTRIBUTING.md).
| .as("since Java 8 (and JavaEE 7 if JPA is needed) java.time-API should be used.") | ||
| .because("since Java 8 (and JavaEE 7 if JPA is needed) java.time-API should be used."); |
There was a problem hiding this comment.
If you use the same text in as and because, you essentially duplicate it in the final rule description:
Rule '
since Java 8 (and JavaEE 7 if JPA is needed) java.time-API should be used., because since Java 8 (and JavaEE 7 if JPA is needed) java.time-API should be used.'was violated [...]
How about
| .as("since Java 8 (and JavaEE 7 if JPA is needed) java.time-API should be used.") | |
| .because("since Java 8 (and JavaEE 7 if JPA is needed) java.time-API should be used."); | |
| .as("java.time API should be used") | |
| .because("legacy date/time APIs have been replaced since Java 8 (JSR 310)"); |
which gives the final rule description
Rule '
java.time API should be used, because legacy date/time APIs have been replaced since Java 8' was violated [...]
- without full stop before
, because, - without the reference to Java EE 7 & JPA, because it might be confusing if the general coding rule is used in an context unrelated to Java EE/JPA, but
- with a reference to JSR 310, which might help unexperienced developers to find more information.
There was a problem hiding this comment.
For your convenience, I've prepared this suggestion on the dateutil-review branch.
There was a problem hiding this comment.
Thank you for your suggestion. I'm fine with that. In my initial version I added the JPA information, because we have that at work, that Java 8 is available, but not JavaEE 7.
Also run spotless tasks, so that should fit too now.
edit: and rebased as obvious after months that there are commits on mains.
/ #1385) With this commit new general rules are added which detect the usages of old time and date classes, e.g. java.util.Date. closes #1384 > Developer's Certificate of Origin 1.1 > > By making a contribution to this project, I certify that: > > (a) The contribution was created in whole or in part by me and I > have the right to submit it under the open source license > indicated in the file; or > > (b) The contribution is based upon previous work that, to the best > of my knowledge, is covered under an appropriate open source > license and I have the right under that license to submit that > work with modifications, whether created in whole or in part > by me, under the same open source license (unless I am > permitted to submit under a different license), as indicated > in the file; or > > (c) The contribution was provided directly to me by some other > person who certified (a), (b) or (c) and I have not modified > it. > > (d) I understand and agree that this project and the contribution > are public and that a record of the contribution (including all > personal information I submit with it, including my sign-off) is > maintained indefinitely and may be redistributed consistent with > this project or the open source license(s) involved. Signed-off-by: Matthias Bünger <[email protected]>
…G#1384 / TNG#1385) With this commit new general rules are added which detect the usages of old time and date classes, e.g. java.util.Date. closes TNG#1384 > Developer's Certificate of Origin 1.1 > > By making a contribution to this project, I certify that: > > (a) The contribution was created in whole or in part by me and I > have the right to submit it under the open source license > indicated in the file; or > > (b) The contribution is based upon previous work that, to the best > of my knowledge, is covered under an appropriate open source > license and I have the right under that license to submit that > work with modifications, whether created in whole or in part > by me, under the same open source license (unless I am > permitted to submit under a different license), as indicated > in the file; or > > (c) The contribution was provided directly to me by some other > person who certified (a), (b) or (c) and I have not modified > it. > > (d) I understand and agree that this project and the contribution > are public and that a record of the contribution (including all > personal information I submit with it, including my sign-off) is > maintained indefinitely and may be redistributed consistent with > this project or the open source license(s) involved. Signed-off-by: Matthias Bünger <[email protected]>
…G#1384 / TNG#1385) With this commit new general rules are added which detect the usages of old time and date classes, e.g. java.util.Date. closes TNG#1384 > Developer's Certificate of Origin 1.1 > > By making a contribution to this project, I certify that: > > (a) The contribution was created in whole or in part by me and I > have the right to submit it under the open source license > indicated in the file; or > > (b) The contribution is based upon previous work that, to the best > of my knowledge, is covered under an appropriate open source > license and I have the right under that license to submit that > work with modifications, whether created in whole or in part > by me, under the same open source license (unless I am > permitted to submit under a different license), as indicated > in the file; or > > (c) The contribution was provided directly to me by some other > person who certified (a), (b) or (c) and I have not modified > it. > > (d) I understand and agree that this project and the contribution > are public and that a record of the contribution (including all > personal information I submit with it, including my sign-off) is > maintained indefinitely and may be redistributed consistent with > this project or the open source license(s) involved. Signed-off-by: Matthias Bünger <[email protected]>
|
@hankem It looks like this nice enhancement is missing in the 1.4.0 release notes. 😢 |
|
Oooh, I'm sorry for overlooking that one! The release notes have been fixed. |
Update:
Provided commit message
I would like to provide rules for #1384, but I'm failing with the
OLD_DATE_AND_TIME_CLASSES_SHOULD_NOT_BE_USED_should_fail_when_class_uses_java_util_datetest as my violation is not captured, but thisCan anyone give me a hint how to fix that?
P.S. I know that my formatting (e.g. star import) are not yet correct. Will fix this when my tests are working and before changing this draft into a real PR, including providing a real commit message.