Skip to content

Commit

Permalink
Merge branch 'master' into v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
funzin committed Sep 1, 2019
2 parents aada606 + 30696b3 commit 4665af0
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ DerivedData/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno


.scannerwork
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ before_install:
before_script:
- set -o pipefail
script:
- sonar-scanner
- xcodebuild test -workspace ViewGeneratorApp.xcworkspace -scheme ViewGeneratorCore -configuration Debug -destination 'platform=macOS' | xcpretty -c
- xcodebuild test -workspace ViewGeneratorApp.xcworkspace -scheme ViewGeneratorCore -configuration Debug -destination 'platform=macOS' -derivedDataPath Build/ | xcpretty -c
- find . -type d | grep -E ".xccovarchive" | xargs -I@ bash scripts/xccov-to-sonarqube-generic.sh @ > sonarqube-generic-coverage.xml
after_success:
- bash <(curl -s https://codecov.io/bash)
- bash <(curl -s https://codecov.io/bash) -D Build/
- sonar-scanner
notifications:
email: false

dist: trusty
addons:
sonarcloud:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<a href="https://twitter.com/fufunzin">
<img src="https://img.shields.io/badge/twitter-@fufunzin-blue.svg" alt="License" />
</a>
<a href=https://sonarcloud.io/dashboard?id=funzin_ViewGenerator>
<img src=https://sonarcloud.io/api/project_badges/measure?project=funzin_ViewGenerator&metric=alert_status />
</a>
</p>

## Overview
Expand Down
12 changes: 11 additions & 1 deletion ViewGenerator/Source/SourceEditorExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,14 @@
import Foundation
import XcodeKit

class SourceEditorExtension: NSObject, XCSourceEditorExtension {}
class SourceEditorExtension: NSObject, XCSourceEditorExtension {

func extensionDidFinishLaunching() {
// If your extension needs to do any work at launch, implement this optional method.
}

var commandDefinitions: [[XCSourceEditorCommandDefinitionKey: Any]] {
// If your extension needs to return a collection of command definitions that differs from those in its Info.plist, implement this optional property getter.
return []
}
}
26 changes: 26 additions & 0 deletions scripts/xccov-to-sonarqube-generic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail

function convert_file {
local xccovarchive_file="$1"
local file_name="$2"
echo " <file path=\"$file_name\">"
xcrun xccov view --file "$file_name" "$xccovarchive_file" | \
sed -n '
s/^ *\([0-9][0-9]*\): 0.*$/ <lineToCover lineNumber="\1" covered="false"\/>/p;
s/^ *\([0-9][0-9]*\): [1-9].*$/ <lineToCover lineNumber="\1" covered="true"\/>/p
'
echo ' </file>'
}

function xccov_to_generic {
echo '<coverage version="1">'
for xccovarchive_file in "$@"; do
xcrun xccov view --file-list "$xccovarchive_file" | while read -r file_name; do
convert_file "$xccovarchive_file" "$file_name"
done
done
echo '</coverage>'
}

xccov_to_generic "$@"
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
sonar.projectKey=funzin_ViewGenerator
sonar.projectName=ViewGenerator
sonar.organization=funzin
sonar.projectVersion=1.1.0
sonar.sources=.
sonar.host.url=https://sonarcloud.io
sonar.inclusions=./ViewGeneratorCore/**/.swift,./ViewGenereatorApp/**/*.swift,./ViewGenerator/**/*.swift
sonar.inclusions=ViewGeneratorCore/**/*.swift,ViewGenerator/**/*.swift,ViewGeneratorApp/**/*.swift
soner.language=swift

0 comments on commit 4665af0

Please sign in to comment.