Module: Opencontrol::Messages

Defined in:
lib/opencontrol/messages.rb

Overview

This module holds the Opencontrol Linter detailed issue messages.

Class Method Summary collapse

Class Method Details

.detail(issue) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/opencontrol/messages.rb', line 8

def self.detail(issue)
  case issue.error_symbol
  when :enum_notexist
    "    At:           YAML path \#{issue.path}.\n    Message:      \#{issue.message}\n    Expected:     one of \#{issue.rule.enum}.\n    Actual:       The value '\#{issue.value}' was found.\n    To fix this:  Use one of \#{issue.rule.enum}\n                  instead of the value '\#{issue.value}'\n    MESSAGE\n  when :key_undefined\n    <<-MESSAGE\n    At:           YAML path \#{issue.path}.\n    Expected:     A key allowed by the schema.\n    Actual:       A key was found that is not defined in the schema\n                  (\#{issue.path}).\n    To fix this:  Its possible the key found is a typo,\n                  Remove \#{issue.path} or correct the key.\n    MESSAGE\n  when :schema_files_not_found_issue\n    <<-MESSAGE\n    At:           File path \#{issue.path}.\n    Expected:     A valid schema version that is currently supported.\n    Actual:       No valid schema file found\n                  (\#{issue.value}).\n    To fix this:  Either provide a valid schema file or adjust the schema\n                  version to a known schema. See\n                  https://github.com/adriankierman/opencontrol-linter\n                  or\n                  https://github.com/opencontrol/schemas/tree/master/kwalify\n                  for schemas.\n                  Typically you will want to correct the schema\n                  version number indicated in your file at\n                  \#{issue.path}.\n    MESSAGE\n  else\n    <<-MESSAGE\n    At:           YAML path \#{issue.path}.\n    Message:      \#{issue.message}\n    MESSAGE\n  end\nend\n"

.verbose(issue) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'lib/opencontrol/messages.rb', line 52

def self.verbose(issue)
  "    At:           YAML path \#{issue.path}.\n    Message:      \#{issue.message}\n    Rule:         \#{issue.rule.to_yaml}\n    Value:        \#{issue.value}\n    Symbol:       \#{issue.error_symbol}\n  MESSAGE\nend\n"