Skip to content

Commit 85d4616

Browse files
authored
Merge pull request #3668 from kpumuk/release-dates
Added a release date format check to the linter
2 parents 7e29172 + 606a1a1 commit 85d4616

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/linter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def check_releases
125125
errors[release] << invalid_url_message(release.post) if release.post_url_invalid?
126126
errors[release] << "release date and post date do not match" if release.date_mismatch?
127127
errors[release] << missing_post_message(release.post_filename) if release.post_missing?
128+
errors[release] << "release date is a string, not a Date object" if release.date.is_a?(String)
128129
end
129130
end
130131

test/test_linter_invalid_release_data.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,15 @@
5757
create_file("_data/releases.yml", content)
5858
_(linter_output).must_match "release date and post date do not match"
5959
end
60+
61+
it "reports release data with wrong date format" do
62+
content = <<~YAML
63+
- version: 2.7.1
64+
date: '2020-01-01'
65+
post: /en/news/2020/01/01/post/
66+
YAML
67+
68+
create_file("_data/releases.yml", content)
69+
_(linter_output).must_match "release date is a string, not a Date object"
70+
end
6071
end

0 commit comments

Comments
 (0)