rules

package module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 2 Imported by: 1

README

delivery-club-rules

Delivery club go rules linter

Tests Go Report Card Go Reference

How to use:

Full installation example: https://github.com/peakle/dc-rules-example

  1. Install rules:
    go get -v github.com/delivery-club/delivery-club-rules
    
  2. Create rules.go file in your project like in example
  3. Add linter to your pipeline:
    1. Like another one check in golangci-lint (will work for golangci-lint >v1.46.0):

      linters:
        enable:
          - gocritic
      linters-settings:
        gocritic:
          enabled-checks:
            - ruleguard
          settings:
            ruleguard:
              rules: "YourDir/rules.go"
      
    2. Like explicit check WITHOUT golangci-lint:

      1. install binary by curl or go install:
      curl -sSfL https://raw.githubusercontent.com/delivery-club/delivery-club-rules/master/releaser/install.sh | sh -s -- -d -b $(go env GOPATH)/bin latest
      

      OR

      go install -v github.com/delivery-club/delivery-club-rules/cmd/dcRules@latest
      
      1. Run lint:
      dcRules ./...
      
    3. Like file watcher in Goland IDE (will work for golangci-lint >v1.46.0):

      1. add golangci-lint as File Watcher in IDE (Preferences -> Tools -> File Watchers -> Add)
      2. set Arguments field where .golangci.yml file will be like example above:
      run $FileDir$ --config=$ProjectFileDir$/.golangci.yml
      
How to update to new rules version:
  1. update rules version in your go.mod file
  2. download new rules version:
    go get github.com/delivery-club/delivery-club-rules@newVersion
    
  3. if you using golangci-lint update cache:
    golangci-lint cache clean
    
How to add new checks:
  1. Ruleguard tour for newbees: https://go-ruleguard.github.io/by-example
  2. Fork repo && open PR :D

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bundle = dsl.Bundle{}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
precompile

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL