Skip to content

Commit

Permalink
Merge pull request #78 from SwiftGen/feature/swiftlint-pod
Browse files Browse the repository at this point in the history
Use SwiftLint via CocoaPods
  • Loading branch information
djbe authored Apr 9, 2018
2 parents 66c5198 + 831d1a0 commit 6c16ba3
Show file tree
Hide file tree
Showing 21 changed files with 548 additions and 396 deletions.
14 changes: 14 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
disabled_rules:
- type_name

opt_in_rules:
- force_unwrapping

# Rules customization
line_length:
warning: 120
error: 200

nesting:
type_level:
warning: 2
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ _None_

### Internal Changes

_None_
* Switched to using SwiftLint via CocoaPods instead of our own install scripts.
[David Jennes](https://github.com/djbe)
[#78](https://github.com/SwiftGen/StencilSwiftKit/pull/78)

## 2.4.0

Expand Down
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ use_frameworks!

target 'Tests' do
pod 'StencilSwiftKit', path: '.'
pod 'SwiftLint', '~> 0.25'
end
9 changes: 6 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ PODS:
- PathKit (~> 0.8.0)
- StencilSwiftKit (2.4.0):
- Stencil (~> 0.10)
- SwiftLint (0.25.0)

DEPENDENCIES:
- StencilSwiftKit (from `.`)
- SwiftLint (~> 0.25)

EXTERNAL SOURCES:
StencilSwiftKit:
Expand All @@ -15,8 +17,9 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
PathKit: dcab05d701474011aae0e40cf892298a831f63d6
Stencil: 40b382c52edab08f1e800e6144c1f04ae47a7a9a
StencilSwiftKit: 41693610fdab5a3782f9722b420d87eb4b287f33
StencilSwiftKit: 385f50e5263290411a059dadcbbc153b4f242f3c
SwiftLint: e14651157288e9e01d6e1a71db7014fb5744a8ea

PODFILE CHECKSUM: a08ecc2ab2ae91e8f0cddb740ac4e30be2cffc7d
PODFILE CHECKSUM: 4f35313d732240f2655b591ec8ce3f742e804e98

COCOAPODS: 1.3.1
COCOAPODS: 1.4.0
9 changes: 6 additions & 3 deletions Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

637 changes: 334 additions & 303 deletions Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions Pods/SwiftLint/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Pods/SwiftLint/swiftlint
Binary file not shown.
8 changes: 4 additions & 4 deletions Pods/Target Support Files/PathKit/PathKit.xcconfig

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 38 additions & 6 deletions Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Pods/Target Support Files/Stencil/Stencil.xcconfig

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Scripts/SwiftLint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

PROJECT_DIR="${PROJECT_DIR:-`cd "$(dirname $0)/..";pwd`}"
SWIFTLINT="${PROJECT_DIR}/Pods/SwiftLint/swiftlint"
CONFIG="${PROJECT_DIR}/.swiftlint.yml"

# possible paths
paths_sources="Sources"
paths_tests="Tests"

# load selected group
if [ $# -gt 0 ]; then
key="$1"
else
echo "error: need group to lint."
exit 1
fi

selected_path=`eval echo '$'paths_$key`
if [ -z "$selected_path" ]; then
echo "error: need a valid group to lint."
exit 1
fi

"$SWIFTLINT" lint --strict --config "$CONFIG" --path "${PROJECT_DIR}/${selected_path}"
2 changes: 1 addition & 1 deletion StencilSwiftKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [[ ! $CI ]]; then\n [[ -r ~/.profile ]] && source ~/.profile\n if [[ `which bundler` ]]; then\n bundle exec rake lint:code\n bundle exec rake lint:tests\n else\n echo \"warning: bundler not found, can't lint code. Please install bundler then run bundle install.\"\n fi\nfi";
shellScript = "if [[ ! $CI ]]; then\n \"$SRCROOT/Scripts/SwiftLint.sh\" \"sources\"\n \"$SRCROOT/Scripts/SwiftLint.sh\" \"tests\"\nfi";
};
DE127EA8748200EF28090721 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
Loading

0 comments on commit 6c16ba3

Please sign in to comment.