Class: Danger::DangerOrmolu

Inherits:
Plugin
  • Object
show all
Defined in:
lib/ormolu/plugin.rb

Overview

Lint haskell files against ormolu formatting

Examples:

Ensure the files are correctly formatted


ormolu.check files

See Also:

  • blackheaven/danger-ormolu

Instance Method Summary collapse

Instance Method Details

#check(files, path: 'ormolu', args: '', level: :warn) ⇒ void

This method returns an undefined value.

Check that the files are correctly formatted

Parameters:

  • files (Array<String>)


18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ormolu/plugin.rb', line 18

def check(files, path: 'ormolu', args: '', level: :warn)
  files
    .each do |file|
      result = `#{path} #{args} --mode stdout --check-idempotence "#{file}" | diff "#{file}" -`
      next if result.empty?

      extract_diffs(result.lines)
        .each do |diff|
          inconsistence(file, diff[:line], diff[:diff], level)
        end
    end
end