Skip to content

Commit 9e7e228

Browse files
authored
Block bad dates from SQL (#4318)
* Block bad dates from SQL * Approved exceptions
1 parent f2f949c commit 9e7e228

File tree

185 files changed

+223
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+223
-226
lines changed

sql/.sqlfluff

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ extended_capitalisation_policy = upper
5252

5353
[sqlfluff:rules:convention.blocked_words]
5454
# Regex of blocked SQL that should not be used.
55-
# Can be overridden with `-- noqa: CV09` for those chapters using secondary pages
55+
# Can be overridden with `-- noqa: CV09` for those chapters using other dates
5656
# TABLESAMPLE - sometimes used for testing. Shouldn't be used in production as not random.
5757
# sample_data - sometimes used for testing. Shouldn't be used in production.
58-
# Block 2022_05_12 (contains secondary pages)
59-
# Block 2022_06_09 (contains secondary pages)
60-
# Block 2022_07_01 (probably forgot to update month to June for 2022)
61-
# Block 2021_06_01 (probably forgot to update month to July for 2021)
62-
blocked_regex = (TABLESAMPLE|sample_data|2022_?05_?12|2022_?06_?09|2022_?07_?01|2021_?06_?01)
58+
# The Web Almanac has run in different months due to timing or delays. This
59+
# means it's easy to use the wrong month by copying a previous query and only
60+
# updating the year and not the month. Block those months to warn about this.
61+
blocked_regex = (TABLESAMPLE|sample_data|2025-?08-?01|2025-?06-?01|2024-?08-?01|2024-?07-?01|2022-?08-?01|2022-?07-?01|2021-?06-?01|2021-?08-?01|2020-?07-?01)
6362

6463
[sqlfluff:rules:convention.count_rows]
6564
prefer_count_0 = True

sql/2020/cms/core_web_vitals_distribution.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ON
3636
IF(device = 'desktop', 'desktop', 'mobile') = client
3737
WHERE
3838
# The CrUX 202008 dataset is not available until September 8.
39-
date = '2020-07-01'
39+
date = '2020-07-01' -- noqa: CV09
4040
GROUP BY
4141
client,
4242
cms

sql/2020/cms/core_web_vitals_passing.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ON
6161
IF(device = 'desktop', 'desktop', 'mobile') = client
6262
WHERE
6363
# The CrUX 202008 dataset is not available until September 8.
64-
date = '2020-07-01'
64+
date = '2020-07-01' -- noqa: CV09
6565
GROUP BY
6666
client,
6767
cms

sql/2021/media/video_source_types.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ FROM
1111
UNNEST(REGEXP_EXTRACT_ALL(body, '(?i)(<video.*?</video>)')) AS video,
1212
UNNEST(REGEXP_EXTRACT_ALL(video, r'(?i)type\s*=\s*["\'](video/[^\'";?]*)')) AS video_type
1313
WHERE
14-
date = '2021-08-01' AND
14+
date = '2021-08-01' AND -- noqa: CV09
1515
firstHtml
1616
GROUP BY
1717
client,

sql/2021/media/video_tag_and_js_player.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ FROM (
4343
FROM
4444
`httparchive.almanac.requests`
4545
WHERE
46-
date = '2021-08-01' AND
46+
date = '2021-08-01' AND -- noqa: CV09
4747
type = 'script'
4848
GROUP BY
4949
client,

sql/2022/accessibility/focus_outline_0.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ FROM (
5959
`httparchive.almanac.parsed_css`,
6060
UNNEST(getFocusStylesOutline0(css)) AS sets_outline_0
6161
WHERE
62-
date = '2022-07-01'
62+
date = '2022-07-01' -- noqa: CV09
6363
GROUP BY
6464
client,
6565
page

sql/2022/accessibility/focus_visible.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ FROM (
7373
LEFT JOIN
7474
UNNEST(getSelectorParts(css).pseudo_class) AS pseudo_class
7575
WHERE
76-
date = '2022-07-01' AND
76+
date = '2022-07-01' AND -- noqa: CV09
7777
# Limit the size of the CSS to avoid OOM crashes.
7878
LENGTH(css) < 0.1 * 1024 * 1024
7979
GROUP BY

sql/2022/accessibility/media_query_features.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ FROM (
5050
LEFT JOIN
5151
UNNEST(getMediaQueryFeatures(css)) AS feature
5252
WHERE
53-
date = '2022-07-01' AND
53+
date = '2022-07-01' AND -- noqa: CV09
5454
feature IS NOT NULL
5555
)
5656
JOIN (

sql/2022/accessibility/units_properties.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ FROM (
117117
`httparchive.almanac.parsed_css`,
118118
UNNEST(getPropertyUnits(css)) AS unit
119119
WHERE
120-
date = '2022-07-01' AND
120+
date = '2022-07-01' AND -- noqa: CV09
121121
# Limit the size of the CSS to avoid OOM crashes.
122122
LENGTH(css) < 0.1 * 1024 * 1024
123123
)

sql/2022/css/all_functions.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ FROM (
6262
totals
6363
USING (client)
6464
WHERE
65-
date = '2022-07-01'
65+
date = '2022-07-01' -- noqa: CV09
6666
GROUP BY
6767
client,
6868
prop

0 commit comments

Comments
 (0)