mirror of
https://github.com/ypresto/SwiftLintXcode.git
synced 2026-03-25 08:55:51 +00:00
Rename to SwiftLintXcode
This commit is contained in:
parent
a6e7b9b1e2
commit
219b4699cf
13 changed files with 95 additions and 105 deletions
10
README.md
10
README.md
|
|
@ -1,5 +1,5 @@
|
|||
SwiftLintAutoCorrect
|
||||
====================
|
||||
SwiftLintXcode
|
||||
==============
|
||||
|
||||
An Xcode plug-in to format your code using [SwiftLint](https://github.com/realm/SwiftLint).
|
||||
|
||||
|
|
@ -16,8 +16,8 @@ INSTALLATION
|
|||
# Please ensure swiftlint is on PATH.
|
||||
brew update && brew install swiftlint
|
||||
|
||||
git clone https://github.com/ypresto/SwiftLintAutoCorrect
|
||||
cd SwiftLintAutoCorrect
|
||||
git clone https://github.com/ypresto/SwiftLintXcode
|
||||
cd SwiftLintXcode
|
||||
# Build and install.
|
||||
xcodebuild -configuration Release
|
||||
```
|
||||
|
|
@ -25,7 +25,7 @@ xcodebuild -configuration Release
|
|||
To uninstall, just remove plug-in directory.
|
||||
|
||||
```bash
|
||||
rm -rf "$HOME/Library/Application Support/Developer/Shared/Xcode/Plug-ins/SwiftLintAutoCorrect.xcplugin"
|
||||
rm -rf "$HOME/Library/Application Support/Developer/Shared/Xcode/Plug-ins/SwiftLintXcode.xcplugin"
|
||||
```
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>04E4BF2E1CB25D3100BC7305</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -7,22 +7,22 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
0498717F1CB27F8900C5F7B5 /* SwiftLintAutoCorrectTRVSXcode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498717E1CB27F8900C5F7B5 /* SwiftLintAutoCorrectTRVSXcode.m */; };
|
||||
0498717F1CB27F8900C5F7B5 /* SwiftLintXcodeTRVSXcode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0498717E1CB27F8900C5F7B5 /* SwiftLintXcodeTRVSXcode.m */; };
|
||||
049871811CB28EBF00C5F7B5 /* Formatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049871801CB28EBF00C5F7B5 /* Formatter.swift */; };
|
||||
04E4BF341CB25D3200BC7305 /* SwiftLintAutoCorrect.xcscheme in Resources */ = {isa = PBXBuildFile; fileRef = 04E4BF331CB25D3200BC7305 /* SwiftLintAutoCorrect.xcscheme */; };
|
||||
04E4BF361CB25D3200BC7305 /* SwiftLintAutoCorrect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4BF351CB25D3200BC7305 /* SwiftLintAutoCorrect.swift */; };
|
||||
04E4BF341CB25D3200BC7305 /* SwiftLintXcode.xcscheme in Resources */ = {isa = PBXBuildFile; fileRef = 04E4BF331CB25D3200BC7305 /* SwiftLintXcode.xcscheme */; };
|
||||
04E4BF361CB25D3200BC7305 /* SwiftLintXcode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4BF351CB25D3200BC7305 /* SwiftLintXcode.swift */; };
|
||||
04E4BF381CB25D3200BC7305 /* NSObject_Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4BF371CB25D3200BC7305 /* NSObject_Extension.swift */; };
|
||||
04E4BF411CB273A700BC7305 /* SaveHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E4BF401CB273A700BC7305 /* SaveHook.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0498717C1CB27F8800C5F7B5 /* SwiftLintAutoCorrect-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwiftLintAutoCorrect-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
0498717D1CB27F8900C5F7B5 /* SwiftLintAutoCorrectTRVSXcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwiftLintAutoCorrectTRVSXcode.h; sourceTree = "<group>"; };
|
||||
0498717E1CB27F8900C5F7B5 /* SwiftLintAutoCorrectTRVSXcode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SwiftLintAutoCorrectTRVSXcode.m; sourceTree = "<group>"; };
|
||||
0498717C1CB27F8800C5F7B5 /* SwiftLintXcode-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwiftLintXcode-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
0498717D1CB27F8900C5F7B5 /* SwiftLintXcodeTRVSXcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwiftLintXcodeTRVSXcode.h; sourceTree = "<group>"; };
|
||||
0498717E1CB27F8900C5F7B5 /* SwiftLintXcodeTRVSXcode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SwiftLintXcodeTRVSXcode.m; sourceTree = "<group>"; };
|
||||
049871801CB28EBF00C5F7B5 /* Formatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Formatter.swift; sourceTree = "<group>"; };
|
||||
04E4BF2F1CB25D3100BC7305 /* SwiftLintAutoCorrect.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftLintAutoCorrect.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
04E4BF331CB25D3200BC7305 /* SwiftLintAutoCorrect.xcscheme */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = SwiftLintAutoCorrect.xcscheme; path = SwiftLintAutoCorrect.xcodeproj/xcshareddata/xcschemes/SwiftLintAutoCorrect.xcscheme; sourceTree = SOURCE_ROOT; };
|
||||
04E4BF351CB25D3200BC7305 /* SwiftLintAutoCorrect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftLintAutoCorrect.swift; sourceTree = "<group>"; };
|
||||
04E4BF2F1CB25D3100BC7305 /* SwiftLintXcode.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftLintXcode.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
04E4BF331CB25D3200BC7305 /* SwiftLintXcode.xcscheme */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = SwiftLintXcode.xcscheme; path = SwiftLintXcode.xcodeproj/xcshareddata/xcschemes/SwiftLintXcode.xcscheme; sourceTree = SOURCE_ROOT; };
|
||||
04E4BF351CB25D3200BC7305 /* SwiftLintXcode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftLintXcode.swift; sourceTree = "<group>"; };
|
||||
04E4BF371CB25D3200BC7305 /* NSObject_Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSObject_Extension.swift; sourceTree = "<group>"; };
|
||||
04E4BF391CB25D3200BC7305 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
04E4BF401CB273A700BC7305 /* SaveHook.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SaveHook.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
04E4BF271CB25D3100BC7305 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
04E4BF311CB25D3200BC7305 /* SwiftLintAutoCorrect */,
|
||||
04E4BF311CB25D3200BC7305 /* SwiftLintXcode */,
|
||||
04E4BF301CB25D3100BC7305 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -40,31 +40,31 @@
|
|||
04E4BF301CB25D3100BC7305 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
04E4BF2F1CB25D3100BC7305 /* SwiftLintAutoCorrect.xcplugin */,
|
||||
04E4BF2F1CB25D3100BC7305 /* SwiftLintXcode.xcplugin */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
04E4BF311CB25D3200BC7305 /* SwiftLintAutoCorrect */ = {
|
||||
04E4BF311CB25D3200BC7305 /* SwiftLintXcode */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0498717D1CB27F8900C5F7B5 /* SwiftLintAutoCorrectTRVSXcode.h */,
|
||||
0498717E1CB27F8900C5F7B5 /* SwiftLintAutoCorrectTRVSXcode.m */,
|
||||
04E4BF351CB25D3200BC7305 /* SwiftLintAutoCorrect.swift */,
|
||||
0498717D1CB27F8900C5F7B5 /* SwiftLintXcodeTRVSXcode.h */,
|
||||
0498717E1CB27F8900C5F7B5 /* SwiftLintXcodeTRVSXcode.m */,
|
||||
04E4BF351CB25D3200BC7305 /* SwiftLintXcode.swift */,
|
||||
04E4BF371CB25D3200BC7305 /* NSObject_Extension.swift */,
|
||||
04E4BF401CB273A700BC7305 /* SaveHook.swift */,
|
||||
049871801CB28EBF00C5F7B5 /* Formatter.swift */,
|
||||
04E4BF391CB25D3200BC7305 /* Info.plist */,
|
||||
04E4BF321CB25D3200BC7305 /* Supporting Files */,
|
||||
0498717C1CB27F8800C5F7B5 /* SwiftLintAutoCorrect-Bridging-Header.h */,
|
||||
0498717C1CB27F8800C5F7B5 /* SwiftLintXcode-Bridging-Header.h */,
|
||||
);
|
||||
path = SwiftLintAutoCorrect;
|
||||
path = SwiftLintXcode;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
04E4BF321CB25D3200BC7305 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
04E4BF331CB25D3200BC7305 /* SwiftLintAutoCorrect.xcscheme */,
|
||||
04E4BF331CB25D3200BC7305 /* SwiftLintXcode.xcscheme */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -72,9 +72,9 @@
|
|||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
04E4BF2E1CB25D3100BC7305 /* SwiftLintAutoCorrect */ = {
|
||||
04E4BF2E1CB25D3100BC7305 /* SwiftLintXcode */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 04E4BF3C1CB25D3200BC7305 /* Build configuration list for PBXNativeTarget "SwiftLintAutoCorrect" */;
|
||||
buildConfigurationList = 04E4BF3C1CB25D3200BC7305 /* Build configuration list for PBXNativeTarget "SwiftLintXcode" */;
|
||||
buildPhases = (
|
||||
04E4BF2C1CB25D3100BC7305 /* Sources */,
|
||||
04E4BF2D1CB25D3100BC7305 /* Resources */,
|
||||
|
|
@ -83,9 +83,9 @@
|
|||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = SwiftLintAutoCorrect;
|
||||
productName = SwiftLintAutoCorrect;
|
||||
productReference = 04E4BF2F1CB25D3100BC7305 /* SwiftLintAutoCorrect.xcplugin */;
|
||||
name = SwiftLintXcode;
|
||||
productName = SwiftLintXcode;
|
||||
productReference = 04E4BF2F1CB25D3100BC7305 /* SwiftLintXcode.xcplugin */;
|
||||
productType = "com.apple.product-type.bundle";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
|
@ -103,7 +103,7 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 04E4BF2B1CB25D3100BC7305 /* Build configuration list for PBXProject "SwiftLintAutoCorrect" */;
|
||||
buildConfigurationList = 04E4BF2B1CB25D3100BC7305 /* Build configuration list for PBXProject "SwiftLintXcode" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
04E4BF2E1CB25D3100BC7305 /* SwiftLintAutoCorrect */,
|
||||
04E4BF2E1CB25D3100BC7305 /* SwiftLintXcode */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
04E4BF341CB25D3200BC7305 /* SwiftLintAutoCorrect.xcscheme in Resources */,
|
||||
04E4BF341CB25D3200BC7305 /* SwiftLintXcode.xcscheme in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -136,8 +136,8 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0498717F1CB27F8900C5F7B5 /* SwiftLintAutoCorrectTRVSXcode.m in Sources */,
|
||||
04E4BF361CB25D3200BC7305 /* SwiftLintAutoCorrect.swift in Sources */,
|
||||
0498717F1CB27F8900C5F7B5 /* SwiftLintXcodeTRVSXcode.m in Sources */,
|
||||
04E4BF361CB25D3200BC7305 /* SwiftLintXcode.swift in Sources */,
|
||||
049871811CB28EBF00C5F7B5 /* Formatter.swift in Sources */,
|
||||
04E4BF411CB273A700BC7305 /* SaveHook.swift in Sources */,
|
||||
04E4BF381CB25D3200BC7305 /* NSObject_Extension.swift in Sources */,
|
||||
|
|
@ -230,13 +230,13 @@
|
|||
DEPLOYMENT_LOCATION = YES;
|
||||
DSTROOT = "$(HOME)";
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
INFOPLIST_FILE = SwiftLintAutoCorrect/Info.plist;
|
||||
INFOPLIST_FILE = SwiftLintXcode/Info.plist;
|
||||
INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(DT_TOOLCHAIN_DIR)/usr/lib/swift/macosx";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.ypresto.SwiftLintAutoCorrect;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "SwiftLintAutoCorrect/SwiftLintAutoCorrect-Bridging-Header.h";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.ypresto.SwiftLintXcode;
|
||||
PRODUCT_NAME = SwiftLintXcode;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "SwiftLintXcode/SwiftLintXcode-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
WRAPPER_EXTENSION = xcplugin;
|
||||
};
|
||||
|
|
@ -250,13 +250,13 @@
|
|||
DEPLOYMENT_LOCATION = YES;
|
||||
DSTROOT = "$(HOME)";
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
INFOPLIST_FILE = SwiftLintAutoCorrect/Info.plist;
|
||||
INFOPLIST_FILE = SwiftLintXcode/Info.plist;
|
||||
INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(DT_TOOLCHAIN_DIR)/usr/lib/swift/macosx";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.ypresto.SwiftLintAutoCorrect;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "SwiftLintAutoCorrect/SwiftLintAutoCorrect-Bridging-Header.h";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.ypresto.SwiftLintXcode;
|
||||
PRODUCT_NAME = SwiftLintXcode;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "SwiftLintXcode/SwiftLintXcode-Bridging-Header.h";
|
||||
WRAPPER_EXTENSION = xcplugin;
|
||||
};
|
||||
name = Release;
|
||||
|
|
@ -264,7 +264,7 @@
|
|||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
04E4BF2B1CB25D3100BC7305 /* Build configuration list for PBXProject "SwiftLintAutoCorrect" */ = {
|
||||
04E4BF2B1CB25D3100BC7305 /* Build configuration list for PBXProject "SwiftLintXcode" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
04E4BF3A1CB25D3200BC7305 /* Debug */,
|
||||
|
|
@ -273,7 +273,7 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
04E4BF3C1CB25D3200BC7305 /* Build configuration list for PBXNativeTarget "SwiftLintAutoCorrect" */ = {
|
||||
04E4BF3C1CB25D3200BC7305 /* Build configuration list for PBXNativeTarget "SwiftLintXcode" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
04E4BF3D1CB25D3200BC7305 /* Debug */,
|
||||
|
|
@ -2,6 +2,6 @@
|
|||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:SwiftLintAutoCorrect.xcodeproj">
|
||||
location = "self:/Users/yuya.tanaka/Dropbox/repo/SwiftLintXcode/SwiftLintXcode.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
|
@ -14,10 +14,10 @@
|
|||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "890A4B3E171F031300AFE577"
|
||||
BuildableName = "SwiftLintAutoCorrect.xcplugin"
|
||||
BlueprintName = "SwiftLintAutoCorrect"
|
||||
ReferencedContainer = "container:SwiftLintAutoCorrect.xcodeproj">
|
||||
BlueprintIdentifier = "04E4BF2E1CB25D3100BC7305"
|
||||
BuildableName = "SwiftLintXcode.xcplugin"
|
||||
BlueprintName = "SwiftLintXcode"
|
||||
ReferencedContainer = "container:SwiftLintXcode.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
|
|
@ -29,52 +29,56 @@
|
|||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8966AFCA173EB7BF004150C0"
|
||||
BuildableName = "SwiftLintAutoCorrectTests.xctest"
|
||||
BlueprintName = "SwiftLintAutoCorrectTests"
|
||||
ReferencedContainer = "container:SwiftLintAutoCorrect.xcodeproj">
|
||||
BuildableName = "SwiftLintXcodeTests.xctest"
|
||||
BlueprintName = "SwiftLintXcodeTests"
|
||||
ReferencedContainer = "container:SwiftLintXcode.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "NO"
|
||||
debugXPCServices = "NO"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "NO"
|
||||
viewDebuggingEnabled = "No">
|
||||
<PathRunnable
|
||||
runnableDebuggingMode = "0"
|
||||
FilePath = "/Applications/Xcode.app">
|
||||
</PathRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "890A4B3E171F031300AFE577"
|
||||
BuildableName = "SwiftLintAutoCorrect.xcplugin"
|
||||
BlueprintName = "SwiftLintAutoCorrect"
|
||||
ReferencedContainer = "container:SwiftLintAutoCorrect.xcodeproj">
|
||||
BlueprintIdentifier = "04E4BF2E1CB25D3100BC7305"
|
||||
BuildableName = "SwiftLintXcode.xcplugin"
|
||||
BlueprintName = "SwiftLintXcode"
|
||||
ReferencedContainer = "container:SwiftLintXcode.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// Formatter.swift
|
||||
// SwiftLintAutoCorrect
|
||||
// SwiftLintXcode
|
||||
//
|
||||
// Created by yuya.tanaka on 2016/04/04.
|
||||
// Copyright (c) 2016 Yuya Tanaka. All rights reserved.
|
||||
|
|
@ -11,10 +11,10 @@ import Cocoa
|
|||
|
||||
final class Formatter {
|
||||
static var sharedInstance = Formatter()
|
||||
private static let pathExtension = "swiftlintautocorrect"
|
||||
private static let pathExtension = "SwiftLintXcode"
|
||||
|
||||
let fileManager = NSFileManager.defaultManager()
|
||||
let tempDirURL: NSURL = NSURL(fileURLWithPath: NSTemporaryDirectory()).URLByAppendingPathComponent("SwiftLintAutoCorrect-\(NSUUID().UUIDString)")
|
||||
let tempDirURL: NSURL = NSURL(fileURLWithPath: NSTemporaryDirectory()).URLByAppendingPathComponent("SwiftLintXcode-\(NSUUID().UUIDString)")
|
||||
|
||||
struct CursorPosition {
|
||||
let line: Int
|
||||
|
|
@ -33,7 +33,7 @@ final class Formatter {
|
|||
} catch let error as NSError {
|
||||
NSAlert(error: error).runModal()
|
||||
} catch {
|
||||
NSAlert(error: NSError(domain: "net.ypresto.swiftlintautocorrect", code: 0, userInfo: [
|
||||
NSAlert(error: NSError(domain: "net.ypresto.SwiftLintXcode", code: 0, userInfo: [
|
||||
NSLocalizedDescriptionKey: "Unknown error occured: \(error)"
|
||||
])).runModal()
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ final class Formatter {
|
|||
let formattedString = try formatString(originalString)
|
||||
if formattedString == originalString { return }
|
||||
|
||||
let selectedRange = SwiftLintAutoCorrectTRVSXcode.textView().selectedRange()
|
||||
let selectedRange = SwiftLintXcodeTRVSXcode.textView().selectedRange()
|
||||
let cursorPosition = cursorPositionForSelectedRange(selectedRange, textStorage: textStorage)
|
||||
|
||||
textStorage.beginEditing()
|
||||
|
|
@ -54,7 +54,7 @@ final class Formatter {
|
|||
textStorage.endEditing()
|
||||
|
||||
let newLocation = locationForCursorPosition(cursorPosition, textStorage: textStorage)
|
||||
SwiftLintAutoCorrectTRVSXcode.textView().setSelectedRange(NSRange(location: newLocation, length: 0))
|
||||
SwiftLintXcodeTRVSXcode.textView().setSelectedRange(NSRange(location: newLocation, length: 0))
|
||||
}
|
||||
|
||||
private func cursorPositionForSelectedRange(selectedRange: NSRange, textStorage: DVTSourceTextStorage) -> CursorPosition {
|
||||
|
|
@ -83,7 +83,7 @@ final class Formatter {
|
|||
])
|
||||
task.waitUntilExit()
|
||||
if task.terminationStatus != 0 {
|
||||
throw NSError(domain: "net.ypresto.swiftlintautocorrect", code: 0, userInfo: [
|
||||
throw NSError(domain: "net.ypresto.SwiftLintXcode", code: 0, userInfo: [
|
||||
NSLocalizedDescriptionKey: "Executing swiftlint exited with non-zero status."
|
||||
])
|
||||
}
|
||||
|
|
@ -102,20 +102,20 @@ final class Formatter {
|
|||
task.launch()
|
||||
task.waitUntilExit()
|
||||
if task.terminationStatus != 0 {
|
||||
throw NSError(domain: "net.ypresto.swiftlintautocorrect", code: 0, userInfo: [
|
||||
throw NSError(domain: "net.ypresto.SwiftLintXcode", code: 0, userInfo: [
|
||||
NSLocalizedDescriptionKey: "Executing `which swiftlint` exited with non-zero status."
|
||||
])
|
||||
}
|
||||
|
||||
let data = pipe.fileHandleForReading.readDataToEndOfFile()
|
||||
guard let pathString = String(data: data, encoding: NSUTF8StringEncoding) else {
|
||||
throw NSError(domain: "net.ypresto.swiftlintautocorrect", code: 0, userInfo: [
|
||||
throw NSError(domain: "net.ypresto.SwiftLintXcode", code: 0, userInfo: [
|
||||
NSLocalizedDescriptionKey: "Cannot read result of `which swiftlint`."
|
||||
])
|
||||
}
|
||||
let path = pathString.stringByTrimmingCharactersInSet(NSCharacterSet.newlineCharacterSet())
|
||||
if !fileManager.isExecutableFileAtPath(path) {
|
||||
throw NSError(domain: "net.ypresto.swiftlintautocorrect", code: 0, userInfo: [
|
||||
throw NSError(domain: "net.ypresto.SwiftLintXcode", code: 0, userInfo: [
|
||||
NSLocalizedDescriptionKey: "swiftlint at \(path) is not executable."
|
||||
])
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ final class Formatter {
|
|||
try ensureTemporaryDirectory()
|
||||
let filePath = createTemporaryPath()
|
||||
if fileManager.fileExistsAtPath(filePath) {
|
||||
throw NSError(domain: "net.ypresto.swiftlintautocorrect", code: 0, userInfo: [
|
||||
throw NSError(domain: "net.ypresto.SwiftLintXcode", code: 0, userInfo: [
|
||||
NSLocalizedDescriptionKey: "Cannot write to \(filePath), file already exists."
|
||||
])
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>SwiftLintAutoCorrect</string>
|
||||
<string>SwiftLintXcode</string>
|
||||
<key>XC4Compatible</key>
|
||||
<true/>
|
||||
<key>XCPluginHasUI</key>
|
||||
|
|
@ -12,7 +12,7 @@ extension NSObject {
|
|||
let appName = NSBundle.mainBundle().infoDictionary?["CFBundleName"] as? NSString
|
||||
if appName == "Xcode" {
|
||||
if sharedPlugin == nil {
|
||||
sharedPlugin = SwiftLintAutoCorrect(bundle: bundle)
|
||||
sharedPlugin = SwiftLintXcode(bundle: bundle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// SaveHook.swift
|
||||
// SwiftLintAutoCorrect
|
||||
// SwiftLintXcode
|
||||
//
|
||||
// Created by yuya.tanaka on 2016/04/04.
|
||||
// Copyright (c) 2016 Yuya Tanaka. All rights reserved.
|
||||
|
|
@ -25,14 +25,14 @@ final class SaveHook {
|
|||
swizzled = true
|
||||
|
||||
let fromMethod = class_getInstanceMethod(NSDocument.self, #selector(NSDocument.saveDocumentWithDelegate(_:didSaveSelector:contextInfo:)))
|
||||
let toMethod = class_getInstanceMethod(NSDocument.self, #selector(NSDocument.swiftLintAutoCorrectSaveDocumentWithDelegate(_:didSaveSelector:contextInfo:)))
|
||||
let toMethod = class_getInstanceMethod(NSDocument.self, #selector(NSDocument.SwiftLintXcodeSaveDocumentWithDelegate(_:didSaveSelector:contextInfo:)))
|
||||
method_exchangeImplementations(fromMethod, toMethod)
|
||||
}
|
||||
|
||||
class func tryOnSaveDocument(document: NSDocument) -> Bool {
|
||||
if !enabled { return true }
|
||||
Formatter.isFormattableDocument(document)
|
||||
let sourceCodeDocument: IDESourceCodeDocument = SwiftLintAutoCorrectTRVSXcode.sourceCodeDocument()
|
||||
let sourceCodeDocument: IDESourceCodeDocument = SwiftLintXcodeTRVSXcode.sourceCodeDocument()
|
||||
guard sourceCodeDocument == document else { return true }
|
||||
return Formatter.sharedInstance.tryFormatDocument(sourceCodeDocument)
|
||||
}
|
||||
|
|
@ -41,10 +41,10 @@ final class SaveHook {
|
|||
// https://github.com/travisjeffery/ClangFormat-Xcode/blob/a22114907592fb5d5b1043a4919d7be3e1496741/ClangFormat/NSDocument+TRVSClangFormat.m
|
||||
extension NSDocument {
|
||||
|
||||
dynamic func swiftLintAutoCorrectSaveDocumentWithDelegate(delegate: AnyObject?, didSaveSelector: Selector, contextInfo: UnsafeMutablePointer<Void>) -> Void {
|
||||
dynamic func SwiftLintXcodeSaveDocumentWithDelegate(delegate: AnyObject?, didSaveSelector: Selector, contextInfo: UnsafeMutablePointer<Void>) -> Void {
|
||||
if SaveHook.tryOnSaveDocument(self) {
|
||||
// NOTE: Call original method
|
||||
swiftLintAutoCorrectSaveDocumentWithDelegate(delegate, didSaveSelector: didSaveSelector, contextInfo: contextInfo);
|
||||
SwiftLintXcodeSaveDocumentWithDelegate(delegate, didSaveSelector: didSaveSelector, contextInfo: contextInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,4 +2,4 @@
|
|||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
#import "SwiftLintAutoCorrectTRVSXcode.h"
|
||||
#import "SwiftLintXcodeTRVSXcode.h"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// SwiftLintAutoCorrect.swift
|
||||
// SwiftLintXcode.swift
|
||||
//
|
||||
// Created by yuya.tanaka on 2016/04/04.
|
||||
// Copyright (c) 2016 Yuya Tanaka. All rights reserved.
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
import AppKit
|
||||
|
||||
var sharedPlugin: SwiftLintAutoCorrect?
|
||||
var sharedPlugin: SwiftLintXcode?
|
||||
|
||||
class SwiftLintAutoCorrect: NSObject {
|
||||
class SwiftLintXcode: NSObject {
|
||||
|
||||
var bundle: NSBundle
|
||||
lazy var center = NSNotificationCenter.defaultCenter()
|
||||
|
|
@ -21,7 +21,7 @@ class SwiftLintAutoCorrect: NSObject {
|
|||
self.bundle = bundle
|
||||
|
||||
super.init()
|
||||
center.addObserver(self, selector: #selector(SwiftLintAutoCorrect.onApplicationDidFinishLaunching), name: NSApplicationDidFinishLaunchingNotification, object: nil)
|
||||
center.addObserver(self, selector: #selector(SwiftLintXcode.onApplicationDidFinishLaunching), name: NSApplicationDidFinishLaunchingNotification, object: nil)
|
||||
}
|
||||
|
||||
deinit {
|
||||
|
|
@ -42,20 +42,20 @@ class SwiftLintAutoCorrect: NSObject {
|
|||
|
||||
guard let item = NSApp.mainMenu!.itemWithTitle("Edit") else { return }
|
||||
|
||||
let pluginMenu = NSMenu(title:"SwiftLint AutoCorrect")
|
||||
let pluginMenuItem = NSMenuItem(title:"SwiftLint AutoCorrect", action: nil, keyEquivalent: "")
|
||||
let pluginMenu = NSMenu(title:"SwiftLintXcode")
|
||||
let pluginMenuItem = NSMenuItem(title:"SwiftLintXcode", action: nil, keyEquivalent: "")
|
||||
pluginMenuItem.submenu = pluginMenu
|
||||
|
||||
let autoCorrectMenuItem = NSMenuItem(title:"AutoCorrect Current File", action:#selector(SwiftLintAutoCorrect.doAutoCorrect), keyEquivalent:"")
|
||||
let autoCorrectMenuItem = NSMenuItem(title:"AutoCorrect Current File", action:#selector(SwiftLintXcode.doAutoCorrect), keyEquivalent:"")
|
||||
autoCorrectMenuItem.target = self
|
||||
pluginMenu.addItem(autoCorrectMenuItem)
|
||||
|
||||
let enableMenuItem = NSMenuItem(title:"Enable AutoCorrect on Save", action:#selector(SwiftLintAutoCorrect.doEnableFormatOnSave), keyEquivalent:"")
|
||||
let enableMenuItem = NSMenuItem(title:"Enable AutoCorrect on Save", action:#selector(SwiftLintXcode.doEnableFormatOnSave), keyEquivalent:"")
|
||||
enableMenuItem.target = self
|
||||
pluginMenu.addItem(enableMenuItem)
|
||||
self.enableMenuItem = enableMenuItem
|
||||
|
||||
let disableMenuItem = NSMenuItem(title:"Disable AutoCorrect on Save", action:#selector(SwiftLintAutoCorrect.doDisableFormatOnSave), keyEquivalent:"")
|
||||
let disableMenuItem = NSMenuItem(title:"Disable AutoCorrect on Save", action:#selector(SwiftLintXcode.doDisableFormatOnSave), keyEquivalent:"")
|
||||
disableMenuItem.target = self
|
||||
pluginMenu.addItem(disableMenuItem)
|
||||
self.disableMenuItem = disableMenuItem
|
||||
|
|
@ -67,7 +67,7 @@ class SwiftLintAutoCorrect: NSObject {
|
|||
}
|
||||
|
||||
func doAutoCorrect() {
|
||||
let sourceCodeDocument: IDESourceCodeDocument = SwiftLintAutoCorrectTRVSXcode.sourceCodeDocument()
|
||||
let sourceCodeDocument: IDESourceCodeDocument = SwiftLintXcodeTRVSXcode.sourceCodeDocument()
|
||||
guard Formatter.isFormattableDocument(sourceCodeDocument) else { return }
|
||||
Formatter.sharedInstance.tryFormatDocument(sourceCodeDocument)
|
||||
}
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
@property (readonly) IDEWorkspace *workspace;
|
||||
@end
|
||||
|
||||
@interface SwiftLintAutoCorrectTRVSXcode : NSObject
|
||||
@interface SwiftLintXcodeTRVSXcode : NSObject
|
||||
|
||||
+ (IDESourceCodeDocument *)sourceCodeDocument;
|
||||
+ (NSTextView *)textView;
|
||||
|
|
@ -6,9 +6,9 @@
|
|||
// Copyright (c) 2014 Travis Jeffery. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SwiftLintAutoCorrectTRVSXcode.h"
|
||||
#import "SwiftLintXcodeTRVSXcode.h"
|
||||
|
||||
@implementation SwiftLintAutoCorrectTRVSXcode
|
||||
@implementation SwiftLintXcodeTRVSXcode
|
||||
|
||||
+ (id)currentEditor {
|
||||
if ([[self windowController]
|
||||
Loading…
Reference in a new issue