Skip to content

Commit

Permalink
Fix incorrect Custom Configuration for Import Rules documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mnhock committed Jul 29, 2024
1 parent 3cf753d commit c3d3728
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/USERGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,15 @@ If a `namespaceImport` is not explicitly provided, it defaults to `Namespace.IMP
Here's an example of how you can use these methods to create a custom configuration:

```java
ImportsConfigurer configurer = new ImportsConfigurer();
configurer.shouldNotImport("com.example.package", Configuration.of("com.example.namespace", Namespace.IMPORT.WITHOUT_TESTS));
Taikai.builder()
.namespace("com.company.yourproject")
.java(java -> java
.imports(imports -> imports
.shouldHaveNoCycles()
.shouldNotImport("..shaded..", Configuration.of("com.company.yourproject.different", Namespace.IMPORT.WITHOUT_TESTS))
.shouldNotImport("..lombok.."), Configuration.of(Namespace.IMPORT.ONLY_TESTS)))
.build()
.check();
```

In this example, the import rule is configured to apply to classes within the specified namespace, excluding test classes.
Expand Down

0 comments on commit c3d3728

Please sign in to comment.