diogot / danger-xcode_summary Goto Github PK
View Code? Open in Web Editor NEWA Danger plugin that shows all build errors, warnings and unit tests results generated from xcodebuild.
License: MIT License
A Danger plugin that shows all build errors, warnings and unit tests results generated from xcodebuild.
License: MIT License
We have a specific CI build script that verifies our project builds in the release configuration (so we can't accidentally introduce code that only compiles when #if DEBUG
code is included). In this job we do not run our tests so we have no xcresult
file to point this plugin at. With the 1.0.0 release it seems that this use case is no longer supported. Wanted to put this out there in case it wasn't thought of and make sure I'm not missing some setting to keep this use case alive?
Looks like this repo is not getting much attention. I understand that @diogot has other commitments and not getting enough time for this repo. would you consider adding someone else as a maintainer for this repo?
Thanks for your plugin!
At readme file used next example for ignored files
xcode_summary.ignored_files = '**/Pods/**'
but in code we send relative path to function that check ignore state here link to the code.
Mate, I just spent an hour to understand where I'm wrong :)
I can made PR with example fix or with code fix :)
I have been trying to exclude warnings such as compile_warnings
but seems like the plugin is not taking compile_warnings
under exclusion list.
I have tried this
xcode_summary.ignored_results { |result|
result.message.start_with? 'compile' # Ignore compile_warnings
and
this
xcode_summary.ignored_results { |result|
result.message.start_with? 'compile_warnings' # Ignore compile_warnings
but nothings seems to be working for me. Any help on this would be greatly appreciated.
{
"warnings": [
"Issues found"
],
"ld_warnings": [
],
"compile_warnings": [
{
"file_name": "XXX.swift",
"file_path": "xxx.swift:27:34",
"reason": "xxx",
"line": " xx.substring(from: range.lowerBound)",
"cursor": " ^"
},
],
"errors": [
],
"compile_errors": [
],
"file_missing_errors": [
],
"undefined_symbols_errors": [
],
"duplicate_symbols_errors": [
],
"tests_failures": {
},
"tests_summary_messages": [
"\t Executed 1 test, with 0 failures (0 unexpected) in 28.148 (28.150) seconds\n",
"\t Executed 20 tests, with 0 failures (0 unexpected) in 0.309 (0.343) seconds\n"
]
}
Hi! I was trying out this fragment of Examples:
# Ignoring specific warnings
xcode_summary.ignored_results { |result|
result.message.start_with 'ld' # Ignore ld_warnings
}
I did not want to fuss my CI Machine and I was running danger locally with danger pr
command in my project directory. Unfortunately I've had some problems with that because it stated that:
Dangerfile:51:in `block (2 levels) in parse': (Danger::DSLError)
[!] Invalid `Dangerfile` file: undefined method `start_with' for #<String:0x00007f9e70db0b08>
Did you mean? start_with?
So I figured out that API of Ruby doesn't define a method start_with?
for Strings.
It is defined in Ruby on Rails API though.
So I changed my Danger
file to contain this fixed version of solution:
xcode_summary.ignored_results { |result|
result.message =~ /^ld/
}
and executing of danger pr
went flawlessly this time.
I am not good at Ruby to see if that's correct or maybe I am doing something wrong, so I am asking to clarify that for me :)
Thanks!
Hello ✌️
Could you tell me why emojis aren't displaying in any pull requests? My project is on Butbucket.
I'm trying to add danger-xcode_summary
following the info in the ReadMe but I'm always getting Errors: - [ ] summary file not found
In my Dangerfile I have xcode_summary.report 'MyApp.xcresult'
Gemfile:
source 'https://rubygems.org'
gem 'cocoapods', '1.12.1'
gem 'fastlane', '2.212.2'
gem 'danger', '9.3.0'
gem 'danger-swiftlint', '0.33.0'
gem 'danger-xcode_summary', '1.2.0'
Hey guys,
First of all, congrats on the awesome project 💯
Question, Is there a way to put a custom output text on the report?
Example:
We have this reports
xcode_summary.report 'xcodebuild-ios.json'
xcode_summary.report 'xcodebuild-tvos.json'
xcode_summary.report 'xcodebuild-macos.json'
Producing the report
📖 | Executed 253 tests, with 0 failures (0 unexpected) in 11.181 (11.308) seconds
📖 | Executed 253 tests, with 0 failures (0 unexpected) in 10.979 (11.116) seconds
📖 | Executed 253 tests, with 0 failures (0 unexpected) in 11.757 (11.855) seconds
I want to know if there's a way to output something like
📖 | iOS: Executed 253 tests, with 0 failures (0 unexpected) in 11.181 (11.308) seconds
📖 | TVOS: Executed 253 tests, with 0 failures (0 unexpected) in 10.979 (11.116) seconds
📖 | MacOS: Executed 253 tests, with 0 failures (0 unexpected) in 11.757 (11.855) seconds
Thanks in advance :))
I'm getting the following error while trying to use xcode_summary, any help ?
[00:36:36]: ▸ �[35m[!] Invalid `Dangerfile` file: undefined method `html_link' for nil:NilClass�[0m
[00:36:36]: ▸ �[35m# from Dangerfile:11�[0m
[00:36:36]: ▸ �[35m# -------------------------------------------�[0m
[00:36:36]: ▸ �[35m# # Xcode Summary�[0m
[00:36:36]: ▸ �[35m> xcode_summary.report 'build/reports/errors.json'�[0m
[00:36:36]: ▸ �[35m#�[0m
[00:36:36]: ▸ �[35m# -------------------------------------------�[0m
build/reports/errors.json :
server:mykit jenkins$ cat build/reports/errors.json
{
"warnings": [
],
"ld_warnings": [
],
"compile_warnings": [
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
},
{
"file_name": "MyFile.swift",
"file_path": "/Users/Shared/Jenkins/Home/workspace/mykit/MYKIT/MyFile.swift:183:7",
"reason": "initialization of immutable value 'myVar' was never used; consider replacing with assignment to '_' or removing it",
"line": " let myVar = \"\"",
"cursor": " ~~~~^~~~~"
}
],
"errors": [
],
"compile_errors": [
],
"file_missing_errors": [
],
"undefined_symbols_errors": [
],
"duplicate_symbols_errors": [
],
"tests_failures": {
},
"tests_summary_messages": [
"\t Executed 89 tests, with 0 failures (0 unexpected) in 0.249 (0.509) seconds\n"
]
I would like to improve the ergonomics of Result by adding a parameter called type
or category
that specifies whether it's a build error, failing test, warning, etc. This would make setting the ignored_results
block much easier. What do you think? If you like the idea, I'll submit a PR!
Is there a way to only report errors and suppress warning messages with this library?
Thanks for your time in advance; this is super useful!
When I run danger, xcode_summary is only printing the tests_summary_messages. I get the following comment reported
Messages:
- [ ] Executed 165 tests, with 0 failures (0 unexpected) in 3.715 (3.884) seconds
But my formatted report has a number of warnings and compile warnings:
{
"warnings": [
"Skipping file at /srv/jenkins/workspace/Project_PR-3029/Target/Generated/EnumList.generated.swift as it does not exist",
],
"ld_warnings": [
"ld: Some object files have incompatible Objective-C category definitions. Some category metadata may be lost. All files containing Objective-C categories should be built using the same compiler.",
"ld: Some object files have incompatible Objective-C category definitions. Some category metadata may be lost. All files containing Objective-C categories should be built using the same compiler.",
"ld: "
],
"compile_warnings": [
{
"file_name": "RandomViewController.swift",
"file_path": "/srv/jenkins/workspace/Project_PR-3029/Target/Domains/watches/RandomViewController.swift:326:19",
"reason": "value 'state' was defined but never used; consider replacing with boolean test",
"line": " guard let state = state else { return }",
"cursor": " ~~~~^~~~~~~~"
},
],
"errors": [
],
"compile_errors": [
],
"file_missing_errors": [
],
"undefined_symbols_errors": [
],
"duplicate_symbols_errors": [
],
"tests_failures": {
},
"tests_summary_messages": [
"\t Executed 165 tests, with 0 failures (0 unexpected) in 2.997 (3.224) seconds\n"
]
}
FYI: This was built with:
xcodebuild -workspace '/srv/jenkins/workspace/Product_PR-3029/Product.xcworkspace'
-scheme Product
-configuration Debug
-destination 'platform=iOS Simulator,id=D6D05C2E-0C0A-4229-B0E0-66154D3D7011'
-derivedDataPath '/srv/jenkins/workspace/Product_PR-3029/derivedData/Product-jenkins'
-resultBundlePath '/srv/jenkins/workspace/Product_PR-3029/output/result.bundle'
-only-testing:TargetTests
clean build test
| XCPRETTY_JSON_FILE_OUTPUT='/srv/jenkins/workspace/Product_PR-3029/output/report-formatted.json' xcpretty -f `xcpretty-json-formatter`
and gems:
Using danger 5.16.1
Using danger-plugin-api 1.0.0
Using danger-swiftlint 0.19.0
Using danger-xcode_summary 0.5.0
Using danger-xcprofiler 0.4.0
Hi, I am getting error that I do not understand, I looked into your source code, and I don't see anything.
Could you help, please?
[!] The exception involves the following plugins:
- danger-xcode_summary
bundler: failed to load command: danger (/Users/ci/.rbenv/versions/2.2.3/bin/danger)
Danger::DSLError:
[!] Invalid `Dangerfile` file: no implicit conversion of Symbol into Integer
# from Dangerfile:32
# -------------------------------------------
# xcode_summary.ignored_files = '**/Pods/**'
> xcode_summary.report 'xcodebuild.json'
# commit_lint.check
# -------------------------------------------
When using the new testRepetitionMode
in Xcode a test can be automatically re-run if it fails. I've noticed that when a test is run multiple times, previous iteration errors are still reported even if the later iteration passes. In this case, the test suite run passes (since the later iteration passed), but danger still reports errors.
Bitbucket Server doesn't use the same syntax for linking to a specific line in a file with L in the path.
Dropping the L would make it work, but obviously breaks it e.g. for Github.
After updating the gems we use we started experiencing issues on CI with Danger. Here is the error log:
#!/bin/bash --login -eo pipefail
bundle exec danger --verbose
error: Info.plist at /Users/distiller/code/build/reports/errors.json/Info.plist does not exist, the result bundle might be corrupted or the provided path is not a result bundle
[!] The exception involves the following plugins:
- danger-xcode_summary
bundler: failed to load command: danger (/Users/distiller/code/vendor/bundle/ruby/2.7.0/bin/danger)
Danger::DSLError:
[!] Invalid `Dangerfile` file: Failed to execute - xcrun xcresulttool get --format json --path build/reports/errors.json
# from Dangerfile:31
# -------------------------------------------
#
> xcode_summary.report 'build/reports/errors.json'
# -------------------------------------------
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/xcresult-0.2.1/lib/xcresult/parser.rb:87:in `execute_cmd'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/xcresult-0.2.1/lib/xcresult/parser.rb:82:in `get_result_bundle_json'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/xcresult-0.2.1/lib/xcresult/parser.rb:13:in `initialize'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-xcode_summary-1.1.0/lib/xcode_summary/plugin.rb:107:in `new'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-xcode_summary-1.1.0/lib/xcode_summary/plugin.rb:107:in `report'
Dangerfile:31:in `eval_file'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-8.5.0/lib/danger/danger_core/dangerfile.rb:311:in `eval'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-8.5.0/lib/danger/danger_core/dangerfile.rb:311:in `eval_file'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-8.5.0/lib/danger/danger_core/dangerfile.rb:204:in `block in parse'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-8.5.0/lib/danger/danger_core/dangerfile.rb:201:in `instance_eval'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-8.5.0/lib/danger/danger_core/dangerfile.rb:201:in `parse'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-8.5.0/lib/danger/danger_core/dangerfile.rb:287:in `run'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-8.5.0/lib/danger/danger_core/executor.rb:29:in `run'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-8.5.0/lib/danger/commands/runner.rb:73:in `run'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/gems/danger-8.5.0/bin/danger:5:in `<top (required)>'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/bin/danger:23:in `load'
/Users/distiller/code/vendor/bundle/ruby/2.7.0/bin/danger:23:in `<top (required)>'
Exited with code exit status 1
CircleCI received exit code 1
Here is the list of gems that got updated and triggered this issue:
Installing concurrent-ruby 1.1.10 (was 1.1.8)
Installing i18n 1.10.0 (was 1.8.9)
Installing minitest 5.15.0 (was 5.14.4)
Installing tzinfo 2.0.4 (was 1.2.9)
Installing zeitwerk 2.5.4
Installing activesupport 6.1.5 (was 5.2.4.5)
Installing aws-partitions 1.573.0 (was 1.567.0)
Installing ffi 1.15.5 (was 1.15.0) with native extensions
Installing ethon 0.15.0 (was 0.12.0)
Installing cocoapods-core 1.11.3 (was 1.10.1)
Installing cocoapods-deintegrate 1.0.5 (was 1.0.4)
Installing cocoapods-downloader 1.6.3 (was 1.4.0)
Installing cocoapods-search 1.0.1 (was 1.0.0)
Installing cocoapods-trunk 1.6.0 (was 1.5.0)
Installing molinillo 0.8.0 (was 0.6.6)
Installing ruby-macho 2.5.1 (was 1.4.0)
Installing cocoapods 1.11.3 (was 1.10.1)
Installing git 1.10.2 (was 1.8.1)
Installing kramdown 2.3.2 (was 2.3.1)
Installing octokit 4.22.0 (was 4.20.0)
Installing danger 8.5.0 (was 8.2.3)
Installing xcresult 0.2.1
Installing danger-xcode_summary 1.1.0 (was 0.5.2)
Installing excon 0.92.2 (was 0.92.0)
Installing google-apis-androidpublisher_v3 0.18.0 (was 0.16.0)
Installing google-apis-storage_v1 0.12.0 (was 0.11.0)
Installing google-cloud-env 1.6.0 (was 1.5.0)
Installing fastlane 2.205.1 (was 2.204.3)
Installing xcode-install 2.8.0 (was 2.6.8)
Bundle updated!
And here is our gemfile:
source 'https://rubygems.org'
ruby "~> #{File.read('.ruby-version').strip}"
gem 'cocoapods'
gem 'cocoapods-core'
gem 'xcodeproj'
gem 'xcpretty'
gem 'fastlane'
gem 'xcode-install'
gem 'danger'
gem 'danger-xcode_summary'
gem 'xcpretty-json-formatter'
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
This is how we use it in the fastfile:
desc "Runs all the tests"
lane :test do |options|
scan(
workspace: "Project.xcworkspace",
scheme: "Proejct",
device: "iPhone 11 Pro",
clean: options.fetch(:clean, true),
formatter: "xcpretty-json-formatter",
result_bundle: true
)
end
Any idea where to look for the problem?
This issue is somewhat similar: #23 (comment)
Thanks for your help.
Here's an example:
el-hoshino/QuickshaRe#11
With danger-swiftlint, it can put a review comment right onto the exact line of that warning/error when inline-mode is turned on, which is very easy to find where is wrong, and I guess probably most people would expect this kind of comment when they turn inline-mode on.
el-hoshino/QuickshaRe#11 (comment)
But unfortunately danger-xcode_summary's inline-mode can only leave a normal warning with a link to that file/line along with all other warnings/errors that danger produces. So if there're a number of danger's warnings it's easy to miss the warnings produced by Xcode.
el-hoshino/QuickshaRe#11 (comment)
So it would be very helpful if danger-xcode_summary plugin can also support putting a comment onto the exact line 😃
danger-swiftlint's inline-mode implementation is here:
https://github.com/ashfurrow/danger-ruby-swiftlint/blob/38ff6e27123565e30660724877ead279f7cd87e4/lib/danger_plugin.rb#L140
When tests are run via fastlane scan result message contains only tests summary messages and no test failure messages. The command that is executed by fastlane is following
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace ./Babylon.xcworkspace -scheme Babylon -configuration Debug -destination 'platform=iOS Simulator,id=BB4396A6-7293-4863-88DC-15A38A801E1E' -derivedDataPath '/Users/ilya.puchka/Library/Developer/Xcode/DerivedData/Babylon-cganrmibthibvkepvoondhopatcw' build test | tee '/Users/ilya.puchka/Library/Logs/scan/babylon-Babylon.log' | xcpretty -f `xcpretty-json-formatter` --report html --output '/Users/ilya.puchka/dev/babylon-ios/fastlane/test_output/report.html' --report junit --output '/Users/ilya.puchka/dev/babylon-ios/fastlane/test_output/report.junit' --report junit --output '/var/folders/28/cn8n570x0bs_hzvsyl0yd4d891kn2m/T/junit_report20180617-44360-1okexpn'
Resulting json file only contains warnings
and tests_summary_messages
arrays, all other arrays are empty.
My danger file looks like this
xcode_summary.ignores_warnings = true
xcode_summary.report 'build/reports/errors.json'
It might be an issue with xcpretty json formatter so I filed an issue for it too marcelofabri/xcpretty-json-formatter#8
Hello, thanks for this plugin but for me it's still not clear how to add xcpretty with xcpretty-json-formatter to use xcode_summary on a CI
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.