GithubHelp home page GithubHelp logo

enofex / taikai Goto Github PK

View Code? Open in Web Editor NEW
79.0 6.0 2.0 169 KB

Taikai is an extension of the popular ArchUnit library, offering a comprehensive suite of predefined rules tailored for various technologies.

License: MIT License

Java 100.00%
archunit testing junit5

taikai's Introduction

maven workflow

Taikai

Taikai extends the capabilities of the popular ArchUnit library by offering a comprehensive suite of predefined rules tailored for various technologies. It simplifies the enforcement of architectural constraints and best practices in your codebase, ensuring consistency and quality across your projects.

Maven Usage

Add Taikai as a dependency in your pom.xml:

<dependency>
  <groupId>com.enofex</groupId>
  <artifactId>taikai</artifactId>
  <version>${taikai.version}</version>
  <scope>test</scope>
</dependency>

Replace ${taikai.version} with the appropriate version defined in your project. Ensure that the required dependencies like ArchUnit are already declared.

JUnit 5 Example Test

Here's an example demonstrating the usage of Taikai with JUnit 5. Customize rules as needed using TaikaiRule.of().

@Test
void shouldFulfillConstraints() {
  Taikai.builder()
      .namespace("com.enofex.taikai")
      .java(java -> java
          .noUsageOfDeprecatedAPIs()
          .methodsShouldNotDeclareGenericExceptions()
          .utilityClassesShouldBeFinalAndHavePrivateConstructor()
          .imports(imports -> imports
              .shouldHaveNoCycles()
              .shouldNotImport("..shaded..")
              .shouldNotImport("org.junit.."))
          .naming(naming -> naming
              .classesShouldNotMatch(".*Impl")
              .methodsShouldNotMatch("foo")
              .fieldsShouldNotMatch("bar")
              .fieldsShouldMatch("com.awesome.Foo", "foo")
              .constantsShouldFollowConventions()
              .interfacesShouldNotHavePrefixI()))
      .logging(logging -> logging
          .loggersShouldFollowConventions(Logger.class, "logger", EnumSet.of(PRIVATE, FINAL)))      
      .test(test -> test
          .junit5(junit5 -> junit5
              .classesShouldNotBeAnnotatedWithDisabled()
              .methodsShouldNotBeAnnotatedWithDisabled()))
      .spring(spring -> spring
          .noAutowiredFields()
          .boot(boot -> boot
              .springBootApplicationShouldBeIn("com.enofex.taikai"))
          .configurations(configuration -> configuration
              .namesShouldEndWithConfiguration())
          .controllers(controllers -> controllers
              .shouldBeAnnotatedWithRestController()
              .namesShouldEndWithController()
              .shouldNotDependOnOtherControllers()
              .shouldBePackagePrivate())
          .services(services -> services
              .shouldBeAnnotatedWithService()
              .shouldNotDependOnControllers()
              .namesShouldEndWithService())
          .repositories(repositories -> repositories
              .shouldBeAnnotatedWithRepository()
              .shouldNotDependOnServices()
              .namesShouldEndWithRepository()))      
      .addRule(TaikaiRule.of(...)) // Add custom ArchUnit rule here
      .build()
      .check();
}

User Guide

Explore the complete documentation for comprehensive information on all available rules.

Contributing

Interested in contributing? Check out our Contribution Guidelines for details on how to get involved. Note, that we expect everyone to follow the Code of Conduct.

What you will need

  • Git
  • Java 21 or higher

Get the Source Code

Clone the repository

git clone [email protected]:enofex/taikai.git
cd taikai

Build the code

To compile, test, and build

./mvnw clean package -B

taikai's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar mnhock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

taikai's Issues

Add Support for Centralized Configuration of Rules Across Multiple Projects Using YAML

Currently, the configuration for each project's rules is handled individually, which can lead to inconsistencies and difficulties in managing multiple projects. To streamline this process, we propose using a YAML configuration file to define the namespace, rules, and other settings for multiple projects in a centralized manner. This will ensure consistency and ease of management.

Related to #42

Offer taikai rules through arch-unit-maven-plugin

Hi there,

I am following the activity in the project, which seems great by the way!

One thing I would like to know if it is been considered already, is providing Taikai with/within arch-unit-maven-plugin: https://github.com/societe-generale/arch-unit-maven-plugin

Because if I have many modules and would like to run against all of them, would be better to run trough the plugin instead of replicating the same rules all over the place.

Do you consider it a feasible idea or do you have another approach in mind?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.