Skip to content

Commit b02b5aa

Browse files
authored
Merge pull request #18 from alithethird/feat/update-doc-urls
Feat/update doc urls
2 parents 0218cdf + 96e8a4f commit b02b5aa

File tree

4 files changed

+44
-51
lines changed

4 files changed

+44
-51
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "vipyrdocs"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
edition = "2021"
55

66
[[bin]]

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@ class MyProcessor2(DataProcessor):
7676

7777
Add a `# vipyrdocs: disable=<CODES>` comment to the end of a `def`/`class` line or statement to silence specific checks (for example, `# vipyrdocs: disable=D020`). Use `ALL` to silence everything for that scope, or `disable-next-docstring`/`disable-file` variants to target the next docstring or whole file when needed.
7878

79-
## 🔮 Roadmap
80-
81-
- Configurable docstring rules
82-
- Output in JSON / SARIF
83-
- Git pre-commit hook support
84-
- VSCode integration
85-
86-
8779
### Ruleset: 29
8880

8981

src/constants.rs

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
pub const ERROR_CODE_PREFIX: &str = "D";
2-
pub const MORE_INFO_BASE: &str = "https://github.com/alithethird/vipyrdocs/"; //" (more info: https://example.com/";
2+
pub const MORE_INFO_BASE: &str = "https://github.com/alithethird/vipyrdocs/wiki/The-ruleset#"; //" (more info: https://example.com/";
33

4-
fn create_doc_link(_doc: String) -> String{
5-
format!("{}{}",
4+
fn create_doc_link(_doc: String, rule_explanation: &str) -> String{
5+
format!("{}{}{}",
66
MORE_INFO_BASE,
7-
"" //_doc.to_lowercase()
7+
_doc.to_lowercase(),
8+
rule_explanation,
89
// TODO: Update this when you write the docs
910
)
1011
}
@@ -14,9 +15,9 @@ pub fn docstr_missing_code() -> String {
1415
}
1516
pub fn docstr_missing_msg() -> String {
1617
format!(
17-
"{} docstring should be defined for a function/ method/ class {}",
18+
"{} docstring should be defined for a function/ class {}",
1819
docstr_missing_code(),
19-
create_doc_link(docstr_missing_code())
20+
create_doc_link(docstr_missing_code(), "-missing-docstring")
2021
)
2122
}
2223

@@ -25,9 +26,9 @@ pub fn args_section_not_in_docstr_code() -> String {
2526
}
2627
pub fn args_section_not_in_docstr_msg() -> String {
2728
format!(
28-
"{} a function/ method with arguments should have the arguments section in the docstring {}",
29+
"{} a function with arguments should have the arguments section in the docstring {}",
2930
args_section_not_in_docstr_code(),
30-
create_doc_link(args_section_not_in_docstr_code())
31+
create_doc_link(args_section_not_in_docstr_code(), "-missing-args-section")
3132
)
3233
}
3334

@@ -36,9 +37,9 @@ pub fn args_section_in_docstr_code() -> String {
3637
}
3738
pub fn args_section_in_docstr_msg() -> String {
3839
format!(
39-
"{} a function/ method without arguments should not have the arguments section in the docstring {}",
40+
"{} a function without arguments should not have the arguments section in the docstring {}",
4041
args_section_in_docstr_code(),
41-
create_doc_link(args_section_in_docstr_code())
42+
create_doc_link(args_section_in_docstr_code(), "-extra-args-section")
4243
)
4344
}
4445

@@ -50,7 +51,7 @@ pub fn mult_args_sections_in_docstr_msg(found: &str) -> String {
5051
"{} a docstring should only contain a single arguments section, found {} {}",
5152
mult_args_sections_in_docstr_code(),
5253
found,
53-
create_doc_link(mult_args_sections_in_docstr_code())
54+
create_doc_link(mult_args_sections_in_docstr_code(), "-multiple-args-section")
5455
)
5556
}
5657
pub fn arg_not_in_docstr_code() -> String {
@@ -61,7 +62,7 @@ pub fn arg_not_in_docstr_msg(_arg: &str) -> String {
6162
"{} \"{}\" argument should be described in the docstring {}",
6263
arg_not_in_docstr_code(),
6364
_arg,
64-
create_doc_link(arg_not_in_docstr_code())
65+
create_doc_link(arg_not_in_docstr_code(), "-missing-argument-in-the-section")
6566
)
6667
}
6768

@@ -73,7 +74,7 @@ pub fn arg_in_docstr_msg(_arg: &str) -> String {
7374
"{} \"{}\" argument should not be described in the docstring {}",
7475
arg_in_docstr_code(),
7576
_arg,
76-
create_doc_link(arg_in_docstr_code())
77+
create_doc_link(arg_in_docstr_code(), "-mysterious-argument-in-the-section")
7778
)
7879
}
7980

