platformos-check 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2232ebaad35fcbe180ef2bf7430a1f1b14a8a292e9e83162cab6f4daa2627e77
4
- data.tar.gz: 664d5f186a9a9af5db288b287d05cacc1134b7533c63c11255e635481d7315e7
3
+ metadata.gz: e25de2efbace27cbcb87f0166520a416c0a275dccd641524a3f3ea1b95190779
4
+ data.tar.gz: d4bc78729da09cb589caa3472e01c4735161d454b697560a894877073d21398e
5
5
  SHA512:
6
- metadata.gz: 8dc44ad6b4b964108030b675ee46d883c75c4d3e8ef7262617dc2897eb7a53bf858d64b0e3ffb2ddc50a1f762bf9fbe6371c630d9a64c5358a5152e0a52e7901
7
- data.tar.gz: 6c86d9c6e458117f9f25c0563fbe33d7f3792f5b9129671f8e30fe539b0d02cd9faedd77491c091e5c608d1e296a0bb9bc86c236b10f2cc10aa7711ac22f2f1f
6
+ metadata.gz: 5dd2688e9b917dc3af698bcbf135bafc016bbfba8d24c46bd62528315d594322cf186913cbd6319a8d9275f8357a5d2d8067b542bd5fb90828532556464e4237
7
+ data.tar.gz: b1308c97e7721df699c423e9c1e111fee82e0bd31e79c8b55a1300baf5547fe115c35a9435ed16e5e2c68c825b230a6b710aba225d32f62a1ea3bee47a2204bd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ v0.4.5 / 2023-12-04
2
+ ==================
3
+
4
+ * Add FormAction check
5
+
1
6
  v0.4.4 / 2023-12-04
2
7
  ==================
3
8
 
data/config/default.yml CHANGED
@@ -87,6 +87,10 @@ ImgLazyLoading:
87
87
  enabled: true
88
88
  ignore: []
89
89
 
90
+ FormAction:
91
+ enabled: true
92
+ ignore: []
93
+
90
94
  HtmlParsingError:
91
95
  enabled: true
92
96
  ignore: []
@@ -1,2 +1,2 @@
1
1
 
2
- {"revision":"008ef526d0cf8a5c42eb2c05938d91543996edf8"}
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformosCheck
4
- VERSION = "0.4.4"
4
+ VERSION = "0.4.5"
5
5
  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
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-04 00:00:00.000000000 Z
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