platformos-check 0.4.12 → 0.4.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTING.md +20 -18
- data/README.md +108 -57
- data/RELEASING.md +14 -7
- data/TROUBLESHOOTING.md +19 -10
- data/data/platformos_liquid/documentation/filters.json +1 -1
- data/data/platformos_liquid/documentation/latest.json +1 -1
- data/data/platformos_liquid/documentation/tags.json +1 -1
- data/docs/api/check.md +7 -6
- data/docs/api/html_check.md +12 -13
- data/docs/api/liquid_check.md +17 -21
- data/docs/api/yaml_check.md +3 -3
- data/docs/checks/TEMPLATE.md.erb +16 -11
- data/docs/checks/convert_include_to_render.md +29 -13
- data/docs/checks/deprecated_filter.md +5 -9
- data/docs/checks/form_action.md +12 -12
- data/docs/checks/form_authenticity_token.md +21 -15
- data/docs/checks/graphql_in_for_loop.md +15 -13
- data/docs/checks/html_parsing_error.md +12 -12
- data/docs/checks/img_lazy_loading.md +13 -11
- data/docs/checks/img_width_and_height.md +21 -23
- data/docs/checks/include_in_render.md +11 -11
- data/docs/checks/invalid_args.md +11 -11
- data/docs/checks/liquid_tag.md +12 -12
- data/docs/checks/missing_enable_comment.md +7 -7
- data/docs/checks/missing_template.md +14 -13
- data/docs/checks/parse_json_format.md +15 -14
- data/docs/checks/parser_blocking_javascript.md +19 -14
- data/docs/checks/required_layout_object.md +5 -7
- data/docs/checks/space_inside_braces.md +12 -12
- data/docs/checks/syntax_error.md +10 -10
- data/docs/checks/template_length.md +12 -12
- data/docs/checks/translation_files_match.md +10 -11
- data/docs/checks/translation_key_exists.md +10 -11
- data/docs/checks/undefined_object.md +11 -13
- data/docs/checks/unknown_filter.md +11 -11
- data/docs/checks/unreachable_code.md +11 -11
- data/docs/checks/unused_assign.md +11 -11
- data/docs/checks/unused_partial.md +7 -11
- data/docs/checks/valid_yaml.md +11 -11
- data/docs/language_server/how_to_correct_code_with_code_actions_and_execute_command.md +62 -70
- data/lib/platformos_check/app.rb +23 -14
- data/lib/platformos_check/app_file.rb +25 -4
- data/lib/platformos_check/asset_file.rb +1 -1
- data/lib/platformos_check/file_system_storage.rb +1 -1
- data/lib/platformos_check/form_file.rb +1 -1
- data/lib/platformos_check/graphql_file.rb +1 -1
- data/lib/platformos_check/language_server/completion_context.rb +2 -0
- data/lib/platformos_check/language_server/handler.rb +6 -6
- data/lib/platformos_check/language_server/variable_lookup_finder.rb +8 -10
- data/lib/platformos_check/layout_file.rb +1 -1
- data/lib/platformos_check/partial_file.rb +1 -1
- data/lib/platformos_check/platformos_liquid/documentation.rb +2 -2
- data/lib/platformos_check/translation_file.rb +1 -1
- data/lib/platformos_check/version.rb +1 -1
- data/platformos-check.gemspec +1 -1
- metadata +5 -5
data/docs/checks/invalid_args.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# Prevent providing invalid arguments in function
|
1
|
+
# Prevent providing invalid arguments in `function`, `render` and `graphql` tags Liquid (`InvalidArgs`)
|
2
2
|
|
3
|
-
This check
|
3
|
+
This check ensures that invalid arguments are not provided in `function`, `render`, and `graphql` tags in Liquid files.
|
4
4
|
|
5
5
|
## Examples
|
6
6
|
|
7
|
-
The following examples
|
7
|
+
The following examples show code snippets that either fail or pass this check:
|
8
8
|
|
9
|
-
### ✗
|
9
|
+
### ✗ Incorrect Code Example (Avoid using this):
|
10
10
|
|
11
11
|
```liquid
|
12
12
|
{% comment %}app/graphql/my-query does not define invalid_argument{% endcomment %}
|
@@ -21,16 +21,16 @@ The following examples contain code snippets that either fail or pass this check
|
|
21
21
|
{% render res = 'my-partial', context: context %}
|
22
22
|
```
|
23
23
|
|
24
|
-
### ✓
|
24
|
+
### ✓ Correct Code Example (Use this instead):
|
25
25
|
|
26
26
|
```liquid
|
27
27
|
{% comment %}app/graphql/my-query defines defined_argument{% endcomment %}
|
28
28
|
{% graphql res = 'my-query', defined_argument: 10 %}
|
29
29
|
```
|
30
30
|
|
31
|
-
## Options
|
31
|
+
## Configuration Options
|
32
32
|
|
33
|
-
The
|
33
|
+
The default configuration for this check:
|
34
34
|
|
35
35
|
```yaml
|
36
36
|
InvalidArgs:
|
@@ -42,9 +42,9 @@ InvalidArgs:
|
|
42
42
|
| enabled | Whether the check is enabled. |
|
43
43
|
| severity | The [severity](https://documentation.platformos.com/developer-guide/platformos-check/platformos-check#check-severity) of the check. |
|
44
44
|
|
45
|
-
##
|
45
|
+
## Disabling This Check
|
46
46
|
|
47
|
-
|
47
|
+
Disabling this check is not recommended.
|
48
48
|
|
49
49
|
## Resources
|
50
50
|
|
@@ -52,5 +52,5 @@ It is not safe to disable this rule.
|
|
52
52
|
- [Rule source][codesource]
|
53
53
|
- [Documentation source][docsource]
|
54
54
|
|
55
|
-
[codesource]: /lib/platformos_check/checks/
|
56
|
-
[docsource]: /docs/checks/
|
55
|
+
[codesource]: /lib/platformos_check/checks/invalid_args.rb
|
56
|
+
[docsource]: /docs/checks/invalid_args.md
|
data/docs/checks/liquid_tag.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# Encourage
|
1
|
+
# Encourage Use of `{% liquid ... %}` Tag for Consecutive Statements (`LiquidTag`)
|
2
2
|
|
3
|
-
|
3
|
+
This check recommends using the `{% liquid ... %}` tag when four or more consecutive Liquid tags (`{% ... %}`) are found. The purpose of this check is to eliminate repetitive tag markers (`{%` and `%}`) in your platformOS application files for improved readability and maintainability.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Examples
|
6
6
|
|
7
|
-
|
7
|
+
The following examples show code snippets that either fail or pass this check:
|
8
8
|
|
9
|
-
|
9
|
+
### ✗ Incorrect Code Example (Avoid using this):
|
10
10
|
|
11
11
|
```liquid
|
12
12
|
{% if collection.image.size != 0 %}
|
@@ -18,7 +18,7 @@ This check is aimed at eliminating repetitive tag markers (`{%` and `%}`) in the
|
|
18
18
|
{% endif %}
|
19
19
|
```
|
20
20
|
|
21
|
-
|
21
|
+
### ✓ Correct Code Example (Use this instead):
|
22
22
|
|
23
23
|
```liquid
|
24
24
|
{%- liquid
|
@@ -32,9 +32,9 @@ This check is aimed at eliminating repetitive tag markers (`{%` and `%}`) in the
|
|
32
32
|
-%}
|
33
33
|
```
|
34
34
|
|
35
|
-
##
|
35
|
+
## Configuration Options
|
36
36
|
|
37
|
-
The default configuration for this check
|
37
|
+
The default configuration for this check:
|
38
38
|
|
39
39
|
```yaml
|
40
40
|
LiquidTag:
|
@@ -44,15 +44,15 @@ LiquidTag:
|
|
44
44
|
|
45
45
|
### `min_consecutive_statements`
|
46
46
|
|
47
|
-
The `min_consecutive_statements` option (Default: `5`) determines the maximum (inclusive) number of consecutive statements before the check recommends
|
47
|
+
The `min_consecutive_statements` option (Default: `5`) determines the maximum (inclusive) number of consecutive statements required before the check recommends refactoring to use the `{% liquid ... %}` tag.
|
48
48
|
|
49
|
-
##
|
49
|
+
## Disabling This Check
|
50
50
|
|
51
|
-
|
51
|
+
This check is safe to disable if it does not align with your coding standards.
|
52
52
|
|
53
53
|
## Version
|
54
54
|
|
55
|
-
This check has been introduced in
|
55
|
+
This check has been introduced in platformOS Check 0.0.1.
|
56
56
|
|
57
57
|
## Resources
|
58
58
|
|
@@ -1,12 +1,12 @@
|
|
1
|
-
# Prevent
|
1
|
+
# Prevent Missing `platformos-check-enable` Comments (`MissingEnableComment`)
|
2
2
|
|
3
|
-
|
3
|
+
This check ensures that when `platformos-check-disable` is used in your platformOS application, a corresponding `platformos-check-enable` comment is included to re-enable the checks.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Examples
|
6
6
|
|
7
|
-
|
7
|
+
The following examples show code snippets that either fail or pass this check:
|
8
8
|
|
9
|
-
|
9
|
+
### ✗ Incorrect Code Example (Avoid using this):
|
10
10
|
|
11
11
|
```liquid
|
12
12
|
<!doctype html>
|
@@ -21,7 +21,7 @@ This check aims at eliminating missing `platformos-check-enable` comments.
|
|
21
21
|
</html>
|
22
22
|
```
|
23
23
|
|
24
|
-
|
24
|
+
### ✓ Correct Code Example (Use this instead):
|
25
25
|
|
26
26
|
```liquid
|
27
27
|
<!doctype html>
|
@@ -39,7 +39,7 @@ This check aims at eliminating missing `platformos-check-enable` comments.
|
|
39
39
|
|
40
40
|
## Version
|
41
41
|
|
42
|
-
This check has been introduced in
|
42
|
+
This check has been introduced in platformOS Check 0.3.0.
|
43
43
|
|
44
44
|
## Resources
|
45
45
|
|
@@ -1,26 +1,26 @@
|
|
1
|
-
# Prevent
|
1
|
+
# Prevent Missing Templates (`MissingTemplate`)
|
2
2
|
|
3
|
-
This check
|
3
|
+
This check ensures that resources specified with the `render` tag, `function` tag, and the deprecated `include` tag actually exist. It aims to prevent Liquid rendering errors caused by referencing non-existent templates.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Examples
|
6
6
|
|
7
|
-
|
7
|
+
The following examples show code snippets that either fail or pass this check:
|
8
8
|
|
9
|
-
|
9
|
+
### ✗ Incorrect Code Example (Avoid using this):
|
10
10
|
|
11
11
|
```liquid
|
12
12
|
{% render 'partial-that-does-not-exist' %}
|
13
13
|
```
|
14
14
|
|
15
|
-
|
15
|
+
### ✓ Correct Code Example (Use this instead):
|
16
16
|
|
17
17
|
```liquid
|
18
18
|
{% render 'partial-that-exists' %}
|
19
19
|
```
|
20
20
|
|
21
|
-
##
|
21
|
+
## Configuration Options
|
22
22
|
|
23
|
-
The default configuration for this check
|
23
|
+
The default configuration for this check:
|
24
24
|
|
25
25
|
```yaml
|
26
26
|
MissingTemplate:
|
@@ -30,9 +30,10 @@ MissingTemplate:
|
|
30
30
|
|
31
31
|
### `ignore_missing`
|
32
32
|
|
33
|
-
Specify a list of patterns
|
33
|
+
Specify a list of patterns for missing template files to ignore.
|
34
34
|
|
35
|
-
|
35
|
+
- The `ignore` option ignores all occurrences of `MissingTemplate` according to the file in which they appear.
|
36
|
+
- The `ignore_missing` option ignores all occurrences of `MissingTemplate` based on the target template, the template being rendered.
|
36
37
|
|
37
38
|
For example:
|
38
39
|
|
@@ -42,7 +43,7 @@ MissingTemplate:
|
|
42
43
|
- icon-*
|
43
44
|
```
|
44
45
|
|
45
|
-
|
46
|
+
This configuration ignores offenses on `{% render 'icon-missing' %}` across all app files.
|
46
47
|
|
47
48
|
```yaml
|
48
49
|
MissingTemplate:
|
@@ -50,11 +51,11 @@ MissingTemplate:
|
|
50
51
|
- modules/private-module/index.liquid
|
51
52
|
```
|
52
53
|
|
53
|
-
|
54
|
+
This configuration ignores all `MissingTemplate` offenses in `modules/private-module/index.liquid`, regardless of the file being rendered.
|
54
55
|
|
55
56
|
## Version
|
56
57
|
|
57
|
-
This check has been introduced in
|
58
|
+
This check has been introduced in platformOS Check 0.0.1.
|
58
59
|
|
59
60
|
## Resources
|
60
61
|
|
@@ -1,16 +1,12 @@
|
|
1
|
-
# Prevent
|
1
|
+
# Prevent Unformatted `parse_json` Tags (`ParseJsonFormat`)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
This check exists to ensure the JSON in your parses is pretty.
|
6
|
-
|
7
|
-
It exists as a facilitator for its auto-correction. This way you can right-click fix the problem.
|
3
|
+
This check ensures that the JSON in your `parse_json` tags is properly formatted (pretty) for better readability. It facilitates auto-correction, allowing you to right-click and fix formatting issues easily.
|
8
4
|
|
9
5
|
## Examples
|
10
6
|
|
11
|
-
The following examples
|
7
|
+
The following examples show code snippets that either fail or pass this check:
|
12
8
|
|
13
|
-
### ✗
|
9
|
+
### ✗ Incorrect Code Example (Avoid using this):
|
14
10
|
|
15
11
|
```liquid
|
16
12
|
{% parse_json my_json %}
|
@@ -25,7 +21,7 @@ The following examples contain code snippets that either fail or pass this check
|
|
25
21
|
{% endparse_json %}
|
26
22
|
```
|
27
23
|
|
28
|
-
### ✓
|
24
|
+
### ✓ Correct Code Example (Use this instead):
|
29
25
|
|
30
26
|
```liquid
|
31
27
|
{% parse_json my_json %}
|
@@ -44,9 +40,9 @@ The following examples contain code snippets that either fail or pass this check
|
|
44
40
|
{% endparse_json %}
|
45
41
|
```
|
46
42
|
|
47
|
-
## Options
|
43
|
+
## Configuration Options
|
48
44
|
|
49
|
-
The
|
45
|
+
The default configuration for this check:
|
50
46
|
|
51
47
|
```yaml
|
52
48
|
ParseJsonFormat:
|
@@ -60,12 +56,17 @@ ParseJsonFormat:
|
|
60
56
|
| --- | --- |
|
61
57
|
| enabled | Whether the check is enabled. |
|
62
58
|
| severity | The [severity](https://documentation.platformos.com/developer-guide/platformos-check/platformos-check#check-severity) of the check. |
|
63
|
-
| start_level | The indentation level.
|
59
|
+
| start_level | The base indentation level. Set this to 1 if you prefer an indented `parse_json`. |
|
64
60
|
| indent | The character(s) used for indentation levels. |
|
65
61
|
|
66
|
-
## Disabling this check
|
67
62
|
|
68
|
-
This
|
63
|
+
## Disabling This Check
|
64
|
+
|
65
|
+
This check is safe to disable if you do not care about the visual formatting of your `parse_json` tags.
|
66
|
+
|
67
|
+
## Version
|
68
|
+
|
69
|
+
This check has been introduced in platformOS Check 1.9.0.
|
69
70
|
|
70
71
|
## Resources
|
71
72
|
|
@@ -1,16 +1,21 @@
|
|
1
|
-
# Discourage
|
1
|
+
# Discourage Use of Parser-Blocking JavaScript (`ParserBlockingJavaScript`)
|
2
2
|
|
3
|
-
|
3
|
+
This check aims to eliminate parser-blocking JavaScript in your app.
|
4
4
|
|
5
|
-
|
5
|
+
Using the `defer` or `async` attributes is extremely important on script tags. When neither of those attributes are used, a script tag will block the construction and rendering of the DOM until the script is _loaded_, _parsed_ and _executed_. This can create network congestion, interfere with resource priorities, and significantly delay page rendering.
|
6
6
|
|
7
|
-
|
7
|
+
JavaScript in platformOS apps should always be used to progressively _enhance_ the user experience. Therefore, parser-blocking script tags should never be used.
|
8
8
|
|
9
|
-
|
9
|
+
As a general rule:
|
10
|
+
- Use `defer` if the order of execution matters.
|
11
|
+
- Use `async` if the order of execution does not matter.
|
12
|
+
- When in doubt, using either will provide 80/20 of the benefits.
|
10
13
|
|
11
|
-
|
14
|
+
## Examples
|
12
15
|
|
13
|
-
|
16
|
+
The following examples show code snippets that either fail or pass this check:
|
17
|
+
|
18
|
+
### ✗ Incorrect Code Example (Avoid using this):
|
14
19
|
|
15
20
|
```liquid
|
16
21
|
<!-- The script_tag filter outputs a parser-blocking script -->
|
@@ -27,7 +32,7 @@ This check is aimed at eliminating parser-blocking JavaScript on app.
|
|
27
32
|
</script>
|
28
33
|
```
|
29
34
|
|
30
|
-
|
35
|
+
### ✓ Correct Code Example (Use this instead):
|
31
36
|
|
32
37
|
```liquid
|
33
38
|
<!-- Good. Using the asset_url filter + defer -->
|
@@ -67,24 +72,24 @@ This check is aimed at eliminating parser-blocking JavaScript on app.
|
|
67
72
|
<button id="thing">Click Me</button>
|
68
73
|
```
|
69
74
|
|
70
|
-
##
|
75
|
+
## Configuration Options
|
71
76
|
|
72
|
-
The default configuration for this check
|
77
|
+
The default configuration for this check:
|
73
78
|
|
74
79
|
```yaml
|
75
80
|
ParserBlockingJavaScript:
|
76
81
|
enabled: true
|
77
82
|
```
|
78
83
|
|
79
|
-
##
|
84
|
+
## Disabling This Check
|
80
85
|
|
81
|
-
This should only be
|
86
|
+
This check should only be disabled with the `platformos-check-disable` comment if there is no better way to achieve the desired outcome than using a parser-blocking script.
|
82
87
|
|
83
|
-
|
88
|
+
Disabling this check is generally not recommended.
|
84
89
|
|
85
90
|
## Version
|
86
91
|
|
87
|
-
This check has been introduced in
|
92
|
+
This check has been introduced in platformOS Check 0.0.1.
|
88
93
|
|
89
94
|
## Resources
|
90
95
|
|
@@ -1,12 +1,10 @@
|
|
1
|
-
# Prevent
|
1
|
+
# Prevent Missing Required Objects in Layouts (`RequiredLayoutThemeObject`)
|
2
2
|
|
3
|
-
|
3
|
+
This check ensures that the `{{ content_for_layout }}` object is present in layouts, preventing rendering issues due to missing objects.
|
4
4
|
|
5
|
-
|
5
|
+
## Configuration Options
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
The default configuration for this check is the following:
|
7
|
+
The default configuration for this check:
|
10
8
|
|
11
9
|
```yaml
|
12
10
|
RequiredLayoutObject:
|
@@ -15,7 +13,7 @@ RequiredLayoutObject:
|
|
15
13
|
|
16
14
|
## Version
|
17
15
|
|
18
|
-
This check has been introduced in
|
16
|
+
This check has been introduced in platformOS Check 0.0.1.
|
19
17
|
|
20
18
|
## Resources
|
21
19
|
|
@@ -1,12 +1,12 @@
|
|
1
|
-
# Ensure
|
1
|
+
# Ensure Consistent Spacing Inside Liquid Tags and Variables (`SpaceInsideBraces`)
|
2
2
|
|
3
|
-
|
3
|
+
This check warns against and aims to eliminate inconsistent spacing inside Liquid tags and variables, ensuring cleaner and more readable Liquid code.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Examples
|
6
6
|
|
7
|
-
|
7
|
+
The following examples show code snippets that either fail or pass this check:
|
8
8
|
|
9
|
-
|
9
|
+
### ✗ Incorrect Code Example (Avoid using this):
|
10
10
|
|
11
11
|
```liquid
|
12
12
|
<!-- Around braces -->
|
@@ -27,7 +27,7 @@ This check is aimed at eliminating ugly Liquid:
|
|
27
27
|
{%- if product.featured_media.width >=165 -%}
|
28
28
|
```
|
29
29
|
|
30
|
-
|
30
|
+
### ✓ Correct Code Example (Use this instead):
|
31
31
|
|
32
32
|
```liquid
|
33
33
|
{% assign x = 1 %}
|
@@ -47,9 +47,9 @@ This check is aimed at eliminating ugly Liquid:
|
|
47
47
|
{%- if product.featured_media.width >= 165 -%}
|
48
48
|
```
|
49
49
|
|
50
|
-
##
|
50
|
+
## Configuration Options
|
51
51
|
|
52
|
-
The default configuration for this check
|
52
|
+
The default configuration for this check:
|
53
53
|
|
54
54
|
```yaml
|
55
55
|
SpaceInsideBraces:
|
@@ -58,7 +58,7 @@ SpaceInsideBraces:
|
|
58
58
|
|
59
59
|
## Auto-correction
|
60
60
|
|
61
|
-
This check can automatically
|
61
|
+
This check can automatically correct spacing around `{{ ... }}`. For example:
|
62
62
|
|
63
63
|
```liquid
|
64
64
|
{{ x}}
|
@@ -72,13 +72,13 @@ Can all be auto-corrected with the `--auto-correct` option to:
|
|
72
72
|
{{ x }}
|
73
73
|
```
|
74
74
|
|
75
|
-
##
|
75
|
+
## Disabling This Check
|
76
76
|
|
77
|
-
|
77
|
+
This check is safe to disable if you do not prioritize the visual consistency of your code.
|
78
78
|
|
79
79
|
## Version
|
80
80
|
|
81
|
-
This check has been introduced in
|
81
|
+
This check has been introduced in platformOS Check 0.0.1.
|
82
82
|
|
83
83
|
## Resources
|
84
84
|
|
data/docs/checks/syntax_error.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# Prevent Syntax Errors (`SyntaxError`)
|
2
2
|
|
3
|
-
This check
|
3
|
+
This check helps inform the user of Liquid syntax errors early, aiming to eliminate syntax errors in Liquid code.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Examples
|
6
6
|
|
7
|
-
|
7
|
+
The following examples show code snippets that either fail or pass this check:
|
8
8
|
|
9
|
-
|
9
|
+
### ✗ Incorrect Code Example (Avoid using this):
|
10
10
|
|
11
11
|
```liquid
|
12
12
|
{% include 'muffin'
|
@@ -15,7 +15,7 @@ This check is aimed at eliminating syntax errors.
|
|
15
15
|
{% if collection | size > 0 %}
|
16
16
|
```
|
17
17
|
|
18
|
-
|
18
|
+
### ✓ Correct Code Example (Use this instead):
|
19
19
|
|
20
20
|
```liquid
|
21
21
|
{% include 'muffin' %}
|
@@ -23,22 +23,22 @@ This check is aimed at eliminating syntax errors.
|
|
23
23
|
{% if collection.size > 0 %}
|
24
24
|
```
|
25
25
|
|
26
|
-
##
|
26
|
+
## Configuration Options
|
27
27
|
|
28
|
-
The default configuration for this check
|
28
|
+
The default configuration for this check:
|
29
29
|
|
30
30
|
```yaml
|
31
31
|
SyntaxError:
|
32
32
|
enabled: true
|
33
33
|
```
|
34
34
|
|
35
|
-
##
|
35
|
+
## Disabling This Check
|
36
36
|
|
37
|
-
|
37
|
+
Disabling this check is not recommended.
|
38
38
|
|
39
39
|
## Version
|
40
40
|
|
41
|
-
This check has been introduced in
|
41
|
+
This check has been introduced in platformOS Check 0.0.1.
|
42
42
|
|
43
43
|
## Resources
|
44
44
|
|
@@ -1,22 +1,22 @@
|
|
1
|
-
# Discourage the
|
1
|
+
# Discourage the Use of Large Template Files (`TemplateLength`)
|
2
2
|
|
3
|
-
This check
|
3
|
+
This check aims to eliminate the use of large template files by encouraging a modular approach - using partials and functions to componentize your app instead.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Examples
|
6
6
|
|
7
|
-
|
7
|
+
The following examples show code snippets that either fail or pass this check:
|
8
8
|
|
9
|
-
|
9
|
+
### ✗ Incorrect Example (Avoid using this):
|
10
10
|
|
11
11
|
- Files that have more lines than the threshold
|
12
12
|
|
13
|
-
|
13
|
+
### ✓ Correct Example (Use this instead):
|
14
14
|
|
15
15
|
- Files that have less lines than the threshold
|
16
16
|
|
17
|
-
##
|
17
|
+
## Configuration Options
|
18
18
|
|
19
|
-
The default configuration for this check
|
19
|
+
The default configuration for this check:
|
20
20
|
|
21
21
|
```yaml
|
22
22
|
TemplateLength:
|
@@ -26,15 +26,15 @@ TemplateLength:
|
|
26
26
|
|
27
27
|
### `max_length`
|
28
28
|
|
29
|
-
The `max_length` (Default: `
|
29
|
+
The `max_length` (Default: `600`) option determines the maximum number of lines allowed inside a liquid file.
|
30
30
|
|
31
|
-
##
|
31
|
+
## Disabling This Check
|
32
32
|
|
33
|
-
|
33
|
+
This check is safe to disable if you do not prioritize template length management.
|
34
34
|
|
35
35
|
## Version
|
36
36
|
|
37
|
-
This check has been introduced in
|
37
|
+
This check has been introduced in platformOS Check 0.0.1.
|
38
38
|
|
39
39
|
## Resources
|
40
40
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# Translation Files Match (`TranslationFilesMatch`)
|
2
2
|
|
3
|
-
|
3
|
+
This check ensures that translation files for different languages have the same keys, aiming to avoid inconsistencies, making it easier to spot errors and maintain the code.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Examples
|
6
6
|
|
7
|
-
|
7
|
+
The following examples show code snippets that either fail or pass this check:
|
8
8
|
|
9
|
-
|
9
|
+
### ✗ Incorrect Code Example (Avoid using this):
|
10
10
|
|
11
11
|
```yaml
|
12
12
|
# app/translations/en/item.yml
|
@@ -25,7 +25,7 @@ This check is aimed at avoiding inconsistences between translation files to avoi
|
|
25
25
|
|
26
26
|
Missing "title" in de/item.yml
|
27
27
|
|
28
|
-
|
28
|
+
### ✓ Correct Code Example (Use this instead):
|
29
29
|
|
30
30
|
```yaml
|
31
31
|
# app/translations/en/item.yml
|
@@ -43,23 +43,22 @@ Missing "title" in de/item.yml
|
|
43
43
|
description: "Beschreibung"
|
44
44
|
```
|
45
45
|
|
46
|
-
##
|
46
|
+
## Configuration Options
|
47
47
|
|
48
|
-
The default configuration for this check
|
48
|
+
The default configuration for this check:
|
49
49
|
|
50
50
|
```yaml
|
51
51
|
TranslationFilesMatch:
|
52
52
|
enabled: true
|
53
53
|
```
|
54
54
|
|
55
|
-
##
|
55
|
+
## Disabling This Check
|
56
56
|
|
57
|
-
There should be no
|
58
|
-
use proper configuration option in [app/config.yml](https://documentation.platformos.com/developer-guide/platformos-workflow/codebase/config)
|
57
|
+
There should be no need to disable this rule. For keys set via the UI and not intended to be part of the codebase, use the appropriate configuration option in [app/config.yml](https://documentation.platformos.com/developer-guide/platformos-workflow/codebase/config).
|
59
58
|
|
60
59
|
## Version
|
61
60
|
|
62
|
-
This check has been introduced in
|
61
|
+
This check has been introduced in platformOS Check 0.4.10.
|
63
62
|
|
64
63
|
## Resources
|
65
64
|
|