@@ -85,7 +86,7 @@ pub fn duplicate_arg_msg(_arg: &str) -> String {
8586
"{} \"{}\" argument documented multiple times {}",
8687
duplicate_arg_in_docstr_code(),
8788
_arg,
88-
create_doc_link(duplicate_arg_in_docstr_code())
89+
create_doc_link(duplicate_arg_in_docstr_code(), "-duplicate-arguments-in-the-section")
8990
)
9091
}
9192
pub fn returns_section_not_in_docstr_code() -> String {
@@ -94,9 +95,9 @@ pub fn returns_section_not_in_docstr_code() -> String {
9495

9596
pub fn returns_section_not_in_docstr_msg() -> String {
9697
format!(
97-
"{} function/ method that returns a value should have the returns section in the docstring {}",
98+
"{} function that returns a value should have the returns section in the docstring {}",
9899
returns_section_not_in_docstr_code(),
99-
create_doc_link(returns_section_not_in_docstr_code())
100+
create_doc_link(returns_section_not_in_docstr_code(), "-missing-returns-section")
100101
)
101102
}
102103

@@ -105,9 +106,9 @@ pub fn returns_section_in_docstr_code() -> String {
105106
}
106107
pub fn returns_section_in_docstr_msg() -> String {
107108
format!(
108-
"{} function/ method that does not return a value should not have the returns section in the docstring {}",
109+
"{} function that does not return a value should not have the returns section in the docstring {}",
109110
returns_section_in_docstr_code(),
110-
create_doc_link(returns_section_in_docstr_code())
111+
create_doc_link(returns_section_in_docstr_code(), "-extra-returns-section")
111112
)
112113
}
113114

@@ -119,7 +120,7 @@ pub fn mult_returns_sections_in_docstr_msg(found: &str) -> String {
119120
"{} a docstring should only contain a single returns section, found {} {}",
120121
mult_returns_sections_in_docstr_code(),
121122
found,
122-
create_doc_link(mult_returns_sections_in_docstr_code())
123+
create_doc_link(mult_returns_sections_in_docstr_code(), "-multiple-returns-section")
123124
)
124125
}
125126

@@ -128,9 +129,9 @@ pub fn yields_section_not_in_docstr_code() -> String {
128129
}
129130
pub fn yields_section_not_in_docstr_msg() -> String {
130131
format!(
131-
"{} function/ method that yields a value should have the yields section in the docstring {}",
132+
"{} function that yields a value should have the yields section in the docstring {}",
132133
yields_section_not_in_docstr_code(),
133-
create_doc_link(yields_section_not_in_docstr_code())
134+
create_doc_link(yields_section_not_in_docstr_code(), "-missing-yields-section")
134135
)
135136
}
136137

@@ -139,9 +140,9 @@ pub fn yields_section_in_docstr_code() -> String {
139140
}
140141
pub fn yields_section_in_docstr_msg() -> String {
141142
format!(
142-
"{} function/ method that does not yield a value should not have the yields section in the docstring {}",
143+
"{} function that does not yield a value should not have the yields section in the docstring {}",
143144
yields_section_in_docstr_code(),
144-
create_doc_link(yields_section_in_docstr_code())
145+
create_doc_link(yields_section_in_docstr_code(), "-extra-yields-section")
145146
)
146147
}
147148

@@ -153,7 +154,7 @@ pub fn mult_yields_sections_in_docstr_msg(found: &str) -> String {
153154
"{} a docstring should only contain a single yields section, found {} {}",
154155
mult_yields_sections_in_docstr_code(),
155156
found,
156-
create_doc_link(mult_yields_sections_in_docstr_code())
157+
create_doc_link(mult_yields_sections_in_docstr_code(), "-multiple-yields-section")
157158
)
158159
}
159160

