Skip to content

Commit

Permalink
Merge pull request #559 from bummoblizard/linting-test
Browse files Browse the repository at this point in the history
Use linting
  • Loading branch information
bummoblizard authored Aug 30, 2022
2 parents 1bef70a + 35e0f36 commit 711b335
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "!gitbook"

jobs:
test:
Linting:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions Code.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2760,7 +2760,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export PATH=$PATH:/opt/homebrew/bin\nif command -v swift-format > /dev/null\nthen\n swift-format format -i -r ${PROJECT_DIR}/CodeApp\nelse\n echo \"warning: swift-format not installed, install it by running brew install swift-format\"\nfi\n\n";
shellScript = "export PATH=$PATH:/opt/homebrew/bin\nif command -v swift-format > /dev/null\nthen\n swift-format format -i -r ${PROJECT_DIR}/CodeApp\n swift-format lint -r -s ${PROJECT_DIR}/CodeApp\nelse\n echo \"warning: swift-format not installed, install it by running brew install swift-format\"\nfi\n\n";
};
9455423B27FC410F00DAF941 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -2779,7 +2779,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export PATH=$PATH:/opt/homebrew/bin\nif command -v swift-format > /dev/null\nthen\n swift-format format -i -r ${PROJECT_DIR}/CodeApp\nelse\n echo \"warning: swift-format not installed, install it by running brew install swift-format\"\nfi\n\n";
shellScript = "export PATH=$PATH:/opt/homebrew/bin\nif command -v swift-format > /dev/null\nthen\n swift-format format -i -r ${PROJECT_DIR}/CodeApp\n swift-format lint -r -s ${PROJECT_DIR}/CodeApp\nelse\n echo \"warning: swift-format not installed, install it by running brew install swift-format\"\nfi\n\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
10 changes: 4 additions & 6 deletions CodeApp/CodeApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ struct CodeApp: App {
appropriateFor: nil,
create: true)
// usr/lib/wasm32-wasi
var localURL = libraryURL.appendingPathComponent("usr/lib/wasm32-wasi") // $HOME/Library/usr/lib/wasm32-wasi
var localURL = libraryURL.appendingPathComponent("usr/lib/wasm32-wasi")
do {
if FileManager().fileExists(atPath: localURL.path) && !localURL.isDirectory {
try FileManager().removeItem(at: localURL)
Expand All @@ -142,7 +142,7 @@ struct CodeApp: App {
return
}
// usr/lib/clang/14.0.0/lib/wasi/
localURL = libraryURL.appendingPathComponent("usr/lib/clang/14.0.0/lib/wasi/") // $HOME/Library/usr/lib/clang/14.0.0/lib/wasi/
localURL = libraryURL.appendingPathComponent("usr/lib/clang/14.0.0/lib/wasi/")
do {
if FileManager().fileExists(atPath: localURL.path) && !localURL.isDirectory {
try FileManager().removeItem(at: localURL)
Expand Down Expand Up @@ -288,19 +288,17 @@ struct CodeApp: App {
"PYTHONPYCACHEPREFIX",
(libraryURL.appendingPathComponent("__pycache__")).path.toCString(), 1)
setenv("PYTHONUSERBASE", libraryURL.path.toCString(), 1)

// setenv("REQUESTS_CA_BUNDLE", pemUrl.path.toCString(), 1)
setenv("SSL_CERT_FILE", pemUrl.path.toCString(), 1)

// Help aiohttp install itself:
setenv("YARL_NO_EXTENSIONS", "1", 1)
setenv("MULTIDICT_NO_EXTENSIONS", "1", 1)

// clang options:
setenv("SYSROOT", libraryURL.path + "/usr", 1) // sysroot for clang compiler
setenv("SYSROOT", libraryURL.path + "/usr", 1)
setenv(
"CCC_OVERRIDE_OPTIONS",
"#^--target=wasm32-wasi +-fno-exceptions +-lc-printscan-long-double", 1) // silently add "--target=wasm32-wasi" at the beginning of arguments
"#^--target=wasm32-wasi +-fno-exceptions +-lc-printscan-long-double", 1)
setenv("MAKESYSPATH", Bundle.main.resourcePath! + "ClangLib/usr/share/mk", 1)

// PHP config
Expand Down
8 changes: 0 additions & 8 deletions CodeApp/HelperFunctions/KeychainWrapper/KeychainWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ private let SecReturnAttributes: String = kSecReturnAttributes as String

/// KeychainWrapper is a class to help make Keychain access in Swift more straightforward. It is designed to make accessing the Keychain services more like using NSUserDefaults, which is much more familiar to people.
open class KeychainWrapper {

@available(
*, deprecated,
message:
"KeychainWrapper.defaultKeychainWrapper is deprecated, use KeychainWrapper.standard instead"
)
public static let defaultKeychainWrapper = KeychainWrapper.standard

/// Default keychain wrapper access
public static let standard = KeychainWrapper()

Expand Down
2 changes: 1 addition & 1 deletion CodeApp/HelperFunctions/node.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public func npm(argc: Int32, argv: UnsafeMutablePointer<UnsafeMutablePointer<Int

let npmPath = npmURL.path

args = ["node", "--max-old-space-size=180", "--optimize-for-size", npmPath] + args // + ["--prefix", workingPath]
args = ["node", "--max-old-space-size=180", "--optimize-for-size", npmPath] + args

return nodeCmd(args: args)
}
Expand Down
15 changes: 8 additions & 7 deletions CodeApp/HelperFunctions/wasm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,8 @@ class wasmWebViewDelegate: NSObject, WKNavigationDelegate, WKScriptMessageHandle
completionHandler(result)
return
} else if arguments[1] == "chdir" {

// let result = changeDirectory(path: arguments[2]) // call cd_main and updates the ios current session
completionHandler("\(FileManager.default.changeCurrentDirectoryPath(arguments[2]))") // true or false
// true or false
completionHandler("\(FileManager.default.changeCurrentDirectoryPath(arguments[2]))")
return
} else if arguments[1] == "fchdir" {
if let fd = Int32(arguments[2]) {
Expand Down Expand Up @@ -438,11 +437,13 @@ class wasmWebViewDelegate: NSObject, WKNavigationDelegate, WKScriptMessageHandle
}
return
} else {
completionHandler("\(-EFAULT)") // time points out of process allocated space
// time points out of process allocated space
completionHandler("\(-EFAULT)")
return
}
} else {
completionHandler("\(-EFAULT)") // time points out of process allocated space
// time points out of process allocated space
completionHandler("\(-EFAULT)")
return
}
} else if arguments[1] == "futimes" {
Expand Down Expand Up @@ -475,11 +476,11 @@ class wasmWebViewDelegate: NSObject, WKNavigationDelegate, WKScriptMessageHandle
}
return
} else {
completionHandler("\(-EFAULT)") // time points out of process allocated space
completionHandler("\(-EFAULT)")
return
}
} else {
completionHandler("\(-EFAULT)") // time points out of process allocated space
completionHandler("\(-EFAULT)")
return
}
}
Expand Down
7 changes: 3 additions & 4 deletions CodeApp/UI/terminal/problems.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ struct problemsView: View {
Image(systemName: "xmark.circle").foregroundColor(.red)
case 1:
Image(systemName: "exclamationmark.triangle")
.foregroundColor(.yellow) // hint
.foregroundColor(.yellow)
case 2:
Image(systemName: "info.circle").foregroundColor(.blue) // info
Image(systemName: "info.circle").foregroundColor(.blue)
case 4:
Image(systemName: "exclamationmark.triangle")
.foregroundColor(.yellow) // warning
.foregroundColor(.yellow)
default:
Image(systemName: "xmark.circle").foregroundColor(.red)
}
Expand All @@ -49,7 +49,6 @@ struct problemsView: View {
} label: {
fileIcon(url: url.absoluteString, iconSize: 14, type: .file)
Text(url.lastPathComponent).foregroundColor(Color.init("T1"))
// Text("monaco-tm").foregroundColor(.gray)
Circle()
.fill(Color.init("panel.border"))
.frame(width: 14, height: 14)
Expand Down

0 comments on commit 711b335

Please sign in to comment.