diff --git a/Cargo.lock b/Cargo.lock index d437ef2..b366ed6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,7 +50,7 @@ dependencies = [ [[package]] name = "arcw-lint-js" -version = "0.1.12" +version = "0.1.14" dependencies = [ "annotate-snippets", "arcw-lint", diff --git a/README.md b/README.md index 5ad3843..0034fa9 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,8 @@ error[preamble-order]: preamble header `description` must come after `title` | `preamble-req` | All required preamble headers are present. | | `preamble-req-category` | The `category` header is present only when required. | | `preamble-req-last-call-deadline` | The `last-call-deadline` header is present only when required. | -| `preamble-req-withdrawal-reason` | The `withdrawal-reason` header is present only when required. | +| `preamble-req-withdrawal-reason` | The `withdrawal-reason` header is present only when required. +| `preamble-req-deprecated-reason` | The `deprecated-reason` header is present only when required. | | `preamble-requires-ref-description` | Proposals mentioned in the `description` header appear in the `requires` header. | | `preamble-requires-ref-title` | Proposals mentioned in the `title` header appear in the `requires` header. | | `preamble-requires-status` | arcs listed in `requires` have statuses further along than the current proposal. | diff --git a/arcw-lint-js/Cargo.toml b/arcw-lint-js/Cargo.toml index 594a3ca..8956de4 100644 --- a/arcw-lint-js/Cargo.toml +++ b/arcw-lint-js/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "arcw-lint-js" -version = "0.1.12" +version = "0.1.14" edition = "2021" license = "MPL-2.0" rust-version = "1.60" diff --git a/arcw-lint-js/tests/arcs/arc-0020.md b/arcw-lint-js/tests/arcs/arc-0020.md index c2f393d..c8cbb56 100644 --- a/arcw-lint-js/tests/arcs/arc-0020.md +++ b/arcw-lint-js/tests/arcs/arc-0020.md @@ -1,4 +1,4 @@ --- -status: Draft +status: Final --- diff --git a/arcw-lint-js/tests/arcs/arc-1000.md b/arcw-lint-js/tests/arcs/arc-1000.md index 2a6e058..03e4d86 100644 --- a/arcw-lint-js/tests/arcs/arc-1000.md +++ b/arcw-lint-js/tests/arcs/arc-1000.md @@ -4,12 +4,11 @@ title: A sample proposal description: This proposal is a sample that should be considered author: John Doe (@johndoe), Jenny Doe discussions-to: https://github.com/algorandfoundation/ARCs/issues/ -status: Last Call -last-call-deadline: 2020-01-01 +status: Withdrawn type: Standards Track category: Core created: 2020-01-01 -requires: 20 +withdrawal-reason: not good --- ## Abstract diff --git a/arcw-lint/src/lib.rs b/arcw-lint/src/lib.rs index bbe6294..e6ce98f 100644 --- a/arcw-lint/src/lib.rs +++ b/arcw-lint/src/lib.rs @@ -140,6 +140,15 @@ pub fn default_lints() -> impl Iterator)> { } .boxed(), ), + ( + "preamble-len-withdrawal-reason", + preamble::Length { + name: "withdrawal-reason", + min: Some(2), + max: Some(140), + } + .boxed(), + ), ( "preamble-req", preamble::Required(&[ @@ -168,6 +177,8 @@ pub fn default_lints() -> impl Iterator)> { "created", "requires", "withdrawal-reason", + "replaces", + "superseded-by", ]) .boxed(), ), @@ -203,6 +214,15 @@ pub fn default_lints() -> impl Iterator)> { } .boxed(), ), + ( + "preamble-req-superseded-by", + preamble::RequiredIfEq { + when: "status", + equals: "Deprecated", + then: "superseded-by", + } + .boxed(), + ), ( "preamble-enum-status", preamble::OneOf { @@ -214,6 +234,7 @@ pub fn default_lints() -> impl Iterator)> { "Final", "Stagnant", "Withdrawn", + "Deprecated", "Living", ], } @@ -244,7 +265,7 @@ pub fn default_lints() -> impl Iterator)> { &["Draft", "Stagnant"], &["Review"], &["Last Call"], - &["Final", "Withdrawn", "Living"], + &["Final", "Withdrawn", "Living","Deprecated"], ] }.boxed(), ), @@ -328,7 +349,7 @@ pub fn default_lints() -> impl Iterator)> { &["Draft", "Stagnant"], &["Review"], &["Last Call"], - &["Final", "Withdrawn", "Living"], + &["Final", "Withdrawn", "Living","Deprecated"], ] }.boxed(), ) diff --git a/arcw-lint/tests/arcv/preamble-status-deprecated/input.md b/arcw-lint/tests/arcv/preamble-status-deprecated/input.md new file mode 100644 index 0000000..8fa27b6 --- /dev/null +++ b/arcw-lint/tests/arcv/preamble-status-deprecated/input.md @@ -0,0 +1,39 @@ +--- +arc: 1 +title: A sample proposal +description: A sample description +author: John Doe (@johndoe) +discussions-to: https://github.com/algorandfoundation/ARCs/issues/ +status: Deprecated +type: Standards Track +category: Core +created: 2020-01-01 +deprecated-reason: New ARC is better +--- + +## Abstract +This is the abstract for the arc. + +## Motivation +This is the motivation for the arc. + +## Specification +This is the specification for the arc. + +## Rationale +This is the rationale for the arc. + +## Backwards Compatibility +These are the backwards compatibility concerns for the arc. + +## Test Cases +These are the test cases for the arc. + +## Reference Implementation +This is the implementation for the arc. + +## Security Considerations +These are the security considerations for the arc. + +## Copyright +Copyright and related rights waived via [CC0](../LICENSE.md). diff --git a/arcw-lint/tests/arcv/preamble-status-deprecated/valid.txt b/arcw-lint/tests/arcv/preamble-status-deprecated/valid.txt new file mode 100644 index 0000000..e69de29 diff --git a/arcw-lint/tests/arcv/preamble-status-invalid/expected.txt b/arcw-lint/tests/arcv/preamble-status-invalid/expected.txt index eabf5bd..1c77f94 100644 --- a/arcw-lint/tests/arcv/preamble-status-invalid/expected.txt +++ b/arcw-lint/tests/arcv/preamble-status-invalid/expected.txt @@ -2,5 +2,5 @@ error[preamble-enum-status]: preamble header `status` has an unrecognized value --> input.md:7:8 | 7 | status: Invalid - | ^^^^^^^^ must be one of: `Draft`, `Review`, `Last Call`, `Final`, `Stagnant`, `Withdrawn`, `Living` + | ^^^^^^^^ must be one of: `Draft`, `Review`, `Last Call`, `Final`, `Stagnant`, `Withdrawn`, `Living`, `Deprecated` |