@@ -162,19 +163,19 @@ pub fn raises_section_not_in_docstr_code() -> String {
162163
}
163164
pub fn raises_section_not_in_docstr_msg() -> String {
164165
format!(
165-
"{} a function/ method that raises an exception should have the raises section in the docstring {}",
166+
"{} a function that raises an exception should have the raises section in the docstring {}",
166167
raises_section_not_in_docstr_code(),
167-
create_doc_link(raises_section_not_in_docstr_code())
168+
create_doc_link(raises_section_not_in_docstr_code(), "-missing-raises-section")
168169
)
169170
}
170171
pub fn raises_section_in_docstr_code() -> String {
171172
format!("{}051", ERROR_CODE_PREFIX)
172173
}
173174
pub fn raises_section_in_docstr_msg() -> String {
174175
format!(
175-
"{} a function/ method that does not raise an exception should not have the raises section in the docstring {}",
176+
"{} a function that does not raise an exception should not have the raises section in the docstring {}",
176177
raises_section_in_docstr_code(),
177-
create_doc_link(raises_section_in_docstr_code())
178+
create_doc_link(raises_section_in_docstr_code(), "-extra-raises-section")
178179
)
179180
}
180181

@@ -186,7 +187,7 @@ pub fn mult_raises_sections_in_docstr_msg(found: &str) -> String {
186187
"{} a docstring should only contain a single raises section, found {} {}",
187188
mult_raises_sections_in_docstr_code(),
188189
found,
189-
create_doc_link(mult_raises_sections_in_docstr_code())
190+
create_doc_link(mult_raises_sections_in_docstr_code(), "-multiple-raises-section")
190191
)
191192
}
192193

@@ -198,7 +199,7 @@ pub fn exc_not_in_docstr_msg(_raise: &str) -> String {
198199
"{} \"{}\" exception should be described in the docstring {}",
199200
exc_not_in_docstr_code(),
200201
_raise,
201-
create_doc_link(exc_not_in_docstr_code())
202+
create_doc_link(exc_not_in_docstr_code(), "-missing-exception-in-the-section")
202203
)
203204
}
204205

@@ -210,7 +211,7 @@ pub fn exc_in_docstr_msg(_raise: &str) -> String {
210211
"{} \"{}\" exception should not be described in the docstring {}",
211212
exc_in_docstr_code(),
212213
_raise,
213-
create_doc_link(exc_in_docstr_code())
214+
create_doc_link(exc_in_docstr_code(), "-mysterious-exception-in-the-section")
214215
)
215216
}
216217

@@ -219,9 +220,9 @@ pub fn re_raise_no_exc_in_docstr_code() -> String {
219220
}
220221
pub fn re_raise_no_exc_in_docstr_msg() -> String {
221222
format!(
222-
"{} a function/ method that re-raises exceptions should describe at least one exception in the raises section of the docstring {}",
223+
"{} a function that re-raises exceptions should describe at least one exception in the raises section of the docstring {}",
223224
re_raise_no_exc_in_docstr_code(),
224-
create_doc_link(re_raise_no_exc_in_docstr_code())
225+
create_doc_link(re_raise_no_exc_in_docstr_code(), "-missing-re-raised-exception-in-the-section")
225226
)
226227
}
227228

