Class: CleoQualityReview::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/cleo_quality_review/result.rb

Overview

Value object representing a single finding from a quality check

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#checkString (readonly)

Returns specific check or rule that triggered.

Returns:

  • (String)

    specific check or rule that triggered



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
51
52
53
54
55
56
57
# File 'lib/cleo_quality_review/result.rb', line 21

Result = Struct.new(
  :tool_name,
  :tool_type,
  :check,
  :timestamp,
  :result,
  :filepath,
  :line,
  keyword_init: true,
) do
  def self.from_h(hash)
    new(
      tool_name: hash["tool_name"] || hash["tool"],
      tool_type: hash["tool_type"],
      check: hash["check"],
      timestamp: hash["timestamp"],
      result: hash["result"],
      filepath: hash["filepath"],
      line: hash["line"],
    )
  end

  ##
  # Convert the result to a hash, omitting nil values
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      tool_name: tool_name,
      tool_type: tool_type,
      check: check,
      timestamp: timestamp,
      result: result,
      filepath: filepath,
      line: line,
    }.compact
  end
end

#filepathString? (readonly)

Returns path to the file with the issue.

Returns:

  • (String, nil)

    path to the file with the issue



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
51
52
53
54
55
56
57
# File 'lib/cleo_quality_review/result.rb', line 21

Result = Struct.new(
  :tool_name,
  :tool_type,
  :check,
  :timestamp,
  :result,
  :filepath,
  :line,
  keyword_init: true,
) do
  def self.from_h(hash)
    new(
      tool_name: hash["tool_name"] || hash["tool"],
      tool_type: hash["tool_type"],
      check: hash["check"],
      timestamp: hash["timestamp"],
      result: hash["result"],
      filepath: hash["filepath"],
      line: hash["line"],
    )
  end

  ##
  # Convert the result to a hash, omitting nil values
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      tool_name: tool_name,
      tool_type: tool_type,
      check: check,
      timestamp: timestamp,
      result: result,
      filepath: filepath,
      line: line,
    }.compact
  end
end

#lineInteger? (readonly)

Returns line number of the issue.

Returns:

  • (Integer, nil)

    line number of the issue



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
51
52
53
54
55
56
57
# File 'lib/cleo_quality_review/result.rb', line 21

Result = Struct.new(
  :tool_name,
  :tool_type,
  :check,
  :timestamp,
  :result,
  :filepath,
  :line,
  keyword_init: true,
) do
  def self.from_h(hash)
    new(
      tool_name: hash["tool_name"] || hash["tool"],
      tool_type: hash["tool_type"],
      check: hash["check"],
      timestamp: hash["timestamp"],
      result: hash["result"],
      filepath: hash["filepath"],
      line: hash["line"],
    )
  end

  ##
  # Convert the result to a hash, omitting nil values
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      tool_name: tool_name,
      tool_type: tool_type,
      check: check,
      timestamp: timestamp,
      result: result,
      filepath: filepath,
      line: line,
    }.compact
  end
end

#resultString (readonly)

Returns description of the finding.

Returns:

  • (String)

    description of the finding



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
51
52
53
54
55
56
57
# File 'lib/cleo_quality_review/result.rb', line 21

Result = Struct.new(
  :tool_name,
  :tool_type,
  :check,
  :timestamp,
  :result,
  :filepath,
  :line,
  keyword_init: true,
) do
  def self.from_h(hash)
    new(
      tool_name: hash["tool_name"] || hash["tool"],
      tool_type: hash["tool_type"],
      check: hash["check"],
      timestamp: hash["timestamp"],
      result: hash["result"],
      filepath: hash["filepath"],
      line: hash["line"],
    )
  end

  ##
  # Convert the result to a hash, omitting nil values
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      tool_name: tool_name,
      tool_type: tool_type,
      check: check,
      timestamp: timestamp,
      result: result,
      filepath: filepath,
      line: line,
    }.compact
  end
