Giter VIP home page Giter VIP logo

flamalyzer's Introduction

Flamalyzer - Static code analysis for Flamingo projects

Flamalyzer is a vet-like tool which detects common errors in Flamingo projects.

Installation

go install flamingo.me/flamalyzer@latest

Usage

Flamalyzer [FLAGS] [PATH]

Flags

There are different Flags which can be passed, if no Flags given the Flamalyzer will run in default mode.

--configFolder=[PATH]

To define the path to your config-files, the default is ./.flamalyzer

--configSuffix=[SUFFIX]

To define a string which must occur in the config-files name which should be loaded (useful if you have different files for different use-cases)

--debugFlamalyzer

To enable more information about what's going on in the program. Like info if the given configFolder-Path isn't configured properly.

Run Flamalyzer within vet

go vet -vettool=$(which flamalyzer) [PATH]

Filewatcher

Flamalyzer can be used as external filewatcher to enable error-highlighting in the IDE. Flamalyzer's output matches exactly vet's output, so the filewatcher configuration from vet can be used.

Available Analyses

Dingo: Pointer receiver check

This analysis checks that an inject-function has a pointer-receiver

Dingo: correct interface binding check

This analysis checks that an instance implements the interface it is bound to.

Dingo: proper inject tags check

This analysis checks if the inject tags are used properly.

"inject tags" should be used for annotated injections only (e.g. config), otherwise inject method should be used.

This means:

  • No empty inject tags
  • Inject tags can be defined in the Inject-Function or must be referenced if defined outside
  • They must be declared in the same package as the Inject-Function

Architecture: dependency conventions check

This analysis checks all import statements below the entry path that the provided Group-Conventions are respected.

Configuration example:

entrypaths: ["src/architecture"]
groups:
  infrastructure: ["infrastructure", "interfaces", "application", "domain"]
  interfaces:     ["interfaces", "application", "domain"]
  application:    ["application", "domain"]
  domain:         ["domain"]

Configuration

The Configuration is done via yaml-files.

The files are expected in ./.flamalyzer

The directory can be specified by --configFolder=[PATH]

config.yaml example:

# Config of the Dingo-Analyzer
dingoAnalyzer:
  checkPointerReceiver: false
  checkStrictTagsAndFunctions: false
  checkCorrectInterfaceToInstanceBinding: false

# Config of the DependencyConventions-Analyzer
architectureAnalyzer:
  entryPaths: []
  checkDependencyConventions: true
  groups:
    infrastructure: ["infrastructure", "interfaces", "application", "domain"]
    interfaces:     ["interfaces", "application", "domain"]
    application:    ["application", "domain"]
    domain:         ["domain"]

There is the possibility to filter the files which should be read in.

Use --configSuffix=[SUFFIX] to pass a string which must be part of config-file name.

flamalyzer's People

Contributors

tessig avatar domeej 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.