Skip to content

Comments

Fix changelog files & add a simple validator#5199

Merged
dlang-bot merged 2 commits intodlang:masterfrom
wilzbach:fix-changelog
Feb 26, 2017
Merged

Fix changelog files & add a simple validator#5199
dlang-bot merged 2 commits intodlang:masterfrom
wilzbach:fix-changelog

Conversation

@wilzbach
Copy link
Contributor

It seems that not everyone was consistent with the changelog format - some people even left out the description :O

The changelog tool should enforce that there's a blank line after the title line.

Well the changelog tool isn't called here directly, but on DAutoTest.

I tried to fix the changelog files & added a simple validator, s.t. we can at least automatically ensure that

  • the entry contains a description (and a separating line between them)
  • has no $(REF) in the title

Yes in theory the changed.d could have a flag ---validate, but I would like to have this check enforced before next summer (PRs at tools have a tendency to hang in the queue).

Or, alternatively, allow multiple lines for the title, until the first blank line.

I don't think it's worth supporting this as (a) it's not the git commit format anymore and (b) a title shouldn't be that long anyways.
However in case this is wanted (and dlang/tools#220 is merged), the validator would need a small update.

CC @aG0aep6G

(This is a follow-up to #5192)

posix.mak Outdated
@echo "Validate changelog files (Do _not_ use REF in the title!)"
@echo " - Title line can't contain REF - it's already a link"
@echo " - After the title line an empty, separating line is expected"
@echo " - Which is supposed to be followed by a long description"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of all this noise, could you please only print if if the validation fails?

@aG0aep6G
Copy link
Contributor

I tried to fix the changelog files & added a simple validator, s.t. we can at least automatically ensure that

the entry contains a description (and a separating line between them)

FWIW, one-liners used to be ok. They would be displayed directly in the list, not as a jump link to a more detailed description. Example: the third point under "Library Changes" in the 2.072.0 changelog.

I don't mind if we abandon that style, though. It messes with the numbering when jump links and one-liner are mixed (e.g., "Implementation of MurmurHash digest." is number 4 in the short list, but number 3 in the long list).

Alternatively, allow one-liners, don't make jump links from them, allow links in them, and automatically put them at the end, behind the long-form entries.

posix.mak Outdated
@echo " - Which is supposed to be followed by a long description"
for file in $$(find changelog -name '*.dd') ; do \
echo "Testing: $$file"; \
cat $$file | head -n1 | grep -nq '\$$' ; [ $$? -eq 0 ] && exit 1 ; \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just check for the dollar sign, right? I.e., it rejects all macros? This seems too restrictive. Macros that don't generate links should be allowed.

@wilzbach
Copy link
Contributor Author

Not a fan of all this noise, could you please only print if if the validation fails?

Done.
@andralex: do you want me to hide all the other greps in another PR?

FWIW, one-liners used to be ok. They would be displayed directly in the list, not as a jump link to a more detailed description. Example: the third point under "Library Changes" in the 2.072.0 changelog.

Imho if someone already makes the effort to open a new file it's not a big deal to add an additional line and it really helps the reader if there's a short example included.

I don't mind if we abandon that style, though. It messes with the numbering when jump links and one-liner are mixed (e.g., "Implementation of MurmurHash digest." is number 4 in the short list, but number 3 in the long list).

Yet another reason to always require a description =)

Alternatively, allow one-liners, don't make jump links from them, allow links in them, and automatically put them at the end, behind the long-form entries.

Sure, the changelog tool could handle them properly and sort the list, but as mentioned above I don't think it's worth the effort.
(at the moment it just dumps them as entries with an empty description)

posix.mak Outdated

@echo "Validate changelog files (Do _not_ use REF in the title!)"
@for file in $$(find changelog -name '*.dd') ; do \
echo "Testing: $$file"; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

posix.mak Outdated
@echo "Validate changelog files (Do _not_ use REF in the title!)"
@for file in $$(find changelog -name '*.dd') ; do \
echo "Testing: $$file"; \
cat $$file | head -n1 | grep -nqE '\$$\((REF|LINK2|HTTP|MREF)' ; [ $$? -eq 0 ] && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of [ $$? -eq 0 ] && use ||

@echo "Enforce space between binary operators"
grep -nrE "[[:alnum:]](==|!=|<=|<<|>>|>>>|^^)[[:alnum:]]|[[:alnum:]] (==|!=|<=|<<|>>|>>>|^^)[[:alnum:]]|[[:alnum:]](==|!=|<=|<<|>>|>>>|^^) [[:alnum:]]" $$(find . -name '*.d'); test $$? -eq 1

@echo "Validate changelog files (Do _not_ use REF in the title!)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Copy link
Contributor Author

@wilzbach wilzbach Feb 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is consistent with all other checks. If you want to make the checks less noisy, I am happy to do so, but then we should do this for all checks and then in another PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, then things should be fine for this PR at least. Thanks!

@dlang-bot dlang-bot merged commit 37b5393 into dlang:master Feb 26, 2017
@wilzbach wilzbach deleted the fix-changelog branch February 26, 2017 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants