Skip to content

EthanThatOneKid/difflint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

difflint

Go Reference

๐Ÿ” Git-based linter tool that scans code changes for compliance with defined rules in source code.

Installation

go get -u github.com/EthanThatOneKid/difflint

Usage

difflint --help

Single file

# File: ./main.py

#LINT.IF

print("Edit me first!")

#LINT.END bar

#LINT.IF :bar

print("Edit me second!")

#LINT.END

Multiple files

# File ./foo.py

#LINT.IF

print("Edit me first!")

#LINT.END bar
# File: ./main.py

#LINT.IF ./foo.py:bar

print("Edit me second!")

#LINT.END

Exhaustive switch statement

In programming languages lacking a comprehensive match statement for enumerations, our only option is to verify whether the switch statement aligns with the enumerated type.

//LINT.IF

enum Thing {
  ONE = 1,
  TWO = 2,
}

//LINT.END :thing_enum

//LINT.IF :thing_enum

switch (thing) {
  case Thing.ONE: {
    return doThingOne();
  }

  case Thing.TWO: {
    return doThingTwo();
  }
}

//LINT.END

Custom file extensions

git diff | difflint --ext_map="difflint.json"

difflint.json

{
  "yaml": ["#LINT.?"]
}

Development

Run the tool from source with the Go toolchain:

go run cli/main.go --help

Created with ๐Ÿ’– by @EthanThatOneKid

About

๐Ÿ” Git-based linter tool that scans code changes for compliance with defined rules in source code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages