Coder Social home page Coder Social logo

edugomez / layer_linter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seddonym/layer_linter

0.0 2.0 0.0 91 KB

Layer Linter checks that your project follows a layered architecture that you define.

License: Other

Makefile 3.80% Python 96.20%

layer_linter's Introduction

Layer Linter

Python versions https://api.travis-ci.org/seddonym/layer_linter.svg?branch=master Documentation Status Updates

Layer Linter checks that your project follows a custom-defined layered architecture.

Overview

Layer Linter can be used as part of an automated test suite to check that you are following a self-imposed layered architecture within your Python project. This is particularly useful if you are working on a complex codebase within a team, when you want to enforce a particular architectural style.

To define how layers work within your project, you create a layers.yaml file. This file prescribes the order in which different modules within your project may import from each other.

Running the layer-lint command will parse the file, analyse your project's internal dependencies within your project, and error if you are violating your prescribed architecture.

Quick start

Install Layer Linter:

pip install layer-linter

Create a layers.yaml in the root of your project, in this format:

My Layers Contract:
  packages:
    - myproject.packageone
    - myproject.packagetwo
    - myproject.packagethree
  layers:
    - highlevelmodule
    - mediumlevelmodule
    - lowlevelmodule

From your project root, run:

layer-lint myproject

If your code violates the contract, you will see an error message as follows:

============
Layer Linter
============

---------
Contracts
---------

Analyzed 23 files, 44 dependencies.
-----------------------------------

My layer contract BROKEN

Contracts: 0 kept, 1 broken.

----------------
Broken contracts
----------------


My layer contract
-----------------


1. myproject.packagetwo.lowlevelmodule imports myproject.packagetwo.highlevelmodule:

    myproject.packagetwo.lowlevelmodule <-
    myproject.utils <-
    myproject.packagetwo.highlevelmodule

layer_linter's People

Contributors

pyup-bot avatar seddonym avatar

Watchers

 avatar  avatar

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.