Skip to content

Commit

Permalink
enable markdown lint rules 12 and 31 (exercism#1191)
Browse files Browse the repository at this point in the history
* enable rule

* resolve multiple blanks

* enable 31, apply lints
  • Loading branch information
efx authored Mar 10, 2021
1 parent f5f079e commit a0da107
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ MD003:
MD009: true
# no reversed links
MD011: true
# MD012/no-multiple-blanks https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md012
MD012: true
MD013: false
# MD014/commands-show-output - Dollar signs used before commands without showing output
MD014: false

# MD031/blanks-around-fences https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md031---fenced-code-blocks-should-be-surrounded-by-blank-lines
MD031: true
# MD033/no-inline-html - Inline HTML
MD033:
# Allowed elements
Expand Down
1 change: 1 addition & 0 deletions concepts/destructuring/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Destructuring is a way to break apart compound values in Rust. It is often used to extract fields from tuples or structs.

For example, the below snippet extracts two values from a tuple:

```rust
let (first, second) = (1, 2);
```
Expand Down
3 changes: 3 additions & 0 deletions concepts/numbers/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
In Rust, there are are many specific types of numbers but they generally fall under one of two categories: integers or floating-point numbers.

Initializing an integer:

```rust
let x = 5; // rust defaults to an i32
```

Initializing a large positive integer:

```rust
let y: u64 = 7_000_000_000; // unsigned numbers can't be negative
```

Initializing floating-point numbers:

```rust
let x = 1.2; // defaults to f64

Expand Down
1 change: 0 additions & 1 deletion concepts/numeric-traits/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

TODO
- `Add`, `Sub`, `Mul`, `Div`

2 changes: 2 additions & 0 deletions concepts/option/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ There are several common idioms for using the value which might be present in an
## Examples

When a value exists in an `Option<u32>`:

```rust
let has_something: Option<u32> = Some(100);
assert_eq!(has_something.unwrap(), 100);
```

When a value *does not* exist in an `Option<u32>`:

```rust
let has_nothing: Option<u32> = None;
assert_eq!(has_nothing, None);
Expand Down
2 changes: 2 additions & 0 deletions concepts/string-vs-str/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ strings in no_std.)

This section discusses when to use `String` or `&str` for struct fields.
You'll often see structs defined with `String` instead of `&str` for field values.

```rust
struct Record {
latitude: f64,
Expand All @@ -82,6 +83,7 @@ struct Record {
state: String,
}
```

By using `String`, the struct owns the data.
This makes the code easier to read and teach for beginners.
But it also means heap allocations will occur for each field.
Expand Down
1 change: 0 additions & 1 deletion concepts/structs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Structs collect a fixed, heterogeneous set of data into a single unit. Structs i
- Every field of a struct has a particular name.
- Visibility is tracked at the field level: each field may be independently public, private, or other[^1].


# Structs Overview

Structs are defined using the `struct` keyword, followed by the name of the type the struct is describing.
Expand Down
1 change: 0 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Here are a few categories of welcome contribution:
- updating documentation
- fixing typos, misspellings, and grammatical errors


## Merging Philosophy

A [pull request](https://docs.github.com/en/github/getting-started-with-github/github-glossary#pull-request) should address one logical change.
Expand Down
3 changes: 3 additions & 0 deletions docs/maintaining.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ This is non-exhaustive.
- Scripts should use `#!/usr/bin/env bash` as their shebang
- This increases portability on NixOS and macOS because contributors' preferred bash may not be installed in `/bin/bash`.
- Prefer snake case for script file names

```sh
hello_world.sh
```

- This simplifies development when upgrading a script into a proper language. *Rusty tooling anyone?*
- Script file names should include the `.sh` extension
- Set the executable bit on scripts that should be called directly.
- Scripts should set the following options at the top

```bash
set -eo pipefail
```
Expand Down

0 comments on commit a0da107

Please sign in to comment.