Skip to content

Commit

Permalink
Merge branch 'main' into fix/typos
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit authored Apr 13, 2024
2 parents c5972b8 + f053442 commit fd2cf8c
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 48 deletions.
2 changes: 0 additions & 2 deletions .grit/patterns/css/aspect_ratio.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Aspect ratio
---

# {{ page.title }}

```grit
language css
Expand Down
13 changes: 7 additions & 6 deletions .grit/patterns/go/cloudflare_go_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ Future migrations will be more seamless as we will be automatically generating t
{% /note %}


This migration can be applied automatically using the [Grit CLI](https://docs.grit.io/cli/quickstart):

```
grit apply cloudflare_go_v2
```


```grit
language go
Expand Down Expand Up @@ -651,12 +658,6 @@ file($body) where {
}
```

This migration can be applied automatically using the [Grit CLI](https://docs.grit.io/cli/quickstart):

```
grit apply cloudflare_go_v2
```

## Client construction with API key and email

Old:
Expand Down
4 changes: 1 addition & 3 deletions .grit/patterns/java/no_big_decimal_double.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
title: "BigDecimal(double)" should not be used
title: "`BigDecimal(double)` should not be used"
tags: [java]
---

# "BigDecimal(double)" should not be used

Because of floating point imprecision, the `BigDecimal(double)` constructor can be somewhat unpredictable. It is better to use `BigDecimal.valueOf(double)`.


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: [React2Hooks] Intelligent useEffect vs useLayoutEffect
title: "[React2Hooks] Intelligent useEffect vs useLayoutEffect"
tags: [fix]
---

Expand Down
9 changes: 2 additions & 7 deletions .grit/patterns/js/no_return_assign.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ title: Hoist assignment out of `return` statement
tags: [good, se]
---

# {{ page.title }}

This rule hoists the assignments out of `return`. Does not apply when assignment is wrapped in parentheses.
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.

This does not apply when assignment is wrapped in parentheses.

```grit
engine marzano(0.1)
Expand All @@ -21,10 +20,6 @@ language js
} => `$assignment;\n return $left;`
```

```
An assignment, `=`, is easy to confuse with a comparison, `==`. The best practice is not to use any assignments in return statements.
```

## Hoist `=` from `return` statement

```javascript
Expand Down
2 changes: 0 additions & 2 deletions .grit/patterns/js/no_unsafe_negation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Rewrite `!key in col` ⇒ `!(key in col)`
tags: [fix]
---

# {{ page.title }}

Negates `key` instead of the entire expression, which is likely a bug.

The intent is usually to negate the entire relation expression.
Expand Down
2 changes: 0 additions & 2 deletions .grit/patterns/js/prefer_early_return.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: PreferEarlyReturn
tags: [lint, style]
---

# {{ page.title }}

Prefer to use early returns to keep functions flat.


Expand Down
3 changes: 2 additions & 1 deletion .grit/patterns/python/_test_add_multiple_bare_imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ language python


```python
# This is an empty block
```

```python
import math
import re
import json


# This is an empty block
```

## Add missing imports
Expand Down
3 changes: 2 additions & 1 deletion .grit/patterns/python/_test_add_one_bare_import.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ language python


```python
# Add one
```

```python
import math


# Add one
```

## Do not add duplicate bare import
Expand Down
3 changes: 2 additions & 1 deletion .grit/patterns/python/_test_ensure_import_from.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ language python


```python
# Empty block
```

```python
from math import prod


# Empty block
```

## Add one more name to source
Expand Down
2 changes: 0 additions & 2 deletions .grit/patterns/solidity/EtherTransfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Ether Transfer
---

# {{ page.title }}

```grit
language sol
Expand Down
2 changes: 0 additions & 2 deletions .grit/patterns/solidity/NestedLoop.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Nested Loop
tags: [reentrancy, vulnerability]
---

# {{ page.title }}

Inspect nested loops.


Expand Down
2 changes: 0 additions & 2 deletions .grit/patterns/solidity/NoMulDivRoundUp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: NoMulDiv
---

# {{ page.title }}

Say we do not want `mulDivRoundUp`.

```grit
Expand Down
2 changes: 0 additions & 2 deletions .grit/patterns/solidity/UpgradableProxyPattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Upgradable Proxy Pattern
tags: [reentrancy, vulnerability]
---

# {{ page.title }}

Looking for variations of the upgradable proxy pattern.


