mirror of
https://github.com/mas-cli/mas
synced 2024-11-21 11:13:06 +00:00
🧹 Separate format from lint
This commit is contained in:
parent
bf093082e8
commit
5df8db3fd6
5 changed files with 49 additions and 7 deletions
|
@ -9,6 +9,8 @@
|
|||
|
||||
# Disabled rules
|
||||
--disable blankLinesAroundMark
|
||||
--disable consecutiveSpaces
|
||||
--disable indent
|
||||
|
||||
# Enabled rules (disabled by default)
|
||||
--enable trailingClosures
|
||||
|
|
|
@ -23,7 +23,7 @@ We love pull requests from everyone. By participating in this project, you agree
|
|||
`git checkout -b awesome-feature master`
|
||||
- Please avoid working [directly on the master branch](https://softwareengineering.stackexchange.com/questions/223400/when-should-i-stop-committing-to-master-on-new-projects).
|
||||
- Make commits of logical units.
|
||||
- Run script/lint before committing your changes. Fix anything that isn't automatically fixed by the linters.
|
||||
- Run script/format before committing your changes. Fix anything that isn't automatically fixed by the linters.
|
||||
- Push your topic branch to your fork and [submit a pull request](https://github.com/mas-cli/mas/compare/master...your-username:topic-branch).
|
||||
|
||||
Some things that will increase the chance that your pull request is accepted:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# All Files
|
||||
|
||||
- Use `script/format` to automatically fix a number of style violations.
|
||||
- Remove unnecessary whitespace from the end of lines.
|
||||
- Use `script/lint` to look for these before committing.
|
||||
- Note that [two trailing spaces](https://gist.github.com/shaunlebron/746476e6e7a4d698b373)
|
||||
|
|
35
script/format
Executable file
35
script/format
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash -e
|
||||
#
|
||||
# script/format
|
||||
# mas
|
||||
#
|
||||
# Linting checks for development and CI.
|
||||
#
|
||||
# Automatically formats and fixes style violations using various tools.
|
||||
# Additionally runs `lint` to report any remaining style violations.
|
||||
#
|
||||
# Please keep in sync with script/lint.
|
||||
#
|
||||
|
||||
echo "==> 🚨 Formatting mas"
|
||||
|
||||
for LINTER in shfmt swift-format swiftformat swiftlint; do
|
||||
if [[ ! -x "$(command -v ${LINTER})" ]]; then
|
||||
echo "error: ${LINTER} is not installed. Run script/bootstrap."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo "--> 🕊️ Swift"
|
||||
swiftformat .
|
||||
for SOURCE in mas MasKit MasKitTests; do
|
||||
swift-format format --in-place --configuration .swift-format --recursive ${SOURCE}
|
||||
done
|
||||
swiftlint lint --fix --strict
|
||||
|
||||
echo
|
||||
echo "--> 📜 Bash"
|
||||
shfmt -i 2 -l -w contrib/ script/
|
||||
|
||||
script/lint
|
16
script/lint
16
script/lint
|
@ -5,12 +5,16 @@
|
|||
#
|
||||
# Linting checks for development and CI.
|
||||
#
|
||||
# Reports style violations without making any modifications to the code.
|
||||
#
|
||||
# Please keep in sync with script/format.
|
||||
#
|
||||
|
||||
echo "==> 🚨 Linting mas"
|
||||
|
||||
for LINTER in swift-format swiftformat swiftlint; do
|
||||
for LINTER in git swift-format swiftformat swiftlint; do
|
||||
if [[ ! -x "$(command -v ${LINTER})" ]]; then
|
||||
echo "warning: ${LINTER} is not installed: script/bootstrap"
|
||||
echo "error: ${LINTER} is not installed. Run script/bootstrap."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
@ -20,12 +24,12 @@ git diff --check
|
|||
|
||||
echo
|
||||
echo "--> 🕊️ Swift"
|
||||
swiftformat .
|
||||
swiftformat --lint .
|
||||
for SOURCE in mas MasKit MasKitTests; do
|
||||
swift-format format --in-place --configuration .swift-format --recursive ${SOURCE}
|
||||
swift-format lint --configuration .swift-format --recursive ${SOURCE}
|
||||
done
|
||||
swiftlint lint --fix --strict
|
||||
swiftlint lint --strict
|
||||
|
||||
echo
|
||||
echo "--> 📜 Bash"
|
||||
shfmt -i 2 -l -w contrib/ script/
|
||||
shfmt -d -i 2 -l -w contrib/ script/
|
||||
|
|
Loading…
Reference in a new issue