diff --git a/Makefile b/Makefile index 44106dc1..80351b25 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,7 @@ bootstrap: ## Download and install all go dependencies (+ prep tooling in the ./ [ -f "$(TEMPDIR)/goreleaser" ] || curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh -s -- -b $(TEMPDIR)/ v0.140.0 .PHONY: static-analysis -static-analysis: lint check-licenses validate-schema +static-analysis: lint check-licenses .PHONY: lint lint: ## Run gofmt + golangci lint checks @@ -100,11 +100,6 @@ lint: ## Run gofmt + golangci lint checks $(eval MALFORMED_FILENAMES := $(shell find . | grep -e ':')) @bash -c "[[ '$(MALFORMED_FILENAMES)' == '' ]] || (printf '\nfound unsupported filename characters:\n$(MALFORMED_FILENAMES)\n\n' && false)" -.PHONY: validate-schema -validate-schema: - # ensure the codebase is only referencing a single grype-db schema version, multiple is not allowed - python test/validate_schema.py - .PHONY: validate-cyclonedx-schema validate-cyclonedx-schema: cd schema/cyclonedx && make diff --git a/test/validate_schema.py b/test/validate_schema.py deleted file mode 100644 index 285ecce5..00000000 --- a/test/validate_schema.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python2 -import re -import os -import sys - -pattern = re.compile(r'github.com/anchore/grype-db/pkg/db/v(?P\d+)') - -def main(): - schema_versions_found = set() - - for root, dirs, files in os.walk("."): - for file in files: - if not file.endswith(".go"): - continue - with open(os.path.join(root, file)) as f: - for match in pattern.findall(f.read(), re.MULTILINE): - schema_versions_found.add(match) - - num_schemas = len(schema_versions_found) - if num_schemas != 1: - sys.exit("Found multiple schemas: %s" % repr(schema_versions_found)) - - try: - for x in schema_versions_found: - int(x) - except Exception: - sys.exit("Non-numeric schema found: %s" % repr(schema_versions_found)) - - print("Schemas Found: %s" % repr(schema_versions_found)) - -if __name__ == "__main__": - main()