Class: GitlabDanger

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab_roulette/gitlab_danger.rb

Constant Summary collapse

MESSAGE_PREFIX =
'==>'.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gitlab_danger_helper) ⇒ GitlabDanger

Returns a new instance of GitlabDanger.



30
31
32
# File 'lib/gitlab_roulette/gitlab_danger.rb', line 30

def initialize(gitlab_danger_helper)
  @gitlab_danger_helper = gitlab_danger_helper
end

Instance Attribute Details

#gitlab_danger_helperObject (readonly)

Returns the value of attribute gitlab_danger_helper.



28
29
30
# File 'lib/gitlab_roulette/gitlab_danger.rb', line 28

def gitlab_danger_helper
  @gitlab_danger_helper
end

Class Method Details

.local_warning_messageObject



34
35
36
# File 'lib/gitlab_roulette/gitlab_danger.rb', line 34

def self.local_warning_message
  "#{MESSAGE_PREFIX} Only the following Danger rules can be run locally: #{LOCAL_RULES.join(', ')}"
end

.success_messageObject



38
39
40
# File 'lib/gitlab_roulette/gitlab_danger.rb', line 38

def self.success_message
  "#{MESSAGE_PREFIX} No Danger rule violations!"
end

Instance Method Details

#ci?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/gitlab_roulette/gitlab_danger.rb', line 50

def ci?
  !gitlab_danger_helper.nil?
end


46
47
48
# File 'lib/gitlab_roulette/gitlab_danger.rb', line 46

def html_link(str)
  self.ci? ? gitlab_danger_helper.html_link(str) : str
end

#rule_namesObject



42
43
44
# File 'lib/gitlab_roulette/gitlab_danger.rb', line 42

def rule_names
  ci? ? LOCAL_RULES | CI_ONLY_RULES : LOCAL_RULES
end