[importlinter]
root_package = wemake_python_styleguide
include_external_packages = True


[importlinter:contract:layers]
name = Layered architecture of our linter
type = layers

containers =
  wemake_python_styleguide

layers =
  checker
  formatter
  transformations
  presets
  visitors
  violations
  logic
  compat
  options
  constants
  types


# TODO: provide independence contract for visitors
[importlinter:contract:violation-independence]
name = Independence contract for violations (all shall be free!)
type = independence

modules =
  wemake_python_styleguide.violations.system
  wemake_python_styleguide.violations.naming
  wemake_python_styleguide.violations.complexity
  wemake_python_styleguide.violations.consistency
  wemake_python_styleguide.violations.best_practices
  wemake_python_styleguide.violations.refactoring
  wemake_python_styleguide.violations.oop


[importlinter:contract:flake8-independence]
name = Independence contract for flake8 API (all shall be free!)
type = independence

modules =
  wemake_python_styleguide.checker
  wemake_python_styleguide.formatter


[importlinter:contract:api-restrictions]
name = Forbids to import anything from dependencies
type = forbidden

source_modules =
  wemake_python_styleguide

forbidden_modules =
  # Std imports we don't like:
  dataclasses

  # Important direct and indirect dependencies:
  flake8

  pygments
  pyflakes
  pycodestyle
  mccabe

ignore_imports =
  # These modules must import from flake8 to provide required API:
  wemake_python_styleguide.checker -> flake8
  wemake_python_styleguide.formatter -> flake8
  wemake_python_styleguide.options.config -> flake8
  # We disallow direct imports of our dependencies from anywhere, except:
  wemake_python_styleguide.formatter -> pygments


[importlinter:contract:subapi-restrictions]
name = Forbids to import anything from our sub-API packages
type = forbidden

source_modules =
  wemake_python_styleguide.visitors
  wemake_python_styleguide.violations
  wemake_python_styleguide.compat
  wemake_python_styleguide.logic

forbidden_modules =
  # Our sub-API parts:
  wemake_python_styleguide.options.config
  wemake_python_styleguide.transformations
  wemake_python_styleguide.presets


[importlinter:contract:tests-restrictions]
name = Explicit import restrictions for tests
type = forbidden

source_modules =
  wemake_python_styleguide

forbidden_modules =
  tests
