Skip to content

lint: clarify that Config excluded_paths targets the input file_path, not the finding location.path #1502

@loeffel-io

Description

@loeffel-io

Hey @noahdietz,

i have troubles to ignore some error messages from a specific filepath (location path)

// aip-linter.yaml

- excluded_paths:
    - 'google/iam/v1/iam_policy.proto'
sh_test(
    name = "user_v1_proto_api_linter",
    srcs = ["@rules//:api_linter"],
    args = [
        "mindful/earth/user/v1/user.proto",
        "mindful/earth/user/v1/organization.proto",
        "--config $(location :aip_linter.yaml)",
        "--set-exit-status",
        "--descriptor-set-in $(location :user_v1_proto_descriptor_set)",
        "--disable-rule core::0191::java-package",
        "--disable-rule core::0191::java-multiple-files",
        "--disable-rule core::0191::java-outer-classname",
        "--disable-rule core::0157::request-read-mask-field",
        "--disable-rule core::0134::request-mask-field",
        "--disable-rule core::0132::request-field-types",
    ],
    data = [
        ":aip_linter.yaml",
        ":user_v1_proto",
        ":user_v1_proto_descriptor_set",
    ],
    visibility = ["//visibility:private"],
)

the aip linter does read the config file but the the specified path isn't excluded?

bazel run @rules//:api_linter -- --version
api-linter 1.69.2

still prints:

➜  earth-user-service-proto git:(feature/loeffel-io/bzlmod) ✗ bazel run //mindful/earth/user/v1:user_v1_proto_api_linter
INFO: Analyzed target //mindful/earth/user/v1:user_v1_proto_api_linter (1 packages loaded, 6 targets configured).
INFO: Found 1 target...
Target //mindful/earth/user/v1:user_v1_proto_api_linter up-to-date:
  bazel-bin/mindful/earth/user/v1/user_v1_proto_api_linter
INFO: Elapsed time: 0.241s, Critical Path: 0.01s
INFO: 1 process: 7 action cache hit, 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: external/bazel_tools/tools/test/test-setup.sh mindful/earth/user/v1/user_v1_proto_api_linter mindful/earth/user/v1/user.proto mindful/earth/user/v1/organization.proto --config mindful/earth/user/v1/aip_linter.yaml --set-exit-status --descriptor-set-in mindful/earth/user/v1/user_v1_proto_descriptor_set.pb --disable-rule core::0191::java-package --disable-rule core::0191::java-multiple-files --disable-rule core::0191::java-outer-classname --disable-rule core::0157::request-read-mask-field --disable-rule core::0134::request-mask-field --disable-rule core::0132::request-field-types
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //mindful/earth/user/v1:user_v1_proto_api_linter
-----------------------------------------------------------------------------
- file_path: mindful/earth/user/v1/user.proto
  problems:
    - message: google.api.field_behavior annotation must be set on "options" and contain one of, "{"IMMUTABLE", "OPTIONAL", "OUTPUT_ONLY", "REQUIRED"}"
      location:
        start_position:
            line_number: 1
            column_number: 1
        end_position:
            line_number: 1
            column_number: 1
        path: google/iam/v1/iam_policy.proto
      rule_id: core::0203::field-behavior-required
      rule_doc_uri: https://linter.aip.dev/203/field-behavior-required
    - message: google.api.field_behavior annotation must be set on "update_mask" and contain one of, "{"IMMUTABLE", "OPTIONAL", "OUTPUT_ONLY", "REQUIRED"}"
      location:
        start_position:
            line_number: 1
            column_number: 1
        end_position:
            line_number: 1
            column_number: 1
        path: google/iam/v1/iam_policy.proto
      rule_id: core::0203::field-behavior-required
      rule_doc_uri: https://linter.aip.dev/203/field-behavior-required
- file_path: mindful/earth/user/v1/organization.proto
  problems: []
2025/07/16 19:51:30 found problems during linting

adding disabled_rules works:

- excluded_paths:
    - 'google/iam/v1/iam_policy.proto'
  disabled_rules:
    - 'core::0203::field-behavior-required'

Thank you!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions