Class: Danger::DangerXcodeSummary

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

Overview

Shows all build errors, warnings and unit tests results generated from ‘xcodebuild`. You need to use [xcpretty](github.com/supermarin/xcpretty) with [xcpretty-json-formatter](github.com/marcelofabri/xcpretty-json-formatter) to generate a JSON file that this plugin can read.

Examples:

Showing summary


xcode_summary.report 'xcodebuild.json'

Filtering warnings in Pods


xcode_summary.ignored_files = '**/Pods/**'
xcode_summary.report 'xcodebuild.json'

See Also:

  • diogot/danger-xcode_summary

Defined Under Namespace

Classes: Location, Result

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ignored_files[String]

A globbed string or array of strings which should match the files that you want to ignore warnings on. Defaults to nil. An example would be ‘’/Pods/‘` to ignore warnings in Pods that your project uses.

Parameters:

  • value (String or [String])

Returns:

  • ([String])


36
37
38
# File 'lib/xcode_summary/plugin.rb', line 36

def ignored_files
  @ignored_files
end

#inline_modeBoolean

Defines if using inline comment or not. Defaults to ‘false`.

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


54
55
56
# File 'lib/xcode_summary/plugin.rb', line 54

def inline_mode
  @inline_mode
end

#project_rootString

The project root, which will be used to make the paths relative. Defaults to ‘pwd`.

Parameters:

  • value (String)

Returns:

  • (String)


28
29
30
# File 'lib/xcode_summary/plugin.rb', line 28

def project_root
  @project_root
end

#sticky_summaryBoolean

Defines if the test summary will be sticky or not. Defaults to ‘false`.

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


42
43
44
# File 'lib/xcode_summary/plugin.rb', line 42

def sticky_summary
  @sticky_summary
end

#test_summaryBoolean

Defines if the build summary is shown or not. Defaults to ‘true`.

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


48
49
50
# File 'lib/xcode_summary/plugin.rb', line 48

def test_summary
  @test_summary
end

Instance Method Details

#report(file_path) ⇒ void

This method returns an undefined value.

Reads a file with JSON Xcode summary and reports it.

Parameters:

  • file_path (String)

    Path for Xcode summary in JSON format.



82
83
84
85
86
87
88
89
# File 'lib/xcode_summary/plugin.rb', line 82

def report(file_path)
  if File.file?(file_path)
    xcode_summary = JSON.parse(File.read(file_path), symbolize_names: true)
    format_summary(xcode_summary)
  else
    fail 'summary file not found'
  end
end