-
Notifications
You must be signed in to change notification settings - Fork 216
/
goodcheck.yml
91 lines (82 loc) · 2.37 KB
/
goodcheck.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
rules:
- id: rbs.no_arg
pattern:
regexp: arg\d+
message: |
Stop using parameter names like `arg0` or `arg1`
The parameter names like `arg0` or `arg1` is not informative enough.
Try finding good parameter names from documents or arglists.
If you cannot find a good name, just delete the name of the parameters.
justification:
- Documents (comments) may contain that pattern.
glob:
- "{core,stdlib}/**/*.rbs"
fail:
- "def `send`: (interned arg0, *untyped arg1) -> untyped"
pass:
- "def `send`: (interned, *untyped) -> untyped"
- id: rbs.prefer_boolish
pattern:
- regexp: '\([^(]*\bbool\b[^\n]*\)'
- token: "-> bool }"
message: |
Prefer `boolish` over `bool` for method arguments and block return values
See the doc below:
https://github.com/ruby/rbs/blob/78d04a2db0f1c4925d2b13c2939868edf9465d6c/docs/syntax.md#bool-or-boolish
glob:
- "**/*.rbs"
justification:
- When you strictly want `true | false`. Use `bool` in this case.
pass:
- "(arg: boolish)"
- "{ () -> boolish }"
fail:
- "(arg: bool)"
- "{ () -> bool }"
- id: deprecate_stdlib_test
pattern:
token: < StdlibTest
message: |
StdlibTest is deprecated
We recommend writing tests based on `TypeAssertions` and `#assert_send_type`.
justification:
- When you are updating existing tests.
- When you are writing tests for callback, which cannot be done with `#assert_send_type`.
glob:
- "test/stdlib/**/*_test.rb"
fail:
- |
class IntegerTest < StdlibTest
target Integer
def test_plus
1 + 2
end
end
pass:
- |
class IntegerTest < Test::Unit::TestCase
include TypeAssertions
testing "Integer"
def test_plus
assert_send_type "(::Integer) -> ::Integer",
1, :+, 2
end
end
- id: no_trailing_whitespace
pattern:
regexp: '[ \t]+$'
message: |
Trim trailing whitespaces
glob:
- '**/*.rb'
- '**/*.rbs'
- '**/*.md'
justification:
- Let the maintainers know if it is an autogenerated files.
pass:
- "Hello world"
- "Hello\nworld"
- "Hello\n\nworld"
fail:
- "Hello world "
- "Hello \nworld"