Skip to content

Commit

Permalink
Merge pull request #22 from amiantos/add-swiftlint
Browse files Browse the repository at this point in the history
Add Back Swiftlint
  • Loading branch information
amiantos committed Apr 5, 2023
2 parents d437a23 + 932b983 commit 8c584db
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
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

0 comments on commit 8c584db

Please sign in to comment.