-
-
Notifications
You must be signed in to change notification settings - Fork 746
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
Use regex-lint to provide circular dependency checking in pants #5778
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Note that for values that are regexes, how YAML interprets backslashes and other | ||
# special characters matters. For example, an unquoted string is interpreted as a raw | ||
# string with no escape characters (so it's particularly useful for expressing regexes). | ||
# Adding quotes around these may change their meaning, so don't do so without thought. | ||
|
||
required_matches: | ||
# If we decide to enable this, remove the st2flake8 | ||
#python_source: | ||
# - python_header | ||
#build_files: | ||
# - python_header | ||
|
||
# TODO: In the future pants should get `visibility` and possibly other | ||
# features to restrict imports for dependees or dependencies. | ||
# - https://github.com/pantsbuild/pants/issues/13393 | ||
# - https://github.com/pantsbuild/pants/pull/15803 | ||
# - https://github.com/pantsbuild/pants/pull/15836 | ||
# When that happens, we can add that target metadata, | ||
# and remove these regex based dependency checks. | ||
|
||
# st2client-dependencies-check | ||
st2client: | ||
- must_not_import_st2common | ||
|
||
# st2common-circular-dependencies-check | ||
st2common: | ||
- must_not_import_st2reactor | ||
- must_not_import_st2api | ||
- must_not_import_st2auth | ||
#- must_not_import_st2actions | ||
#- must_not_import_st2stream | ||
st2common_except_services_inquiry: | ||
# The makefile excluded: runnersregistrar.py, compat.py, inquiry.py | ||
# runnersregistrar does not have an st2actions ref since 2016. | ||
# compat.py st2actions function was added and removed in 2017. | ||
# services/inquiry.py still imports st2actions. | ||
- must_not_import_st2actions | ||
st2common_except_router: | ||
# The makefile excluded router.py from st2stream check. | ||
# In router.py, "st2stream" is a string, not an import. | ||
- must_not_import_st2stream | ||
|
||
path_patterns: | ||
#- name: python_source | ||
# pattern: (?<!__init__)\.py$ | ||
#- name: build_files | ||
# pattern: /BUILD$ | ||
|
||
- name: st2client | ||
pattern: st2client/st2client/.*\.py$ | ||
- name: st2common | ||
pattern: st2common/st2common/.*\.py$ | ||
|
||
- name: st2common_except_services_inquiry | ||
pattern: st2common/st2common/(?!services/inquiry\.py).*\.py$ | ||
|
||
- name: st2common_except_router | ||
pattern: st2common/st2common/(?!router\.py).*\.py$ | ||
|
||
content_patterns: | ||
#- name: python_header | ||
# pattern: |+ | ||
# ^(?:#\!\/usr\/bin\/env python3 | ||
# )?# Copyright 20\d\d The StackStorm Authors. | ||
# (?:# Copyright 20\d\d .* | ||
# )*# | ||
# # Licensed under the Apache License, Version 2.0 (the "License"); | ||
# # you may not use this file except in compliance with the License. | ||
# # You may obtain a copy of the License at | ||
# # | ||
# # http://www.apache.org/licenses/LICENSE-2.0 | ||
# # | ||
# # Unless required by applicable law or agreed to in writing, software | ||
# # distributed under the License is distributed on an "AS IS" BASIS, | ||
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# # See the License for the specific language governing permissions and | ||
# # limitations under the License. | ||
|
||
- name: must_not_import_st2common | ||
pattern: st2common | ||
inverted: true | ||
|
||
- name: must_not_import_st2reactor | ||
pattern: st2reactor | ||
inverted: true | ||
|
||
- name: must_not_import_st2actions | ||
pattern: st2actions | ||
inverted: true | ||
|
||
- name: must_not_import_st2api | ||
pattern: st2api | ||
inverted: true | ||
|
||
- name: must_not_import_st2auth | ||
pattern: st2auth | ||
inverted: true | ||
|
||
- name: must_not_import_st2stream | ||
pattern: st2stream | ||
inverted: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does inverted mean here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Search for
st2common
but mark files as successful if they do NOT have the string.