Class: Danger::DangerRubyc

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

Overview

This is your plugin class. Any attributes or methods you expose here will be available from within your Dangerfile.

To be published on the Danger plugins site, you will need to have the public interface documented. Danger uses [YARD](yardoc.org/) for generating documentation from your plugin source, and you can verify by running ‘danger plugins lint` or `bundle exec rake spec`.

You should replace these comments with a public description of your library.

Examples:

Ensure people are well warned about merging on Mondays


my_plugin.warn_on_mondays

See Also:

  • Stanislav/danger-rubyc

Instance Method Summary collapse

Instance Method Details

#lintObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rubyc/plugin.rb', line 20

def lint
  broken_files = []

  changed_files.each do |file|
    next unless File.readable?(file)

    if file.end_with?('.rb') || file.eql?('Rakefile')
      broken_files << file unless system('ruby', '-c', file)
    end
  end

  if !broken_files.empty?
    fail("Ruby code is not valid (SyntaxError) in files:
      **#{broken_files.join('<br/>')}**
    ")
  end

end