Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Back Swiftlint #22

Merged
merged 2 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
disabled_rules:
- trailing_comma
opt_in_rules:
- empty_count
- empty_string
line_length:
warning: 150
error: 200
function_body_length:
warning: 300
error: 500
function_parameter_count:
warning: 6
error: 8
type_body_length:
warning: 300
error: 500
file_length:
warning: 1000
error: 1500
cyclomatic_complexity:
warning: 15
error: 25
reporter: "xcode"
22 changes: 22 additions & 0 deletions GamebookEngine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@
B448874823063A0D000E2FDD /* Frameworks */,
B448874923063A0D000E2FDD /* Resources */,
4451A4BF232DCD36003D9FE9 /* Embed Foundation Extensions */,
44D767DD29DD3FF6001DFE82 /* Run Swiftlint */,
);
buildRules = (
);
Expand Down Expand Up @@ -620,6 +621,27 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
44D767DD29DD3FF6001DFE82 /* Run Swiftlint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Swiftlint";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which swiftlint > /dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
4451A4AE232DCD36003D9FE9 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
6 changes: 2 additions & 4 deletions GamebookEngine/Data/GameDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,8 @@ class GameDatabase {
guard let pages = pages else { return completion([]) }
var filteredPages = [Page]()

for page in pages {
if page.content.lowercased().contains(terms.lowercased()) {
filteredPages.append(page)
}
for page in pages where page.content.lowercased().contains(terms.lowercased()) {
filteredPages.append(page)
}

completion(filteredPages)
Expand Down