Architecture contract (ARCH6204)
Ce contenu n’est pas encore disponible dans votre langue.
Key ruby.architecture.contract · Severity error · Category architecture
Flags a constant reference against the layer direction, a vertical slice’s boundary or the project’s own architecture rules: code under packs/, components/, engines/, features/ or slices/ using another slice’s behaviour (a class with instance methods - its values, constants and structs are allowed); a service or model using a controller; a model using a service, repository or query object; or any dependency a rule in Project settings > Scanning forbids. Constants are resolved to files by the Rails (Zeitwerk) naming convention, the way Ruby looks them up; layers and slices are read from folders, not class names.
Incorrect
Section titled “Incorrect”class Order < ApplicationRecord after_commit { OrderService::CreateOrderInSap.call(self) }endCorrect
Section titled “Correct”class OrderService::PlaceOrder def call(order) order.save! OrderService::CreateOrderInSap.call(order) endend