Skip to content

Commit 5fd3dfe

Browse files
authored
Merge pull request #1452 from guoard/markdown-linter
feat(docs): add markdown linter for exercises README.md files
2 parents 8a7f437 + 382e16e commit 5fd3dfe

File tree

7 files changed

+27
-2
lines changed

7 files changed

+27
-2
lines changed

.github/workflows/lint.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: DavidAnson/markdownlint-cli2-action@v9
17+
with:
18+
globs: "exercises/**/*.md"

.markdownlint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# MD013/line-length Line length, Expected: 80
2+
MD013: false

exercises/conversions/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The simplest form of type conversion is a type cast expression. It is denoted wi
66

77
Rust also offers traits that facilitate type conversions upon implementation. These traits can be found under the [`convert`](https://doc.rust-lang.org/std/convert/index.html) module.
88
The traits are the following:
9+
910
- `From` and `Into` covered in [`from_into`](from_into.rs)
1011
- `TryFrom` and `TryInto` covered in [`try_from_into`](try_from_into.rs)
1112
- `AsRef` and `AsMut` covered in [`as_ref_mut`](as_ref_mut.rs)
@@ -17,5 +18,6 @@ These should be the main ways ***within the standard library*** to convert data
1718
## Further information
1819

1920
These are not directly covered in the book, but the standard library has a great documentation for it.
21+
2022
- [conversions](https://doc.rust-lang.org/std/convert/index.html)
21-
- [`FromStr` trait](https://doc.rust-lang.org/std/str/trait.FromStr.html)
23+
- [`FromStr` trait](https://doc.rust-lang.org/std/str/trait.FromStr.html)

exercises/hashmaps/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Hashmaps
2+
23
A *hash map* allows you to associate a value with a particular key.
34
You may also know this by the names [*unordered map* in C++](https://en.cppreference.com/w/cpp/container/unordered_map),
45
[*dictionary* in Python](https://docs.python.org/3/tutorial/datastructures.html#dictionaries) or an *associative array* in other languages.

exercises/options/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Type Option represents an optional value: every Option is either Some and contains a value, or None, and does not.
44
Option types are very common in Rust code, as they have a number of uses:
5+
56
- Initial values
67
- Return values for functions that are not defined over their entire input range (partial functions)
78
- Return value for otherwise reporting simple errors, where None is returned on error

exercises/smart_pointers/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Smart Pointers
2+
23
In Rust, smart pointers are variables that contain an address in memory and reference some other data, but they also have additional metadata and capabilities.
34
Smart pointers in Rust often own the data they point to, while references only borrow data.
45

exercises/traits/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ Data types can implement traits. To do so, the methods making up the trait are d
77
In this way, traits are somewhat similar to Java interfaces and C++ abstract classes.
88

99
Some additional common Rust traits include:
10+
1011
- `Clone` (the `clone` method)
1112
- `Display` (which allows formatted display via `{}`)
1213
- `Debug` (which allows formatted display via `{:?}`)
1314

1415
Because traits indicate shared behavior between data types, they are useful when writing generics.
1516

16-
1717
## Further information
1818

1919
- [Traits](https://doc.rust-lang.org/book/ch10-02-traits.html)

0 commit comments

Comments
 (0)