end

#timestampInteger (readonly)

Returns epoch milliseconds when the check ran.

Returns:

  • (Integer)

    epoch milliseconds when the check ran



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
51
52
53
54
55
56
57
# File 'lib/cleo_quality_review/result.rb', line 21

Result = Struct.new(
  :tool_name,
  :tool_type,
  :check,
  :timestamp,
  :result,
  :filepath,
  :line,
  keyword_init: true,
) do
  def self.from_h(hash)
    new(
      tool_name: hash["tool_name"] || hash["tool"],
      tool_type: hash["tool_type"],
      check: hash["check"],
      timestamp: hash["timestamp"],
      result: hash["result"],
      filepath: hash["filepath"],
      line: hash["line"],
    )
  end

  ##
  # Convert the result to a hash, omitting nil values
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      tool_name: tool_name,
      tool_type: tool_type,
      check: check,
      timestamp: timestamp,
      result: result,
      filepath: filepath,
      line: line,
    }.compact
  end
end

#tool_nameString (readonly)

Returns name of the tool that produced this result.

Returns:

  • (String)

    name of the tool that produced this result



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
51
52
53
54
55
56
57
# File 'lib/cleo_quality_review/result.rb', line 21

Result = Struct.new(
  :tool_name,
  :tool_type,
  :check,
  :timestamp,
  :result,
  :filepath,
  :line,
  keyword_init: true,
) do
  def self.from_h(hash)
    new(
      tool_name: hash["tool_name"] || hash["tool"],
      tool_type: hash["tool_type"],
      check: hash["check"],
      timestamp: hash["timestamp"],
      result: hash["result"],
      filepath: hash["filepath"],
      line: hash["line"],
    )
  end

  ##
  # Convert the result to a hash, omitting nil values
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      tool_name: tool_name,
      tool_type: tool_type,
      check: check,
      timestamp: timestamp,
      result: result,
      filepath: filepath,
      line: line,
    }.compact
  end
end

#tool_typeString (readonly)

Returns category for the tool that produced this result.

Returns:

  • (String)

    category for the tool that produced this result



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
51
52
53
54
55
56
57
# File 'lib/cleo_quality_review/result.rb', line 21

Result = Struct.new(
  :tool_name,
  :tool_type,
  :check,
  :timestamp,
  :result,
  :filepath,
  :line,
  keyword_init: true,
) do
  def self.from_h(hash)
    new(
      tool_name: hash["tool_name"] || hash["tool"],
      tool_type: hash["tool_type"],
      check: hash["check"],
      timestamp: hash["timestamp"],
      result: hash["result"],
      filepath: hash["filepath"],
      line: hash["line"],
    )
  end

  ##
  # Convert the result to a hash, omitting nil values
  # @return [Hash{Symbol => Object}]
  def to_h
    {
      tool_name: tool_name,
      tool_type: tool_type,
      check: check,
      timestamp: timestamp,
      result: result,
      filepath: filepath,
      line: line,
    }.compact
  end
end

Class Method Details

.from_h(hash) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cleo_quality_review/result.rb', line 31

def self.from_h(hash)
  new(
    tool_name: hash["tool_name"] || hash["tool"],
    tool_type: hash["tool_type"],
    check: hash["check"],
    timestamp: hash["timestamp"],
    result: hash["result"],
    filepath: hash["filepath"],
    line: hash["line"],
  )
end

Instance Method Details

#to_hHash{Symbol => Object}

Convert the result to a hash, omitting nil values

Returns:

  • (Hash{Symbol => Object})


46
47
48
49
50
51
52
53
54
55
56
# File 'lib/cleo_quality_review/result.rb', line 46

def to_h
  {
    tool_name: tool_name,
    tool_type: tool_type,
    check: check,
    timestamp: timestamp,
    result: result,
    filepath: filepath,
    line: line,
  }.compact
end