-
-
Notifications
You must be signed in to change notification settings - Fork 227
Be nicer about possible misconfigurations #1004
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
Changes from 6 commits
771046c
263dc5b
4497912
90810a3
d9b4d24
cdcc699
5f20c3e
a23d5fe
27ae4d8
2fa7927
2ac4f08
9193ec9
027a52d
6c8c164
b85281d
0c22186
1ecf351
517ed80
24bb92d
c9d1bb2
fa84748
fd82193
ab6cf05
1f57be6
8cf87be
7225533
d9b3b29
5170451
09095ff
58c9758
fee09f4
88b2fe6
82857a4
59defe7
45eb1b2
1f49a81
411e933
6f9544a
739a67c
1bac9b5
fa69479
773ad45
53e9930
2bfbb25
1ac50c2
c9b3860
d081257
9ea57a0
d8d2b86
d75201a
9645373
49a89c9
3e613cd
234b74f
65ac14d
bb33eb7
a2ba78a
67d154a
d37c280
573bee1
6d46996
a4f3d38
102f56a
15620f3
74fa5be
f1e8074
98450d7
545ce7e
199f90b
e161622
4ec3208
c0e5743
0213170
6e81a26
4d0d50b
6f53d67
b3db2c5
ff50699
532554f
715ef95
4a48455
6eb52e6
d0daf6f
12fc28e
5f7ba15
4b29ab9
d665621
c8e5505
2e0c6a9
24d7797
be34dd1
24719f2
3c145df
a558f31
09c1f51
c766df1
327b428
c633987
34a89a9
3d8cefe
5d3a1f8
15d62ac
1ddd483
51822d7
ae5322b
051ad96
2b0722f
9b6f031
d49399b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,9 +41,9 @@ def _check_tag_regex(value: str | Pattern[str] | None) -> Pattern[str]: | |
|
||
group_names = regex.groupindex.keys() | ||
if regex.groups == 0 or (regex.groups > 1 and "version" not in group_names): | ||
warnings.warn( | ||
"Expected tag_regex to contain a single match group or a group named" | ||
" 'version' to identify the version part of any tag." | ||
raise ValueError( | ||
f"Expected tag_regex '{regex.pattern}' to contain a single match group or" | ||
" a group named 'version' to identify the version part of any tag." | ||
) | ||
|
||
return regex | ||
|
@@ -105,6 +105,9 @@ class Configuration: | |
|
||
parent: _t.PathT | None = None | ||
|
||
def __post_init__(self) -> None: | ||
self.tag_regex = _check_tag_regex(self.tag_regex) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. taking this here without leaving it in place creates potental trouble for valies valid in config but not in the config objects |
||
|
||
@property | ||
def absolute_root(self) -> str: | ||
return _check_absolute_root(self.root, self.relative_to) | ||
|
@@ -139,13 +142,11 @@ def from_data( | |
given configuration data | ||
create a config instance after validating tag regex/version class | ||
""" | ||
tag_regex = _check_tag_regex(data.pop("tag_regex", None)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this check needs to say even if the validation gets more struct |
||
version_cls = _validate_version_cls( | ||
data.pop("version_cls", None), data.pop("normalize", True) | ||
) | ||
return cls( | ||
relative_to, | ||
version_cls=version_cls, | ||
tag_regex=tag_regex, | ||
**data, | ||
) |
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.
this one is possibly a breaking change im not sure we can integrate it off hand