Skip to content

Commit f053442

Browse files
authored
fix: update pattern format (#190)
1 parent 3b6e304 commit f053442

23 files changed

+32
-48
lines changed

.grit/patterns/css/aspect_ratio.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: Aspect ratio
33
---
44

5-
# {{ page.title }}
6-
75
```grit
86
language css
97

.grit/patterns/go/cloudflare_go_v2.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ Future migrations will be more seamless as we will be automatically generating t
1111
{% /note %}
1212

1313

14+
This migration can be applied automatically using the [Grit CLI](https://docs.grit.io/cli/quickstart):
15+
16+
```
17+
grit apply cloudflare_go_v2
18+
```
19+
20+
1421
```grit
1522
language go
1623
@@ -651,12 +658,6 @@ file($body) where {
651658
}
652659
```
653660

654-
This migration can be applied automatically using the [Grit CLI](https://docs.grit.io/cli/quickstart):
655-
656-
```
657-
grit apply cloudflare_go_v2
658-
```
659-
660661
## Client construction with API key and email
661662

662663
Old:

.grit/patterns/java/no_big_decimal_double.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
2-
title: "BigDecimal(double)" should not be used
2+
title: "`BigDecimal(double)` should not be used"
33
tags: [java]
44
---
55

6-
# "BigDecimal(double)" should not be used
7-
86
Because of floating point imprecision, the `BigDecimal(double)` constructor can be somewhat unpredictable. It is better to use `BigDecimal.valueOf(double)`.
97

108

.grit/patterns/js/intelligent_useEffect_to_useLayoutEffect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: [React2Hooks] Intelligent useEffect vs useLayoutEffect
2+
title: "[React2Hooks] Intelligent useEffect vs useLayoutEffect"
33
tags: [fix]
44
---
55

.grit/patterns/js/no_return_assign.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ title: Hoist assignment out of `return` statement
33
tags: [good, se]
44
---
55

6-
# {{ page.title }}
7-
8-
This rule hoists the assignments out of `return`. Does not apply when assignment is wrapped in parentheses.
6+
This rule hoists the assignments out of `return`. Because an assignment, `=` is easy to confuse with a comparison, `==`, The best practice is not to use any assignments in return statements.
97

8+
This does not apply when assignment is wrapped in parentheses.
109

1110
```grit
1211
engine marzano(0.1)
@@ -21,10 +20,6 @@ language js
2120
} => `$assignment;\n return $left;`
2221
```
2322

24-
```
25-
An assignment, `=`, is easy to confuse with a comparison, `==`. The best practice is not to use any assignments in return statements.
26-
```
27-
2823
## Hoist `=` from `return` statement
2924

3025
```javascript

.grit/patterns/js/no_unsafe_negation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: Rewrite `!key in col` ⇒ `!(key in col)`
33
tags: [fix]
44
---
55

6-
# {{ page.title }}
7-
86
Negates `key` instead of the entire expression, which is likely a bug.
97

108
The intent is usually to negate the entire relation expression.

.grit/patterns/js/prefer_early_return.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: PreferEarlyReturn
33
tags: [lint, style]
44
---
55

6-
# {{ page.title }}
7-
86
Prefer to use early returns to keep functions flat.
97

108

.grit/patterns/python/_test_add_multiple_bare_imports.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ language python
2121

2222

2323
```python
24+
# This is an empty block
2425
```
2526

2627
```python
2728
import math
2829
import re
2930
import json
3031

31-
32+
# This is an empty block
3233
```
3334

3435
## Add missing imports

.grit/patterns/python/_test_add_one_bare_import.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ language python
1717

1818

1919
```python
20+
# Add one
2021
```
2122

2223
```python
2324
import math
2425

25-
26+
# Add one
2627
```
2728

2829
## Do not add duplicate bare import

.grit/patterns/python/_test_ensure_import_from.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ language python
1717

1818

1919
```python
20+
# Empty block
2021
```
2122

2223
```python
2324
from math import prod
2425

25-
26+
# Empty block
2627
```
2728

2829
## Add one more name to source

.grit/patterns/solidity/EtherTransfer.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: Ether Transfer
33
---
44

5-
# {{ page.title }}
6-
75
```grit
86
language sol
97

.grit/patterns/solidity/NestedLoop.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: Nested Loop
33
tags: [reentrancy, vulnerability]
44
---
55

6-
# {{ page.title }}
7-
86
Inspect nested loops.
97

108

.grit/patterns/solidity/NoMulDivRoundUp.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: NoMulDiv
33
---
44

5-
# {{ page.title }}
6-
75
Say we do not want `mulDivRoundUp`.
86

97
```grit

.grit/patterns/solidity/UpgradableProxyPattern.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ title: Upgradable Proxy Pattern
33
tags: [reentrancy, vulnerability]
44
---
55

6-
# {{ page.title }}
7-
86
Looking for variations of the upgradable proxy pattern.
97

108

