-
Notifications
You must be signed in to change notification settings - Fork 290
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 rules for packages #263
Comments
Are you sure that this doesn't work? I've used the
|
Thank you for providing me with very simple snippet! Is it possible to force developer to create |
In theory yes, but you would need to define, where a
If you only want certain packages (e.g. top-level packages), you would have to filter the packages to analyse. Since you talk about "force the developers", I usually rather talk about "support the developers to remember what they decided" 😉. Because usually only conventions that are really accepted and supported by the vast majority of the developers work. For example, if you want to enforce a
Which then has little value. Just my two cents 😉 |
Thank you for such beautiful examples! I successfully managed to write it, but in another, much uglier way. I really like your position on agreements and decisions. I believe that some moments must be discussed, like coding style, but some decisions should be made by the lead himself. Having non-null annotations really simplifies maintenance, but you'll see it only in a long run. Regarding the issue... Can I ask you to consider extending |
Sorry for the delay! I like |
Issue TNG#263 Signed-off-by: Roland Weisleder <roland.weisleder@googlemail.com>
Issue TNG#263 Signed-off-by: Roland Weisleder <roland.weisleder@googlemail.com>
I looked at #290 and it looks really nice. Would love to have it merged! What do you think about adding some rules like |
We could add a simple entry point to the API, like |
Issue TNG#263 Signed-off-by: Roland Weisleder <roland.weisleder@googlemail.com>
Issue TNG#263 Signed-off-by: Roland Weisleder <roland.weisleder@googlemail.com>
Issue #263 Signed-off-by: Roland Weisleder <roland.weisleder@googlemail.com>
Issue #263 Signed-off-by: Roland Weisleder <roland.weisleder@googlemail.com>
I'm trying to achieve the following with the new API's but I'm not sure on what to do What I'm trying to do is the following (pseudo code):
Can this already be done? |
@royteeuwen As of ArchUnit 1.0.1, there is no fluent API for @ArchTest
void packagesShouldBeAnnotated(JavaClasses classes) {
var rootPackage = classes.getPackage(ROOT_PACKAGE);
var violations = rootPackage.getSubpackagesInTree().stream()
.filter(pkg -> !pkg.isAnnotatedWith(ANNOTATION))
.map(pkg -> pkg.getDescription() + " is not annoted with @" + ANNOTATION.getSimpleName());
assertThat(violations).as("violations").isEmpty();
} (Note that |
I'd like to check that every package has
package-info.java
withNonNullApi
andNonNullFields
annotations:Currently I can do it only via reflection, not via bytecode.
Please add a possibility of checking packages' annotations.
The text was updated successfully, but these errors were encountered: