diff --git a/tools/src/test/proto/buf_breaking-remote.yaml b/tools/src/test/proto/buf_breaking-remote.yaml index ef404300..e3fecdfd 100644 --- a/tools/src/test/proto/buf_breaking-remote.yaml +++ b/tools/src/test/proto/buf_breaking-remote.yaml @@ -1,14 +1,6 @@ # This is the config for "Buf" - a ProtocolBuffer linter/checker/more # see https://buf.build/docs/configuration/v2/buf-yaml version: v2 -lint: # https://buf.build/docs/configuration/v2/buf-yaml#lint - except: - - FIELD_NOT_REQUIRED - - PACKAGE_NO_IMPORT_CYCLE - disallow_comment_ignores: true breaking: # https://buf.build/docs/configuration/v2/buf-yaml#breaking use: # see https://buf.build/docs/breaking/overview#rules-and-categories - - WIRE - except: - - EXTENSION_NO_DELETE - - FIELD_SAME_DEFAULT + - WIRE \ No newline at end of file diff --git a/tools/src/test/proto/buf_breaking-version.yaml b/tools/src/test/proto/buf_breaking-version.yaml index 79ee4962..222a4ed4 100644 --- a/tools/src/test/proto/buf_breaking-version.yaml +++ b/tools/src/test/proto/buf_breaking-version.yaml @@ -1,15 +1,9 @@ # This is the config for "Buf" - a ProtocolBuffer linter/checker/more # see https://buf.build/docs/configuration/v2/buf-yaml version: v2 -lint: # https://buf.build/docs/configuration/v2/buf-yaml#lint - except: - - FIELD_NOT_REQUIRED - - PACKAGE_NO_IMPORT_CYCLE - disallow_comment_ignores: true breaking: # https://buf.build/docs/configuration/v2/buf-yaml#breaking use: # see https://buf.build/docs/breaking/overview#rules-and-categories - WIRE except: - - EXTENSION_NO_DELETE - - FIELD_SAME_DEFAULT - - FILE_SAME_PACKAGE + # scope is to detect changes from one version to the other -> so ignore "FILE_SAME_PACKAGE" + - FILE_SAME_PACKAGE \ No newline at end of file diff --git a/tools/src/test/proto/buf_lint.yaml b/tools/src/test/proto/buf_lint.yaml index b16877fa..109f5eaa 100644 --- a/tools/src/test/proto/buf_lint.yaml +++ b/tools/src/test/proto/buf_lint.yaml @@ -2,22 +2,25 @@ # see https://buf.build/docs/configuration/v2/buf-yaml version: v2 lint: # https://buf.build/docs/configuration/v2/buf-yaml#lint - use: # see https://buf.build/docs/breaking/overview#rules-and-categories - - DEFAULT + use: # see https://buf.build/docs/lint/rules + - STANDARD # https://buf.build/docs/lint/rules/#standard + # - COMMENTS # https://buf.build/docs/lint/rules/#comments except: - - DIRECTORY_SAME_PACKAGE - - FIELD_LOWER_SNAKE_CASE - - FIELD_NOT_REQUIRED - - FILE_LOWER_SNAKE_CASE - - PACKAGE_DIRECTORY_MATCH - - PACKAGE_NO_IMPORT_CYCLE - - PACKAGE_VERSION_SUFFIX + # directory/file layout does not match the recommendation/framework of the tool + - DIRECTORY_SAME_PACKAGE # https://buf.build/docs/lint/rules#directory_same_package + - PACKAGE_DIRECTORY_MATCH # https://buf.build/docs/lint/rules#package_lower_snake_case + - FILE_LOWER_SNAKE_CASE # https://buf.build/docs/lint/rules#file_lower_snake_case + # we do not stick to the following best-practices and recommendations: + # (shall be fixed with v2.0 of this very schema) + - PACKAGE_VERSION_SUFFIX # https://buf.build/docs/lint/rules#package_version_suffix + - FIELD_LOWER_SNAKE_CASE # https://buf.build/docs/lint/rules#field_lower_snake_case ignore_only: - DEFAULT: - - schema/bom-1.3.proto - - schema/bom-1.4.proto - - schema/bom-1.5.proto -breaking: # https://buf.build/docs/configuration/v2/buf-yaml#breaking - except: - - EXTENSION_NO_DELETE - - FIELD_SAME_DEFAULT + # legacy schema files may NOT stick to the rules -- this is acknowledged. + STANDARD: + - "schema/bom-1.5.proto" + - "schema/bom-1.4.proto" + - "schema/bom-1.3.proto" + COMMENTS: + - "schema/bom-1.5.proto" + - "schema/bom-1.4.proto" + - "schema/bom-1.3.proto" diff --git a/tools/src/test/proto/mig/buf.yaml b/tools/src/test/proto/mig/buf.yaml deleted file mode 100644 index 3a499919..00000000 --- a/tools/src/test/proto/mig/buf.yaml +++ /dev/null @@ -1,21 +0,0 @@ -version: v2 -lint: - use: - - DEFAULT - except: - - DIRECTORY_SAME_PACKAGE - - FIELD_LOWER_SNAKE_CASE - - FIELD_NOT_REQUIRED - - FILE_LOWER_SNAKE_CASE - - PACKAGE_DIRECTORY_MATCH - - PACKAGE_NO_IMPORT_CYCLE - - PACKAGE_VERSION_SUFFIX - ignore_only: - DEFAULT: - - schema/bom-1.3.proto - - schema/bom-1.4.proto - - schema/bom-1.5.proto -breaking: - except: - - EXTENSION_NO_DELETE - - FIELD_SAME_DEFAULT diff --git a/tools/src/test/proto/test.sh b/tools/src/test/proto/test.sh index 4a43531d..a0c1c384 100755 --- a/tools/src/test/proto/test.sh +++ b/tools/src/test/proto/test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -ue +set -uex THIS_PATH="$(realpath "$(dirname "$0")")" ROOT_PATH="$(realpath "${THIS_PATH}/../../../..")" @@ -32,7 +32,6 @@ function schema-lint () { --workdir '/workspace' \ bufbuild/buf:"$BUF_IMAGE_VERSION" \ lint --path "$SCHEMA_DIR" \ - --config 'buf.yaml' \ --error-format "$LOG_FORMAT" echo '>> OK.' >&2 @@ -57,14 +56,13 @@ function schema-breaking-version () { echo ">> compare new:${NEW} -VS- old:${OLD}" >&2 # stick with the original path of "$NEW", so the reporting makes sense... docker run --rm \ - --volume "${ROOT_PATH}/${SCHEMA_DIR}/${NEW}:/workspace/${SCHEMA_DIR}/${NEW}:ro" \ - --volume "${ROOT_PATH}/${SCHEMA_DIR}/${OLD}:/workspace/${SCHEMA_DIR_OLD}/${NEW}:ro" \ - --volume "${THIS_PATH}/buf_breaking-version.yaml:/workspace/buf.yaml:ro" \ - --workdir '/workspace' \ + --volume "${ROOT_PATH}/${SCHEMA_DIR}/${OLD}:/workspaces/old/${NEW}:ro" \ + --volume "${ROOT_PATH}/${SCHEMA_DIR}/${NEW}:/workspaces/new/${NEW}:ro" \ + --volume "${THIS_PATH}/buf_breaking-version.yaml:/workspaces/new/buf.yaml:ro" \ + --workdir '/workspaces' \ bufbuild/buf:"$BUF_IMAGE_VERSION" \ - breaking "$SCHEMA_DIR" \ - --against "$SCHEMA_DIR_OLD" \ - --config 'buf.yaml' \ + breaking new \ + --against old \ --error-format "$LOG_FORMAT" } @@ -90,9 +88,8 @@ function schema-breaking-remote () { --volume "${THIS_PATH}/buf_breaking-remote.yaml:/workspace/buf.yaml:ro" \ --workdir '/workspace' \ bufbuild/buf:"$BUF_IMAGE_VERSION" \ - breaking "$SCHEMA_DIR" \ - --against "${REMOTE}#subdir=${SCHEMA_DIR}" \ - --config 'buf.yaml' \ + breaking --path "$SCHEMA_DIR" \ + --against "${REMOTE}" \ --error-format "$LOG_FORMAT" echo '>> OK.' >&2