Merge pull request #356 from mas-cli/markdownlint

🖊 Lint markdown
This commit is contained in:
Ben Chatelain 2021-05-03 21:09:41 -06:00 committed by GitHub
commit 40622df72a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 55 additions and 41 deletions

View file

@ -19,15 +19,13 @@ assignees: ''
- [] [mas-cli/tap](https://github.com/mas-cli/homebrew-tap)
- [] `.pkg` installer from [releases](https://github.com/mas-cli/mas/releases)
- [] Built from source
- Fork/branch: ? (e.g. mas-cli/master)
- Xcode version: 10.?
- Fork/branch: ? (e.g. mas-cli/master)
- Xcode version: 10.?
## Describe the Bug
> A clear and concise description of what the bug is.
## To Reproduce
Steps to reproduce the behavior:
@ -41,29 +39,20 @@ Steps to reproduce the behavior:
> A clear and concise description of what you expected to happen.
## Actual Behavior
> A clear and concise description of what actually happened.
## Screenshots, Terminal Output
> If applicable, add screenshots to help explain your problem.
```
```bash
$ mas command
...
```
## Additional Context
> Add any other context about the problem here.
> Did it work in a previous version?

4
.markdownlint.json Normal file
View file

@ -0,0 +1,4 @@
{
"MD013": { "line_length": 120 },
"MD033": { "allowed_elements": ["h1", "img"] }
}

View file

@ -1,3 +1,4 @@
brew "markdownlint-cli"
brew "shfmt"
brew "swift-format"
brew "swiftformat"

View file

@ -68,9 +68,9 @@ members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
<https://www.contributor-covenant.org/faq>

View file

@ -6,34 +6,36 @@ We love pull requests from everyone. By participating in this project, you agree
- Make sure you have a [GitHub account](https://github.com/join).
- [Open an issue](https://github.com/mas-cli/mas/issues/new) to simply ask a question or request a new feature.
- Search for similar issues with the [ERROR MESSAGE](https://github.com/mas-cli/mas/issues?utf8=%E2%9C%93&q=is%3Aopen+ERROR+MESSAGE) you are exeriencing.
- Search for similar issues with the
[ERROR MESSAGE](https://github.com/mas-cli/mas/issues?utf8=%E2%9C%93&q=is%3Aopen+ERROR+MESSAGE)
you are exeriencing.
- If one doesn't exist, [open a new issue](https://github.com/mas-cli/mas/issues/new)
- Clearly describe the issue including steps to reproduce when it is a bug.
- Include the earliest version of `mas` that you know has the issue.
- Include your macOS version.
- Clearly describe the issue including steps to reproduce when it is a bug.
- Include the earliest version of `mas` that you know has the issue.
- Include your macOS version.
## Making Changes
- [Fork the repository](https://github.com/mas-cli/mas#fork-destination-box) on GitHub.
- Cone your fork
- Cone your fork
`git clone git@github.com:your-username/mas.git`
- Create a topic branch from where you want to base your work.
- This is usually the `master` branch.
- To quickly create a topic branch based on `master`, run
- This is usually the `master` branch.
- To quickly create a topic branch based on `master`, run
`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.
- 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/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:
- Write tests. (Tests target is still [in progress](https://github.com/mas-cli/mas/issues/123))
- If you need help with tests, feel free to open a PR in the meantime and just ask for some help.
- Add "[WIP]" to the title of your PR to indicate that it's not ready to be merged.
- If you need help with tests, feel free to open a PR in the meantime and just ask for some help.
- Add "[WIP]" to the title of your PR to indicate that it's not ready to be merged.
- Follow our [style guide](docs/style.md).
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
- Including [appropriate emoji](https://gitmoji.carloscuesta.me/) in the first line of commit messages is fun :wink:.
- Including [appropriate emoji](https://gitmoji.carloscuesta.me/) in the first line of commit messages is fun :wink:.
## Becoming a Contributor
@ -50,7 +52,8 @@ to this project, but must remain an owner. By becoming a contributor, you agree
- This project follows [trunk-based development](https://trunkbaseddevelopment.com/), where `master` is our trunk.
- Release commits will be tagged in the format: `v1.2.3`.
- Once releases are tagged, high-level release notes are published on the [releases](https://github.com/mas-cli/mas/releases) page.
- Once releases are tagged, high-level release notes are published on the
[releases](https://github.com/mas-cli/mas/releases) page.
See GitHub's post on creating [Contributing Guidelines](https://github.com/blog/1184-contributing-guidelines)
if you would like to set up something like this for your projects.

View file

@ -1,4 +1,4 @@
[<p align="center"><img src="mas-cli.png" alt="mas-cli" width="450" height="auto"></p>][mas-cli]
<h1 align="center"><img src="mas-cli.png" alt="mas-cli" width="450" height="auto"></h1>
# mas-cli
@ -110,7 +110,8 @@ $ mas purchase 768053424
```
> Please note that you may have to re-authenticate yourself in the App Store to complete the purchase.
This is the case if the application is not free or if you configured your account not to remember the credentials for free purchases.
This is the case if the application is not free or if you configured your account not to remember the
credentials for free purchases.
Use `mas outdated` to list all applications with pending updates.
@ -184,9 +185,14 @@ docs for more details.
## 💥 When something doesn't work
If you see the error "This redownload is not available for this Apple ID either because it was bought by a different user of the item was refunded or cancelled.", it's probably because you haven't installed the app through the App Store yet. See [#46](https://github.com/mas-cli/mas/issues/46#issuecomment-248581233).
If you see this error, it's probably because you haven't installed the app through the App Store yet.
See [#46](https://github.com/mas-cli/mas/issues/46#issuecomment-248581233).
> This redownload is not available for this Apple ID either because it was bought by a different user of the
> item was refunded or cancelled.
If `mas` doesn't work for you as expected (e.g. you can't update/download apps), run `mas reset` and try again. If the issue persists, please [file a bug](https://github.com/mas-cli/mas/issues/new)! All your feedback is much appreciated ✨
If `mas` doesn't work for you as expected (e.g. you can't update/download apps), run `mas reset` and try again.
If the issue persists, please [file a bug](https://github.com/mas-cli/mas/issues/new).
All your feedback is much appreciated! ✨
## 📺 Using `tmux`

View file

@ -2,18 +2,21 @@
- 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)
- Use `script/lint` to look for these before committing.
- Note that [two trailing spaces](https://gist.github.com/shaunlebron/746476e6e7a4d698b373)
is intentional in markdown documents to create a line break like `<br>`, so these should _not_ be removed.
- End each file with a [newline character](https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file#18789).
# Swift
## Swift
[Sample](sample.swift)
- Avoid [force unwrapping optionals](https://blog.timac.org/2017/0628-swift-banning-force-unwrapping-optionals/) with `!` in production code
- Production code is what gets shipped with the app. Basically, everything under the [`mas-cli/`](https://github.com/mas-cli/mas/tree/master/mas-cli) folder.
- However, force unwrapping is **encouraged** in tests for less code and tests _should_ break when any expected conditions aren't met.
- Avoid [force unwrapping optionals](https://blog.timac.org/2017/0628-swift-banning-force-unwrapping-optionals/)
with `!` in production code
- Production code is what gets shipped with the app. Basically, everything under the
[`mas-cli/`](https://github.com/mas-cli/mas/tree/master/mas-cli) folder.
- However, force unwrapping is **encouraged** in tests for less code and tests
_should_ break when any expected conditions aren't met.
- Prefer `struct`s over `class`es wherever possible
- Default to marking classes as `final`
- Prefer protocol conformance to class inheritance

View file

@ -13,13 +13,17 @@
echo "==> 🚨 Formatting mas"
for LINTER in shfmt swift-format swiftformat swiftlint; do
for LINTER in markdownlint shfmt swift-format swiftformat swiftlint; do
if [[ ! -x "$(command -v ${LINTER})" ]]; then
echo "error: ${LINTER} is not installed. Run 'script/bootstrap' or 'brew install ${LINTER}'."
exit 1
fi
done
echo
echo "--> 🖊 Markdown"
markdownlint --config .markdownlint.json --fix .github .
echo
echo "--> 🕊️ Swift"
for SOURCE in Package.swift Sources Tests; do

View file

@ -12,7 +12,7 @@
echo "==> 🚨 Linting mas"
for LINTER in git swift-format swiftformat swiftlint; do
for LINTER in git markdownlint shfmt swift-format swiftformat swiftlint; do
if [[ ! -x "$(command -v ${LINTER})" ]]; then
echo "error: ${LINTER} is not installed. Run 'script/bootstrap' or 'brew install ${LINTER}'."
exit 1
@ -22,6 +22,10 @@ done
echo "--> 🌳 Git"
git diff --check
echo
echo "--> 🖊 Markdown"
markdownlint --config .markdownlint.json .github .
echo
echo "--> 🕊️ Swift"
for SOURCE in Package.swift Sources Tests; do