mirror of
https://github.com/anchore/grype
synced 2024-11-10 14:44:12 +00:00
remove schema-validation checks
No longer required since it is always going to be one schema imported as part of `db` Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
parent
6c3cb94c03
commit
38e3405f0e
2 changed files with 1 additions and 38 deletions
7
Makefile
7
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
|
||||
|
|
|
@ -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<version>\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()
|
Loading…
Reference in a new issue