Expand Down
2 changes: 1 addition & 1 deletion .grit/patterns/sql/add_pg_unit_test.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ CREATE PROCEDURE remove_emp(employee_id int) AS
tot_emps := tot_emps - 1;
END;


-- Check that 'remove_emp' has been translated into valid plpgsql
SELECT has_function('remove_emp');
SELECT is_procedure('remove_emp');
SELECT function_lang_is('remove_emp', 'pgplsql' );

```
4 changes: 2 additions & 2 deletions .grit/patterns/sql/oracle_quote_procedure.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Oracle to PG: Dollar quote stored procedure body
title: "Oracle to PG: Dollar quote stored procedure body"
---

In Postgres, function and procedure bodies need to be wrapped in $$dollar quotes$$.
Expand Down Expand Up @@ -40,4 +40,4 @@ CREATE PROCEDURE remove_emp (employee_id int) AS
tot_emps := tot_emps - 1;
END;
$$ LANGUAGE plpgsql;
```
```
2 changes: 1 addition & 1 deletion .grit/patterns/sql/oracle_to_pg.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ CREATE PROCEDURE remove_emp(employee_id NUMERIC) AS
END;
$$ LANGUAGE plpgsql;


-- Check that 'remove_emp' has been translated into valid plpgsql
SELECT has_function('remove_emp');
SELECT is_procedure('remove_emp');
SELECT function_lang_is('remove_emp', 'pgplsql' );

```
11 changes: 11 additions & 0 deletions .grit/patterns/yaml/concourse_v7.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,76 +136,87 @@ jobs:
code: one-js
output_mapping:
code: a-js

- task: create-file-2
params:
FUNCTION: file2-js
input_mapping:
code: one-js
output_mapping:
code: a-js

- task: create-file-3
params:
FUNCTION: file3-js
input_mapping:
code: one-js
output_mapping:
code: a-js

- task: create-file-4
params:
FUNCTION: file1-js
input_mapping:
code: two-js
output_mapping:
code: a-js

- task: create-file-5
params:
FUNCTION: file2-js
input_mapping:
code: two-js
output_mapping:
code: a-js

- task: create-file-6
params:
FUNCTION: file3-js
input_mapping:
code: two-js
output_mapping:
code: a-js

- task: create-file-7
params:
FUNCTION: file1-js
input_mapping:
code: one-js
output_mapping:
code: b-js

- task: create-file-8
params:
FUNCTION: file2-js
input_mapping:
code: one-js
output_mapping:
code: b-js

- task: create-file-9
params:
FUNCTION: file3-js
input_mapping:
code: one-js
output_mapping:
code: b-js

- task: create-file-10
params:
FUNCTION: file1-js
input_mapping:
code: two-js
output_mapping:
code: b-js

- task: create-file-11
params:
FUNCTION: file2-js
input_mapping:
code: two-js
output_mapping:
code: b-js

- task: create-file-12
params:
FUNCTION: file3-js
Expand Down
2 changes: 0 additions & 2 deletions old_patterns/NonTrivialMath.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Non-trivial math
---

# {{ page.title }}

```grit
or {
// ds-math
Expand Down
2 changes: 0 additions & 2 deletions old_patterns/ReentrancyBeforeAndAfter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Reentrancy, assignments both before and after
---

# {{ page.title }}

A transfer with member assignments both before and after the transfer.

See case 2 here: https://github.com/runtimeverification/amp/issues/39#issuecomment-1137314683
Expand Down
2 changes: 0 additions & 2 deletions old_patterns/ReentrancyLowRisk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Reentrancy, not last line
---

# {{ page.title }}

Member assignemnt just before the transfer, but transfer not on the last line

See case 3 here: https://github.com/runtimeverification/amp/issues/39#issuecomment-1137314683
Expand Down
2 changes: 0 additions & 2 deletions old_patterns/ReentrancyNoBefore.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Reentrancy, no assignment before
---

# {{ page.title }}

No field assignment before a transfer.

See case 1 here: https://github.com/runtimeverification/amp/issues/39#issuecomment-1137314683
Expand Down
2 changes: 0 additions & 2 deletions wip/StyledJSXToCSSModules.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: Convert Styled JSX to CSS Modules
---

# {{ page.title }}

Extract all Styled JSX from a particular file and move it to CSS Module files.

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

0 comments on commit fd2cf8c

Please sign in to comment.