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

Commit

Permalink
Move rake task to the Rakefile and use mdl from binstubs
Browse files Browse the repository at this point in the history
  • Loading branch information
dshevtsov committed Jul 11, 2019
1 parent a63a118 commit 7237995
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
16 changes: 14 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,17 @@ task :whatsnew do
print 'Generating data for the weekly digest: $ '.magenta
sh 'whatsup_github'
end
desc 'Run linters'
task lint: %w[lint:md]

desc 'Check Markdown syntax in modified files or in a particular file or directory by path (e.g. path=mftf)'
task :lint do
path = ENV['path']
unless path
staged_files = `git ls-files -m`.split("\n")
staged_md_files = staged_files.select { |file| File.extname(file) == '.md' }
abort 'Cannot find any modified .md files.' if staged_md_files.empty?
path = staged_md_files.join(' ')
end
report = `bin/mdl #{path}`
puts report.yellow
puts 'The rules are defined in _checks/md_style'
end
6 changes: 3 additions & 3 deletions _checks/md-check-hook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#
Jekyll::Hooks.register :site, :post_write do |site|
next unless site.config['serving']
puts 'Checking Markdown syntax.'.blue
staged_files = `git ls-files -m`.split("\n")
staged_md_files = staged_files.select { |file| File.extname(file) == '.md' }
next if staged_md_files.empty?
puts 'Checking Markdown syntax...'.blue
staged_md_files_as_a_string = staged_md_files.join(' ')
report = `mdl #{staged_md_files_as_a_string}`
report = `bin/mdl #{staged_md_files_as_a_string}`
puts report.yellow
puts 'The rules are defined in _checks/md_style'
puts 'The style is defined in _checks/md_style'.yellow
end
17 changes: 0 additions & 17 deletions rakelib/lint.rake

This file was deleted.

0 comments on commit 7237995

Please sign in to comment.