Skip to content

Describe and check architectural constraints of a Go project using a composable set of rules described in one or multiple yaml files.

License

Notifications You must be signed in to change notification settings

omissis/goarkitect

Repository files navigation

GoArkitect

crkitect

This project gives developers the ability to describe and check architectural constraints of a project using a composable set of rules described in one or multiple yaml files.

Badges

GitHub release (latest SemVer) GitHub Workflow Status (event) License GitHub go.mod Go version GitHub code size in bytes GitHub repo file count (file type) GitHub all releases GitHub commit activity Conventional Commits Codecov branch Code Climate maintainability

Installation

homebrew tap

brew tap omissis/goarkitect
brew install goarkitect

docker

docker pull omissis/goarkitect:latest

manually

Download the pre-compiled binaries from the releases page and copy them to the desired location.

Example configuration

---
rules:
  - name: all inner asdf manifests contain golang, possibly in its 1.23.2 version  # name of the rule, it should tell what the rule is about
    kind: file # name of the matcher to use, which tells what objects it will operate on
    matcher:
      kind: all # the all kind sets the matcher to match all possible files, which will be narrowed down below
    thats: # 'thats' apply filtering to the selected matchers to narrow down the files to operate on
      - kind: end_with # matcher filter that selects only files whose name ends with .tool-versions"
        suffix: .tool-versions
    excepts: # 'excepts' allow to pull some special cases out of the set of file determined by the 'thats' filters
      - kind: this # excepts the one in the root directory
        filePath: ./.tool-versions
    musts: # 'musts' will trigger errors in case the expectation is not respected, which in turn will have goarkitect to exit with status code 1
      - kind: contain_value
        value: golang
    shoulds: # 'shoulds' will trigger warnings, which won't cause error status codes on exit
      - kind: contain_value
        value: golang 1.23.2
    coulds: # 'coulds' will trigger info-level notices, and they can be seen as suggestions
      - kind: contain_value
        value: golangci-lint
    because: "it is needed for the project to compile the source code" # reason for the rule to exists

See the examples folder for more complete information on how to configure goarkitect rules.

Example usage

# validate the default config file (.goarkitect.yaml) and outputs the result in json
goarkitect validate --output=json

# validate the custom .ark.yaml config file
goarkitect validate .ark.yaml

# validate the custom .ark.yaml config file and all the config files found in the .ark/ folder
goarkitect validate .ark.yaml .ark/

# verify that the current folder follows the rules specified in the default config file (.goarkitect.yaml)
goarkitect verify

# verify that the current folder follows the rules specified in the .ark/ folder and outputs the result in json
goarkitect verify .ark/ --output=json

Acknowledgements

Goarkitect draws inspiration from Alessandro Minoccheri's PHPArkitect, a tool that helps you to keep your PHP codebase coherent and solid.

About

Describe and check architectural constraints of a Go project using a composable set of rules described in one or multiple yaml files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •