From dccf90e07620b2c24c79903169a5993762190387 Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Fri, 29 Mar 2019 22:59:05 +0900 Subject: [PATCH] Add swiftlint config --- .swiftlint.yml | 34 +++++++++++++++++++++++++ DifferenceKit.xcodeproj/project.pbxproj | 22 ++++++++++++++++ Sources/Algorithm.swift | 2 ++ 3 files changed, 58 insertions(+) create mode 100644 .swiftlint.yml diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..ae915dc --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,34 @@ +# https://github.com/realm/SwiftLint + +excluded: + - Tests/XCTestManifests.swift + +disabled_rules: + - type_name + - identifier_name + - force_cast + - xctfail_message + - function_body_length + - file_length + +nesting: + type_level: + warning: 2 + +line_length: + warning: 200 + +file_length: + warning: 600 + +type_body_length: + warning: 400 + +function_body_length: + warning: 50 + +cyclomatic_complexity: + warning: 12 + +statement_position: + statement_mode: uncuddled_else diff --git a/DifferenceKit.xcodeproj/project.pbxproj b/DifferenceKit.xcodeproj/project.pbxproj index 68da93d..fdbb9c4 100644 --- a/DifferenceKit.xcodeproj/project.pbxproj +++ b/DifferenceKit.xcodeproj/project.pbxproj @@ -179,6 +179,7 @@ 6B2DF86A210E2C12004D2D40 /* Frameworks */, 6B2DF86B210E2C12004D2D40 /* Headers */, 6B2DF86C210E2C12004D2D40 /* Resources */, + 6B7EEDA4224E5A5000060872 /* SwiftLint */, ); buildRules = ( ); @@ -263,6 +264,27 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 6B7EEDA4224E5A5000060872 /* SwiftLint */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = SwiftLint; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 6B2DF869210E2C12004D2D40 /* Sources */ = { isa = PBXSourcesBuildPhase; diff --git a/Sources/Algorithm.swift b/Sources/Algorithm.swift index 12c9a70..c9d88a5 100644 --- a/Sources/Algorithm.swift +++ b/Sources/Algorithm.swift @@ -1,3 +1,5 @@ +// swiftlint:disable cyclomatic_complexity + public extension StagedChangeset where Collection: RangeReplaceableCollection, Collection.Element: Differentiable { /// Creates a new `StagedChangeset` from the two collections. ///