Skip to content

Commit

Permalink
Gencel (#1)
Browse files Browse the repository at this point in the history
* gencel - initial commit

* Improved function overload name with correct suffix

* Can accept the whole pacakage as input.

Instead of passing in a particular file path, now it's possible to
provide the package directory and gencel will generate on all the files
of the package

* Added more conversions and support for ignoring certain funcs with regex

* Added more type conversions and a simple test

* WIP: Added support for multiple returns

* Added gen files

* Added support for multiple returns

* Handle package namespace

Example: Don't use just `IfAddrs` use the full name with pkg name also
`sockaddr.IfAddrs`

* Handle maps & arrays. Ignore _gen.go file as the source

* Ignore variadic functions for now

* Added tests for funcs that have multiple returns

* Created a celEnv var that consists of all the generated cel function

* Added namespaces to cel function to avoid collion for same function name
and type.

Example: the function `Match(pattern, name interface{}) (matched bool,
err error)` is defined for filepath, path. Now they're accessible as
path.Match & filepath.Match

* WIP: Support for variadic functions.

Renamed naming scheme for the cel funcs

* Added support for variadic functions ✔

* Added more test cases

* Handle imports for some files.

* chore: clean up

* don't generate cel functions for aws, gcp, and few others

* do not namespace some functions

* chore: removed build github workflows

* fix: lint errors and disabled some linters
  • Loading branch information
adityathebe authored Jul 13, 2023
1 parent ba6c978 commit ed70a73
Show file tree
Hide file tree
Showing 33 changed files with 5,010 additions and 243 deletions.
63 changes: 0 additions & 63 deletions .github/workflows/build.yml

This file was deleted.

103 changes: 0 additions & 103 deletions .github/workflows/docker.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/image-scan.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.git
.bin
bin
report.xml
./gomplate
*.cid
*.iid
*.out

.vscode
26 changes: 17 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
linters-settings:
govet:
check-shadowing: true
enable:
- fieldalignment
# enable:
# - fieldalignment FIXME:
golint:
min-confidence: 0
gocyclo:
min-complexity: 10
dupl:
threshold: 100
gocritic:
disabled-checks:
- singleCaseSwitch # FIXME:
goconst:
min-len: 2
min-occurrences: 4
staticcheck:
go: "1.20"
checks:
- "all"
- "-SA1019"
lll:
line-length: 140
nolintlint:
Expand All @@ -25,8 +33,8 @@ linters:
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
# - deadcode FIXME:
# - depguard FIXME:
# - dogsled
# - dupl
# - errcheck
Expand All @@ -44,13 +52,13 @@ linters:
- gofmt
# - gofumpt
- goheader
- goimports
# - goimports FIXME:
# - gomnd
- gomodguard
- goprintffuncname
- gosec
# - gosec FIXME:
- gosimple
- govet
# - govet FIXME:
- ineffassign
# - lll
- misspell
Expand All @@ -60,7 +68,7 @@ linters:
# - noctx
# - nolintlint
- prealloc
- revive
# - revive FIXME:
- rowserrcheck
- sqlclosecheck
- staticcheck
Expand All @@ -69,7 +77,7 @@ linters:
- typecheck
- unconvert
# - unparam
- unused
# - unused FIXME:
- varcheck
# - whitespace
# - wsl
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,15 @@ ci-lint:
.PHONY: gen-changelog clean test build-x build-release build test-integration-docker gen-docs lint clean-images clean-containers docker-images
.DELETE_ON_ERROR:
.SECONDARY:

.PHONY: gencel
gencel:
go build -o .bin/gencel -gcflags="all=-N -l" cmd/gencel.go

.PHONY: gencel-gen
gencel-gen: gencel
cd funcs/ && ../.bin/gencel

.PHONY: cleancel
cleancel:
rm funcs/*_gen.go
Loading

0 comments on commit ed70a73

Please sign in to comment.