Skip to content

Commit 3f32ff2

Browse files
lgoettgenshyrodium
andauthored
Update documentation (#159)
Co-authored-by: Yuto Horikawa <[email protected]>
1 parent f3be189 commit 3f32ff2

File tree

3 files changed

+106
-57
lines changed

3 files changed

+106
-57
lines changed

README.md

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,13 @@ Aqua.jl provides functions to run a few automatable checks for Julia packages:
1717
* Check that all external packages listed in `deps` have corresponding
1818
`compat` entry.
1919
* `Project.toml` formatting is compatible with Pkg.jl output.
20-
* There are no "obvious" type piracies ([**new in 0.6**](#notes-on-aqua-06))
20+
* There are no "obvious" type piracies.
2121

22-
See more in the [documentation](https://juliatesting.github.io/Aqua.jl/dev).
22+
See more in the [documentation](https://juliatesting.github.io/Aqua.jl/).
2323

24-
## Quick usage
24+
## Setup
2525

26-
Call `Aqua.test_all(YourPackage)` from `test/runtests.jl`, e.g.,
27-
28-
```julia
29-
using YourPackage
30-
using Aqua
31-
Aqua.test_all(YourPackage)
32-
```
33-
34-
## Notes on Aqua 0.6
35-
36-
Aqua 0.6 includes the type piracy detection, thanks to [the PR](https://github.com/JuliaTesting/Aqua.jl/pull/88) by Jakob
37-
Nybo Nissen (@jakobnissen) and [the original implementation](https://discourse.julialang.org/t/pirate-hunter/20402) by
38-
Frames Catherine White (@oxinabox).
39-
40-
If this part of Aqua 0.6 causes a trouble, then you can disable the piracy detection
41-
with a flag as in `Aqua.test_all(YourPackage; piracy = false)`.
42-
43-
## Specifying Aqua version
44-
45-
To avoid breaking test when a new Aqua.jl version is released, it is
46-
recommended to add version bound for Aqua.jl in `test/Project.toml`:
47-
48-
```toml
49-
[deps]
50-
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
51-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
52-
53-
[compat]
54-
Aqua = "0.6"
55-
```
26+
Please consult the [stable documentation](https://juliatesting.github.io/Aqua.jl/) and the the [dev documentation](https://juliatesting.github.io/Aqua.jl/dev/) for the latest instructions.
5627

5728
## Badge
5829

docs/src/index.md

Lines changed: 102 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,107 @@
1-
# Aqua.jl
1+
# Aqua.jl:
2+
## *A*uto *QU*ality *A*ssurance for Julia packages
23

3-
```@autodocs
4-
Modules = [Aqua]
5-
Private = false
4+
Aqua.jl provides functions to run a few automatable checks for Julia packages:
5+
6+
* There are no method ambiguities.
7+
* There are no undefined `export`s.
8+
* There are no unbound type parameters.
9+
* There are no stale dependencies listed in `Project.toml`.
10+
* Check that test target of the root project `Project.toml` and test project
11+
(`test/Project.toml`) are consistent.
12+
* Check that all external packages listed in `deps` have corresponding
13+
`compat` entry.
14+
* `Project.toml` formatting is compatible with Pkg.jl output.
15+
* There are no "obvious" type piracies.
16+
17+
## Quick usage
18+
19+
Call `Aqua.test_all(YourPackage)` from the REPL, e.g.,
20+
21+
```julia
22+
using YourPackage
23+
using Aqua
24+
Aqua.test_all(YourPackage)
25+
```
26+
27+
## How to add Aqua.jl...
28+
29+
### ...as a test dependency?
30+
31+
There are two ways to add Aqua.jl as a test dependency to your package.
32+
To avoid breaking tests when a new Aqua.jl version is released, it is
33+
recommended to add a version bound for Aqua.jl.
34+
35+
1. In `YourPackage/test/Project.toml`, add Aqua.jl to `[dep]` and `[compat]` sections, like
36+
```toml
37+
[deps]
38+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
39+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
40+
41+
[compat]
42+
Aqua = "0.6"
43+
```
44+
45+
2. In `YourPackage/Project.toml`, add Aqua.jl to `[compat]` and `[extras]` section and the `test` target, like
46+
```toml
47+
[compat]
48+
Aqua = "0.6"
49+
50+
[extras]
51+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
52+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
53+
54+
[targets]
55+
test = ["Aqua", "Test"]
56+
```
57+
58+
If your package supports Julia pre-1.2, you need to use the second approach,
59+
although you can use both approaches at the same time.
60+
61+
!!! warning
62+
In normal use, `Aqua.jl` should not be added to `[deps]` in `YourPackage/Project.toml`!
63+
64+
### ...to your tests?
65+
It is recommended to create a separate file `YourPackage/test/Aqua.jl` that gets included in `YourPackage/test/runtests.jl`
66+
with either
67+
68+
```julia
69+
using Aqua
70+
Aqua.test_all(YourPackage)
71+
```
72+
or some fine-grained checks with options, e.g.,
73+
74+
```julia
75+
using Aqua
76+
77+
@testset "Aqua.jl" begin
78+
Aqua.test_all(
79+
YourPackage;
80+
ambiguities=(exclude=[SomePackage.some_function], broken=true),
81+
unbound_args=true,
82+
undefined_exports=true,
83+
project_extras=true,
84+
stale_deps=(ignore=[:SomePackage],),
85+
deps_compat=(ignore=[:SomeOtherPackage],),
86+
project_toml_formatting=true,
87+
piracy=false,
88+
)
89+
end
90+
```
91+
For more details on the options, see the respective functions [below](@ref test_functions).
92+
93+
### Example uses
94+
The following is a small selection of packages that use Aqua.jl:
95+
- [GAP.jl](https://github.com/oscar-system/GAP.jl)
96+
- [Hecke.jl](https://github.com/thofma/Hecke.jl)
97+
- [Oscar.jl](https://github.com/oscar-system/Oscar.jl)
98+
99+
## [Test functions](@id test_functions)
100+
```@docs
101+
Aqua.test_all
6102
```
7103

8104
```@autodocs
9-
Modules = [Aqua, Aqua.Piracy]
10-
Public = false
11-
Filter = t -> startswith(String(nameof(t)), "test_")
105+
Modules = [Aqua]
106+
Filter = t -> startswith(String(nameof(t)), "test_") && t != Aqua.test_all
12107
```

src/Aqua.jl

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
module Aqua
22

3-
@doc let path = joinpath(dirname(@__DIR__), "README.md")
4-
include_dependency(path)
5-
read(path, String)
6-
end Aqua
7-
83
using Base: PkgId, UUID
94
using Pkg: Pkg, TOML
105
using Test
@@ -42,18 +37,6 @@ Run following tests in isolated testset:
4237
* [`test_project_toml_formatting(testtarget)`](@ref test_project_toml_formatting)
4338
* [`test_piracy(testtarget)`](@ref test_piracy)
4439
45-
!!! compat "Aqua.jl 0.5"
46-
47-
Since Aqua.jl 0.5:
48-
49-
* `test_all` runs [`test_ambiguities`](@ref) with `Core`. This
50-
means method ambiguities of constructors can now be detected.
51-
In Aqua.jl 0.4, `test_ambiguities` was invoked with
52-
`[testtarget, Base]`.
53-
54-
* `test_all` runs [`test_stale_deps`](@ref). In Aqua.jl 0.4, this
55-
check was opt-in.
56-
5740
The keyword argument `\$x` (e.g., `ambiguities`) can be used to
5841
control whether or not to run `test_\$x` (e.g., `test_ambiguities`).
5942
If `test_\$x` supports keyword arguments, a `NamedTuple` can also be

0 commit comments

Comments
 (0)