.grit/patterns/sql/add_pg_unit_test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ CREATE PROCEDURE remove_emp(employee_id int) AS
4545
tot_emps := tot_emps - 1;
4646
END;
4747

48+
4849
-- Check that 'remove_emp' has been translated into valid plpgsql
4950
SELECT has_function('remove_emp');
5051
SELECT is_procedure('remove_emp');
5152
SELECT function_lang_is('remove_emp', 'pgplsql' );
52-
5353
```

.grit/patterns/sql/oracle_quote_procedure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Oracle to PG: Dollar quote stored procedure body
2+
title: "Oracle to PG: Dollar quote stored procedure body"
33
---
44

55
In Postgres, function and procedure bodies need to be wrapped in $$dollar quotes$$.
@@ -40,4 +40,4 @@ CREATE PROCEDURE remove_emp (employee_id int) AS
4040
tot_emps := tot_emps - 1;
4141
END;
4242
$$ LANGUAGE plpgsql;
43-
```
43+
```

.grit/patterns/sql/oracle_to_pg.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ CREATE PROCEDURE remove_emp(employee_id NUMERIC) AS
6969
END;
7070
$$ LANGUAGE plpgsql;
7171

72+
7273
-- Check that 'remove_emp' has been translated into valid plpgsql
7374
SELECT has_function('remove_emp');
7475
SELECT is_procedure('remove_emp');
7576
SELECT function_lang_is('remove_emp', 'pgplsql' );
76-
7777
```

.grit/patterns/yaml/concourse_v7.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,76 +136,87 @@ jobs:
136136
code: one-js
137137
output_mapping:
138138
code: a-js
139+
139140
- task: create-file-2
140141
params:
141142
FUNCTION: file2-js
142143
input_mapping:
143144
code: one-js
144145
output_mapping:
145146
code: a-js
147+
146148
- task: create-file-3
147149
params:
148150
FUNCTION: file3-js
149151
input_mapping:
150152
code: one-js
151153
output_mapping:
152154
code: a-js
155+
153156
- task: create-file-4
154157
params:
155158
FUNCTION: file1-js
156159
input_mapping:
157160
code: two-js
158161
output_mapping:
159162
code: a-js
163+
160164
- task: create-file-5
161165
params:
162166
FUNCTION: file2-js
163167
input_mapping:
164168
code: two-js
165169
output_mapping:
166170
code: a-js
171+
167172
- task: create-file-6
168173
params:
169174
FUNCTION: file3-js
170175
input_mapping:
171176
code: two-js
172177
output_mapping:
173178
code: a-js
179+
174180
- task: create-file-7
175181
params:
176182
FUNCTION: file1-js
177183
input_mapping:
178184
code: one-js
179185
output_mapping:
180186
code: b-js
187+
181188
- task: create-file-8
182189
params:
183190
FUNCTION: file2-js
184191
input_mapping:
185192
code: one-js
186193
output_mapping:
187194
code: b-js
195+
188196
- task: create-file-9
189197
params:
190198
FUNCTION: file3-js
191199
input_mapping:
192200
code: one-js
193201
output_mapping:
194202
code: b-js
203+
195204
- task: create-file-10
196205
params:
197206
FUNCTION: file1-js
198207
input_mapping:
199208
code: two-js
200209
output_mapping:
201210
code: b-js
211+
202212
- task: create-file-11
203213
params:
204214
FUNCTION: file2-js
205215
input_mapping:
206216
code: two-js
207217
output_mapping:
208218
code: b-js
219+
209220
- task: create-file-12
210221
params:
211222
FUNCTION: file3-js

old_patterns/NonTrivialMath.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: Non-trivial math
33
---
44

5-
# {{ page.title }}
6-
75
```grit
86
or {
97
// ds-math

old_patterns/ReentrancyBeforeAndAfter.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: Reentrancy, assignments both before and after
33
---
44

5-
# {{ page.title }}
6-
75
A transfer with member assignments both before and after the transfer.
86

97
See case 2 here: https://github.com/runtimeverification/amp/issues/39#issuecomment-1137314683

old_patterns/ReentrancyLowRisk.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: Reentrancy, not last line
33
---
44

5-
# {{ page.title }}
6-
75
Member assignemnt just before the transfer, but transfer not on the last line
86

97
See case 3 here: https://github.com/runtimeverification/amp/issues/39#issuecomment-1137314683

old_patterns/ReentrancyNoBefore.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: Reentrancy, no assignment before
33
---
44

5-
# {{ page.title }}
6-
75
No field assignment before a transfer.
86

97
See case 1 here: https://github.com/runtimeverification/amp/issues/39#issuecomment-1137314683

wip/StyledJSXToCSSModules.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
title: Convert Styled JSX to CSS Modules
33
---
44

5-
# {{ page.title }}
6-
75
Extract all Styled JSX from a particular file and move it to CSS Module files.
86

97
- If there are multiple components in a given file, we create separate CSS Module file for each one.

0 commit comments

Comments
 (0)