Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add import_paths on the configuration file (#2) #1275

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tonicospinelli
Copy link

@tonicospinelli tonicospinelli commented Oct 18, 2023

These changes reduce tricks some projects face to get proto import path dependencies when it depends on multiple resources in different paths.

Here is a snippet of how some projects use it:

find api/proto -name '*.proto' -print0 2>/dev/null | xargs -0 --no-run-if-empty -n 1 \
		api-linter --set-exit-status --config .api-linter.yml \
		$(sed -n -e '/roots:/,/:$/{s/^\s*- /-I /p}' buf.yaml)

or

find api/proto -name '*.proto' -print0 2>/dev/null | xargs -0 --no-run-if-empty -n 1 \
		api-linter --set-exit-status --config .api-linter.yml \
		-I import/path1 -I import/path2

Adding import_paths in the configuration file is helpful to centralize the api-linter directives. See:

- include_paths:
    - path_1/**/*.proto
  import_paths:
    - import/path

Using the above config file the command was pretty easy to use:

$ find api/proto -name '*.proto' -print0 2>/dev/null | xargs -0 --no-run-if-empty -n 1 \
		api-linter --set-exit-status --config .api-linter.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant