github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/Makefile (about)

     1  DYNAMIC_REGO_FOLDER=./rules/kubernetes/policies/dynamic
     2  
     3  .PHONY: test
     4  test:
     5  	go test -race ./...
     6  
     7  .PHONY: test-no-localstack
     8  test-no-localstack:
     9  	go test $$(go list ./... | grep -v internal/adapters/cloud/aws | awk -F'github.com/khulnasoft-lab/defsec/' '{print "./"$$2}')
    10  
    11  .PHONY: rego
    12  rego: fmt-rego test-rego
    13  
    14  .PHONY: schema
    15  schema:
    16  	go run ./cmd/schema generate
    17  
    18  .PHONY: fmt-rego
    19  fmt-rego:
    20  	opa fmt -w rules/cloud/policies
    21  
    22  .PHONY: test-rego
    23  test-rego:
    24  	go test --run Test_AllRegoRules ./test
    25  
    26  .PHONY: typos
    27  typos:
    28  	which codespell || pip3 install codespell
    29  	codespell -S funcs,.terraform,.git --ignore-words .codespellignore -f
    30  
    31  .PHONY: fix-typos
    32  fix-typos:
    33  	which codespell || pip3 install codespell
    34  	codespell -S funcs,.terraform --ignore-words .codespellignore -f -w -i1
    35  
    36  .PHONY: quality
    37  quality:
    38  	which golangci-lint || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.2
    39  	golangci-lint run --timeout 3m --verbose
    40  
    41  .PHONY: update-loader
    42  update-loader:
    43  	python3 scripts/update_loader_rules.py
    44  	@goimports -w pkg/rules/rules.go
    45  
    46  .PHONY: metadata_lint
    47  metadata_lint:
    48  	go run ./cmd/lint
    49  
    50  .PHONY: docs
    51  docs:
    52  	go run ./cmd/avd_generator
    53  
    54  .PHONY: docs-test
    55  docs-test:
    56  	go test -v ./cmd/avd_generator/...
    57  
    58  .PHONY: id
    59  id:
    60  	@go run ./cmd/id
    61  
    62  .PHONY: update-aws-deps
    63  update-aws-deps:
    64  	@grep aws-sdk-go-v2 go.mod | grep -v '// indirect' | sed 's/^[\t\s]*//g' | sed 's/\s.*//g' | xargs go get
    65  	@go mod tidy
    66  
    67  .PHONY: adapter-lint
    68  adapter-lint:
    69  	go run ./cmd/adapter-lint/main.go ./internal/adapters/...
    70  	go run ./cmd/adapter-lint/main.go ./pkg/providers/...
    71  
    72  .PHONY: outdated-api-updated
    73  outdated-api-updated:
    74  	sed -i.bak "s|recommendedVersions :=.*|recommendedVersions := $(OUTDATE_API_DATA)|" $(DYNAMIC_REGO_FOLDER)/outdated_api.rego && rm $(DYNAMIC_REGO_FOLDER)/outdated_api.rego.bak
    75  
    76  .PHONY: bundle
    77  bundle:
    78  	./scripts/bundle.sh
    79  
    80  .PHONY: build
    81  build:
    82  	go build -o bin/defsec ./cmd/defsec