This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
SwiftLint Configuration #148
Open
sshin-mobify
wants to merge
8
commits into
develop
Choose a base branch
from
swiftlint-configuration
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d60eed5
Added information. About swxftlint with basic linter configuration
sshin-mobify a8c3aa6
Edited some changes in ReadMe
sshin-mobify 95a0e3d
ReadMe
sshin-mobify f351f89
Spacing issues
sshin-mobify 7d8c335
edited configuration
sshin-mobify 22b04d3
reconfigured base on Astro
sshin-mobify f2f7690
Merge branch 'develop' into swiftlint-configuration
jeremywiebe e71412f
Update README.md
sshin-mobify File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
disabled_rules: | ||
- line_length | ||
- file_length | ||
- function_body_length | ||
- todo | ||
- cyclomatic_complexity | ||
- variable_name | ||
- force_cast | ||
- nesting | ||
- function_parameter_count | ||
- force_try | ||
- legacy_constructor | ||
|
||
type_body_length: | ||
- 480 # warning | ||
- 500 # error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,27 @@ We also follow the [Swift API design guidelines](https://swift.org/documentation | |
|
||
Our overarching goals are conciseness, readability, and simplicity. | ||
|
||
## Linting | ||
|
||
Included is a default Mobify Swift Style Guide SwiftLint configuration,`.swiftlint.yml`. | ||
|
||
You can install [SwiftLint](https://github.com/realm/SwiftLint) by command `brew install swiftlint` | ||
|
||
### Integration | ||
Integrate SwiftLint into Xcode to get warnings and errors displayed. You can add a new "Run Script" with: | ||
|
||
```bash | ||
if which swiftlint >/dev/null; then | ||
swiftlint | ||
else | ||
echo "warning: SwiftLint not installed, install using 'brew install swiftlint'" | ||
fi | ||
``` | ||
|
||
autocorrect is available by command `swiftlint autocorrect` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Autocorrect (capitalized)... |
||
|
||
for more information on this linter you can visit [this](https://github.com/realm/SwiftLint) page | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For (capitalized)... |
||
|
||
## Table of Contents | ||
|
||
* [Correctness](#correctness) | ||
|
@@ -353,7 +374,7 @@ class BoardLocation { | |
init(row: Int, column: Int) { | ||
self.row = row | ||
self.column = column | ||
|
||
let closure = { | ||
print(self.row) | ||
} | ||
|
@@ -418,7 +439,7 @@ Mark classes `final` when inheritance is not intended. Example: | |
```swift | ||
// Turn any generic type into a reference type using this Box class. | ||
final class Box<T> { | ||
let value: T | ||
let value: T | ||
init(_ value: T) { | ||
self.value = value | ||
} | ||
|
@@ -440,7 +461,7 @@ func reticulateSplines(spline: [Double]) -> Bool { | |
For functions with long signatures, add line breaks after each parameter and indent them on the same level as the first parameter. | ||
|
||
```swift | ||
func reticulateSplines(spline: [Double], | ||
func reticulateSplines(spline: [Double], | ||
adjustmentFactor: Double, | ||
translateConstant: Int, | ||
comment: String) -> Bool { | ||
|
@@ -906,15 +927,15 @@ When coding with conditionals, the left hand margin of the code should be the "g | |
```swift | ||
func computeFFT(context: Context?, inputData: InputData?) throws -> Frequencies { | ||
|
||
guard let context = context else { | ||
throw FFTError.noContext | ||
guard let context = context else { | ||
throw FFTError.noContext | ||
} | ||
guard let inputData = inputData else { | ||
throw FFTError.noInputData | ||
guard let inputData = inputData else { | ||
throw FFTError.noInputData | ||
} | ||
|
||
// use context and input to compute the frequencies | ||
|
||
return frequencies | ||
} | ||
``` | ||
|
@@ -1048,4 +1069,3 @@ Prefer Autolayout over springs+struts (autoresizing mask). Autolayout automatica | |
## Credits | ||
|
||
Heavily based on [The Official raywenderlich.com Swift Style Guide](https://github.com/raywenderlich/swift-style-guide/blob/master/README.markdown) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this automatically point to the mobify-code-style
.swiftlint.yml
file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the swiftlint yaml file lives in the root of your iOS project. To point it to the code style lint file we would have to... make a symlink? We could probably do that as part of a
postinstall
npm hook