Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
refactor: refactor defsec into components (#1461)
Browse files Browse the repository at this point in the history
* refactor: remove defsec cmd

* fix linter issue

* refactor: restore tf context

* refactor: remove spec package

* refactor: remove rules pkg

* test: remove extrafs dep

* refactor: restore package for rego conversion

* refactor: remove formatters pkg

* chore: run go mod tidy

* chore: remove replacements of unused packages

* remove scripts

* remove setup-opa action

* remove adapter linter

* remove outdated-api-update workflow

* chore: cleanup Makefile and remove unnecessary workflows

* chore: run go mod tidy
  • Loading branch information
nikpivkin authored Sep 22, 2023
1 parent d6485e0 commit 525d6bd
Show file tree
Hide file tree
Showing 49 changed files with 472 additions and 4,047 deletions.
13 changes: 0 additions & 13 deletions .github/actions/setup-opa/action.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/adapter-lint.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/outdated-api-update.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/release.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/test-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ jobs:
go-version-file: go.mod
cache: false

- name: Run non-localstack tests
if: matrix.os != 'ubuntu-latest'
run: make test-no-localstack
shell: bash
- name: Run full tests
if: matrix.os == 'ubuntu-latest'
run: make test
shell: bash
41 changes: 0 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
DYNAMIC_REGO_FOLDER=./rules/kubernetes/policies/dynamic

.PHONY: test
test:
go test -race ./...

.PHONY: test-no-localstack
test-no-localstack:
go test $$(go list ./... | grep -v internal/adapters/cloud/aws | awk -F'github.com/aquasecurity/defsec/' '{print "./"$$2}')

.PHONY: typos
typos:
which codespell || pip3 install codespell
Expand All @@ -22,38 +16,3 @@ fix-typos:
quality:
which golangci-lint || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.2
golangci-lint run --timeout 3m --verbose

.PHONY: update-loader
update-loader:
python3 scripts/update_loader_rules.py
@goimports -w pkg/rules/rules.go

.PHONY: metadata_lint
metadata_lint:
go run ./cmd/lint

.PHONY: docs
docs:
go run ./cmd/avd_generator

.PHONY: docs-test
docs-test:
go test -v ./cmd/avd_generator/...

.PHONY: update-aws-deps
update-aws-deps:
@grep aws-sdk-go-v2 go.mod | grep -v '// indirect' | sed 's/^[\t\s]*//g' | sed 's/\s.*//g' | xargs go get
@go mod tidy

.PHONY: adapter-lint
adapter-lint:
go run ./cmd/adapter-lint/main.go ./internal/adapters/...
go run ./cmd/adapter-lint/main.go ./pkg/providers/...

.PHONY: outdated-api-updated
outdated-api-updated:
sed -i.bak "s|recommendedVersions :=.*|recommendedVersions := $(OUTDATE_API_DATA)|" $(DYNAMIC_REGO_FOLDER)/outdated_api.rego && rm $(DYNAMIC_REGO_FOLDER)/outdated_api.rego.bak

.PHONY: build
build:
go build -o bin/defsec ./cmd/defsec
10 changes: 0 additions & 10 deletions cmd/adapter-lint/main.go

This file was deleted.

74 changes: 0 additions & 74 deletions cmd/defsec/aws.go

This file was deleted.

55 changes: 0 additions & 55 deletions cmd/defsec/fs.go

This file was deleted.

29 changes: 0 additions & 29 deletions cmd/defsec/main.go

This file was deleted.

38 changes: 0 additions & 38 deletions cmd/defsec/output.go

This file was deleted.

Loading

0 comments on commit 525d6bd

Please sign in to comment.