Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 7982961

Browse files
Merge pull request #5195 from magento/sync-with-master
Sync develop with master
2 parents 9bfbde4 + 768d9ae commit 7982961

File tree

77 files changed

+6933
-342
lines changed

Some content is hidden

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

77 files changed

+6933
-342
lines changed

.mdlrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
style '_checks/md_style'
2-
ignore_front_matter true
1+
style '_checks/styles/style-rules-dev'
2+
ignore_front_matter true

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ end
5858
desc 'Pull docs from external repositories'
5959
task init: %w[multirepo:init]
6060

61-
desc 'Run checks (image optimization).'
61+
desc 'Run checks (image optimization and Markdown style linting).'
6262
task check: %w[check:image_optim check:mdl]
6363

64-
desc 'Generate data for a news digest. Default period is a week since today. For other period use "since" argument: since="jul 4"'
64+
desc 'Generate data for a news digest. Default timeframe is a week since today. For other period, use "since" argument: since="jul 4"'
6565
task :whatsnew do
6666
date = ENV['since']
6767
print 'Generating data for the weekly digest: $ '.magenta

_checks/html-check-hook.rb renamed to _checks/html_check_hook.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# The hook runs html-proofer with options defined in the
24
# _config.checks.yml file
35
#
@@ -15,17 +17,20 @@
1517
# Do not exit when html-proofer raises an error
1618
begin
1719
# Check 'url_ignore' in '_config.checks.yml'
18-
# and add 'excludes' from Jekyll configurtiuon.
20+
# and add 'excludes' from Jekyll configuration.
1921
#
2022
checks_config = YAML.load_file('_config.checks.yml')
2123
url_ignore = checks_config.dig('html-proofer', :url_ignore)
2224
jekyll_excludes = site.config['exclude']
23-
jekyll_excludes_as_regex = jekyll_excludes.map { |item| Regexp.new Regexp.escape(item) }
25+
jekyll_excludes_as_regex =
26+
jekyll_excludes.map do |item|
27+
Regexp.new Regexp.escape(item)
28+
end
2429

2530
if url_ignore
2631
url_ignore.push(jekyll_excludes_as_regex).flatten!.uniq!
2732
else
28-
checks_config['html-proofer'].merge!({ url_ignore: jekyll_excludes_as_regex })
33+
checks_config['html-proofer'].merge!(url_ignore: jekyll_excludes_as_regex)
2934
end
3035

3136
# Read configuration options for html-proofer
@@ -36,8 +41,8 @@
3641

3742
# Show the message when html-proofer fails.
3843
# Expected that it fails when it finds broken links.
39-
rescue StandardError => msg
40-
puts msg
44+
rescue StandardError => e
45+
puts e
4146
puts 'Fix the broken links before you push the changes to remote branch.'.blue
4247
end
4348
end
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1+
# frozen_string_literal: true
2+
13
# This Jekyll hook runs Markdown linter (https://github.com/markdownlint/markdownlint)
24
# on .md files that git tracks as 'modified' ('git ls-files -m').
3-
# '_checks/md_style' sets a style (https://github.com/markdownlint/markdownlint/blob/master/docs/creating_styles.md)
5+
# '_checks/styles/style-rules-dev' sets a style (https://github.com/markdownlint/markdownlint/blob/master/docs/creating_styles.md)
46
# that is a set of rules to be applied when linting (https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md).
57
# '.mdlrc' sets linting configuration (https://github.com/markdownlint/markdownlint/blob/master/docs/configuration.md).
68
#
79
# The plugin runs in serving mode only.
810
#
911
Jekyll::Hooks.register :site, :post_write do |site|
1012
next unless site.config['serving']
13+
1114
staged_files = `git ls-files -m`.split("\n")
1215
staged_md_files = staged_files.select { |file| File.extname(file) == '.md' }
1316
next if staged_md_files.empty?
17+
1418
puts 'Checking Markdown syntax...'.blue
1519
staged_md_files_as_a_string = staged_md_files.join(' ')
1620
report = `bin/mdl #{staged_md_files_as_a_string}`
1721
puts report.yellow
18-
puts 'The style is defined in _checks/md_style'.yellow
22+
puts 'The style is defined in _checks/styles/style-rules-dev'.yellow
1923
end
File renamed without changes.

_checks/styles/style-rules-prod

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
exclude_rule 'MD001'
2+
exclude_rule 'MD002'
3+
exclude_rule 'MD003'
4+
exclude_rule 'MD004'
5+
exclude_rule 'MD005'
6+
exclude_rule 'MD006'
7+
exclude_rule 'MD007'
8+
exclude_rule 'MD009'
9+
exclude_rule 'MD010'
10+
exclude_rule 'MD011'
11+
exclude_rule 'MD012'
12+
exclude_rule 'MD013'
13+
exclude_rule 'MD014'
14+
exclude_rule 'MD018'
15+
exclude_rule 'MD019'
16+
exclude_rule 'MD020'
17+
exclude_rule 'MD021'
18+
exclude_rule 'MD022'
19+
exclude_rule 'MD023'
20+
exclude_rule 'MD024'
21+
exclude_rule 'MD025'
22+
exclude_rule 'MD026'
23+
exclude_rule 'MD027'
24+
exclude_rule 'MD028'
25+
exclude_rule 'MD029'
26+
exclude_rule 'MD030'
27+
exclude_rule 'MD031'
28+
exclude_rule 'MD032'
29+
exclude_rule 'MD033'
30+
exclude_rule 'MD034'
31+
exclude_rule 'MD035'
32+
exclude_rule 'MD036'
33+
exclude_rule 'MD037'
34+
exclude_rule 'MD038'
35+
exclude_rule 'MD039'
36+
exclude_rule 'MD040'
37+
exclude_rule 'MD041'
38+
exclude_rule 'MD046'

_config.checks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#
55
html-proofer:
66

7+
# Validate HTML
8+
:check_html: true
9+
710
# Do not check external links.
811
:disable_external: true
912

0 commit comments

Comments
 (0)