-
Notifications
You must be signed in to change notification settings - Fork 122
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
Check if any news fragments have invalid filenames #622
Changes from all commits
0993534
3c93f13
618e325
935a831
26c60ff
060c5d3
2ce2b27
9b68503
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 | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -101,12 +101,14 @@ def __main( | |||||||||||||||||||||||
click.echo(f"{n}. {change}") | ||||||||||||||||||||||||
click.echo("----") | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# This will fail if any fragment files have an invalid name: | ||||||||||||||||||||||||
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. I don't think that this comment is needed. The docstring for 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. I added this comment to make sure anyone thinks twice before possibly moving this back down below to just before the result is used (because the next part could lead this this check being skipped) 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. We can keep it. No problem. The critical part is to make sure that we have automated tests that will fail is anyone would move this code :) 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. I think this will fail because of the control case fragment, but I haven't tried moving the line back down and re-running towncrier/src/towncrier/test/test_check.py Lines 493 to 503 in 3c93f13
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. We need to check this, as the test are the critical part of a PR. 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. Done (test updated to ensure) 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. Thanks. I didn't had time to check the test coverage... but if say that you have checked it, we can have this merged :) no problem |
||||||||||||||||||||||||
all_fragment_files = find_fragments(base_directory, config, strict=True)[1] | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
news_file = os.path.normpath(os.path.join(base_directory, config.filename)) | ||||||||||||||||||||||||
if news_file in files: | ||||||||||||||||||||||||
click.echo("Checks SKIPPED: news file changes detected.") | ||||||||||||||||||||||||
sys.exit(0) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
all_fragment_files = find_fragments(base_directory, config)[1] | ||||||||||||||||||||||||
fragments = set() # will only include fragments of types that are checked | ||||||||||||||||||||||||
unchecked_fragments = set() # will include fragments of types that are not checked | ||||||||||||||||||||||||
for fragment_filename, category in all_fragment_files: | ||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
``towncrier check`` will now fail if any news fragments have invalid filenames. | ||
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. Not sure how this will ended up in the rendered version. We should have 2 fragments here. and another one for the But maybe the If 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. I feel like the addition of the config option and the new fail behaviour are intertwined, so I think it makes sense to have them in the same fragment. At least I think the change in behaviour of I could rewrite this to be clearer, how about:
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. As you think it's best we can leave it as it is. no problem. |
||
|
||
Added a new configuration option called ``ignore`` that allows you to specify a list of filenames that should be ignored. If this is set, ``towncrier build`` will also fail if any filenames are invalid, except for those in the list. |
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.
It looks like with this change, the coverage if failing for line 30 :(
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.
Ah right, I think my latest commit should sort that