@@ -233,7 +234,7 @@ pub fn duplicate_exc_msg(_raise: &str) -> String {
233234
"{} \"{}\" exception documented multiple times {}",
234235
duplicate_exc_code(),
235236
_raise,
236-
create_doc_link(duplicate_exc_code())
237+
create_doc_link(duplicate_exc_code(), "-duplicate-exception-in-the-section")
237238
)
238239
}
239240

@@ -245,7 +246,7 @@ pub fn attrs_section_not_in_docstr_msg() -> String {
245246
format!(
246247
"{} a class with attributes should have the attributes section in the docstring {}",
247248
attrs_section_not_in_docstr_code(),
248-
create_doc_link(attrs_section_not_in_docstr_code())
249+
create_doc_link(attrs_section_not_in_docstr_code(), "-missing-attributes-section")
249250
)
250251
}
251252

@@ -257,7 +258,7 @@ pub fn attrs_section_in_docstr_msg() -> String {
257258
format!(
258259
"{} a class without attributes should not have the attributes section in the docstring {}",
259260
attrs_section_in_docstr_code(),
260-
create_doc_link(attrs_section_in_docstr_code())
261+
create_doc_link(attrs_section_in_docstr_code(), "-extra-attributes-section")
261262
)
262263
}
263264
pub fn mult_attrs_section_in_docstr_code() -> String {
@@ -269,7 +270,7 @@ pub fn mult_attrs_section_in_docstr_msg(_attribute: &str) -> String {
269270
"{} a docstring should only contain a single attributes section, found {} {}",
270271
mult_attrs_section_in_docstr_code(),
271272
_attribute,
272-
create_doc_link(mult_attrs_section_in_docstr_code())
273+
create_doc_link(mult_attrs_section_in_docstr_code(), "-multiple-attributes-section")
273274
)
274275
}
275276

@@ -279,10 +280,10 @@ pub fn attr_not_in_docstr_code() -> String {
279280

280281
pub fn attr_not_in_docstr_msg(_attribute: &str) -> String {
281282
format!(
282-
"{} {} attribute/ property should be described in the docstring {}",
283+
"{} {} attribute/property should be described in the docstring {}",
283284
attr_not_in_docstr_code(),
284285
_attribute,
285-
create_doc_link(attr_not_in_docstr_code())
286+
create_doc_link(attr_not_in_docstr_code(), "-missing-attributes-in-the-section")
286287
)
287288
}
288289

@@ -295,7 +296,7 @@ pub fn attr_in_docstr_msg(_attribute: &str) -> String {
295296
"{} {} attribute should not be described in the docstring {}",
296297
attr_in_docstr_code(),
297298
_attribute,
298-
create_doc_link(attr_in_docstr_code())
299+
create_doc_link(attr_in_docstr_code(), "-mysterious-attributes-in-the-section")
299300
)
300301
}
301302

@@ -308,6 +309,6 @@ pub fn duplicate_attr_docstr_msg(_attribute: &str) -> String {
308309
"{} {} attribute documented multiple times {}",
309310
duplicate_attr_docstr_code(),
310311
_attribute,
311-
create_doc_link(attr_in_docstr_code())
312+
create_doc_link(attr_in_docstr_code(), "-duplicate-attributes-in-the-section")
312313
)
313314
}

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use inheritance::InheritanceTracker;
1212
#[derive(Parser, Debug)]
1313
#[command(
1414
name = "vipyrdocs",
15-
version = "0.1.2",
15+
version = "0.1.3",
1616
about = "🐍 vipyrdocs — Fast. Lethal. Python docstring checks.",
1717
long_about = r#"
1818
vipyrdocs — Fast. Lethal. Python docstring checks.

0 commit comments

Comments
 (0)