🔍 Git-based linter tool that scans code changes for compliance with defined rules in source code.
go get -u github.com/EthanThatOneKid/difflint
difflint --help
# File: ./main.py
#LINT.IF
print("Edit me first!")
#LINT.END bar
#LINT.IF :bar
print("Edit me second!")
#LINT.END
# 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
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
git diff | difflint --ext_map="difflint.json"
{
"yaml": ["#LINT.?"]
}
Run the tool from source with the Go toolchain:
go run cli/main.go --help
Created with 💖 by @EthanThatOneKid