platformos-check 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e25de2efbace27cbcb87f0166520a416c0a275dccd641524a3f3ea1b95190779
|
4
|
+
data.tar.gz: d4bc78729da09cb589caa3472e01c4735161d454b697560a894877073d21398e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dd2688e9b917dc3af698bcbf135bafc016bbfba8d24c46bd62528315d594322cf186913cbd6319a8d9275f8357a5d2d8067b542bd5fb90828532556464e4237
|
7
|
+
data.tar.gz: b1308c97e7721df699c423e9c1e111fee82e0bd31e79c8b55a1300baf5547fe115c35a9435ed16e5e2c68c825b230a6b710aba225d32f62a1ea3bee47a2204bd
|
data/CHANGELOG.md
CHANGED
data/config/default.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
|
2
|
-
{"revision":"
|
2
|
+
{"revision":"131bcc176b04bbd3cd19a57ac57395a74b949760"}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Form action (`FormAction`)
|
2
|
+
|
3
|
+
Form action defines the endpoint to which browser will make a request after submitting it.
|
4
|
+
|
5
|
+
As a general rule you should use relative path like `action="/my/path"` instead of for example `action="my/path"` to avoid errors.
|
6
|
+
|
7
|
+
## Check Details
|
8
|
+
|
9
|
+
This check is aimed at ensuring you have not forgotten to start the path with /.
|
10
|
+
|
11
|
+
:-1: Examples of **incorrect** code for this check:
|
12
|
+
|
13
|
+
```liquid
|
14
|
+
<form action="dummy/create">
|
15
|
+
...
|
16
|
+
</form>
|
17
|
+
```
|
18
|
+
|
19
|
+
:+1: Examples of **correct** code for this check:
|
20
|
+
|
21
|
+
```liquid
|
22
|
+
<form action="/dummy/create">
|
23
|
+
...
|
24
|
+
</form>
|
25
|
+
```
|
26
|
+
|
27
|
+
```liquid
|
28
|
+
<form action="{{ var }}">
|
29
|
+
...
|
30
|
+
</form>
|
31
|
+
```
|
32
|
+
|
33
|
+
## Check Options
|
34
|
+
|
35
|
+
The default configuration for this check is the following:
|
36
|
+
|
37
|
+
```yaml
|
38
|
+
FormAction:
|
39
|
+
enabled: true
|
40
|
+
```
|
41
|
+
|
42
|
+
## When Not To Use It
|
43
|
+
|
44
|
+
There should be no cases where disabling this rule is needed.
|
45
|
+
|
46
|
+
## Version
|
47
|
+
|
48
|
+
This check has been introduced in PlatformOS Check 0.45.0.
|
49
|
+
|
50
|
+
## Resources
|
51
|
+
|
52
|
+
- [Rule Source][codesource]
|
53
|
+
- [Documentation Source][docsource]
|
54
|
+
|
55
|
+
[codesource]: /lib/platformos_check/checks/form_action.rb
|
56
|
+
[docsource]: /docs/checks/form_action.md
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PlatformosCheck
|
4
|
+
class FormAction < HtmlCheck
|
5
|
+
severity :error
|
6
|
+
categories :html
|
7
|
+
doc docs_url(__FILE__)
|
8
|
+
|
9
|
+
def on_form(node)
|
10
|
+
action = node.attributes["action"]&.strip
|
11
|
+
return if action.nil?
|
12
|
+
return if action.empty?
|
13
|
+
return if action.start_with?('/', '{{')
|
14
|
+
|
15
|
+
add_offense("Use action=\"/#{action}\" (start with /) to ensure the form can be submitted multiple times in case of validation errors", node:)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: platformos-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Bliszczyk
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-12-
|
13
|
+
date: 2023-12-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: graphql
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- docs/checks/TEMPLATE.md.erb
|
118
118
|
- docs/checks/convert_include_to_render.md
|
119
119
|
- docs/checks/deprecated_filter.md
|
120
|
+
- docs/checks/form_action.md
|
120
121
|
- docs/checks/html_parsing_error.md
|
121
122
|
- docs/checks/img_lazy_loading.md
|
122
123
|
- docs/checks/img_width_and_height.md
|
@@ -159,6 +160,7 @@ files:
|
|
159
160
|
- lib/platformos_check/checks/TEMPLATE.rb.erb
|
160
161
|
- lib/platformos_check/checks/convert_include_to_render.rb
|
161
162
|
- lib/platformos_check/checks/deprecated_filter.rb
|
163
|
+
- lib/platformos_check/checks/form_action.rb
|
162
164
|
- lib/platformos_check/checks/html_parsing_error.rb
|
163
165
|
- lib/platformos_check/checks/img_lazy_loading.rb
|
164
166
|
- lib/platformos_check/checks/img_width_and_height.rb
|