rubocop-bridgetown 0.3.1 → 0.4.0

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: 4ec87759e555a6191f4de65e7f3cf725e3df2f08dd81fb5096bf5af9297b438b
4
- data.tar.gz: 7cc362169a91281eb49422e8922cc95eca7328993a6ec35e598354ca8fd5fe9f
3
+ metadata.gz: 435813faf9f0e997e92553305d9d0a2d64626b25a5da3ae1d0e295a941bf692e
4
+ data.tar.gz: e89e35f60eae21b0ffa492f2b029b3180166b9c7af866829f632a7ad9ea1d981
5
5
  SHA512:
6
- metadata.gz: bd67d509bebb98f3cd7477473f559a306d6a67e137caf7564e8bf80a42e62344144771befec7a562905a697703c64e9bc290b22cac95a0cc0c8c13f882098cc0
7
- data.tar.gz: 9101b7e6c9cd77cc25d31210e6c0a27e84e372f5f952a9e09e2eae407b3605cccad70b904d0825cd86d6a23b34ac797e520a9cc2c19c4fe8ef5b5a0f553119d7
6
+ metadata.gz: ca0f8ac3b7511247f21b107b884577150419c3d510d051e130ece2574f7c375d67c6c20cd6648a568e406918f0f995a29b100972a1205d0fa7caa83a75fc9beb
7
+ data.tar.gz: c9c08cf182324b73901ff14c3f8d5ae16a435e4f8b69ebf5433530b8ec2a0782e56b3b5e271154b3307a2409832dff15669cf32b16433039b894cac45c996e2a
data/.rubocop.yml CHANGED
@@ -67,6 +67,8 @@ Style/Documentation:
67
67
  Enabled: false
68
68
  Style/DoubleNegation:
69
69
  Enabled: false
70
+ Style/EndlessMethod:
71
+ EnforcedStyle: allow_always
70
72
  Style/Lambda:
71
73
  EnforcedStyle: literal
72
74
  Style/LambdaCall:
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  A RuboCop extension to enforce a common code style in the Bridgetown ecosystem and beyond.
4
4
 
5
5
  ![Gem Version](https://img.shields.io/gem/v/rubocop-bridgetown.svg?label=Latest%20Release)
6
- ![RuboCop Support](https://img.shields.io/badge/Rubocop%20Support-1.22.0-green.svg)
6
+ ![RuboCop Support](https://img.shields.io/badge/Rubocop%20Support-1.23.0-green.svg)
7
7
 
8
8
 
9
9
  ## Installation
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Bridgetown
6
+ class HTMLEscapedHeredoc < Cop
7
+ include Heredoc
8
+
9
+ MSG = "Insecure heredoc detected. Use `html`, `html_map`, `text`, or `render` inside interpolation."
10
+
11
+ def on_heredoc(node)
12
+ return unless node.source.match?(%r!(HTML|MARKDOWN)$!) &&
13
+ heredoc_body(node).match?(%r%[^\\]#\{(?!\s*?(html|html_map|text|render)[ \-])%)
14
+
15
+ add_offense(node, message: MSG)
16
+ end
17
+
18
+ private
19
+
20
+ def heredoc_body(node)
21
+ node.loc.heredoc_body.source
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-bridgetown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-13 00:00:00.000000000 Z
11
+ date: 2023-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -66,7 +66,8 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '12.0'
69
- description: A RuboCop extension to enforce common code style in Bridgetown plugins
69
+ description: A RuboCop extension to enforce common code style in Bridgetown projects
70
+ and beyond
70
71
  email:
71
72
  - maintainers@bridgetownrb.com
72
73
  executables: []
@@ -77,13 +78,14 @@ files:
77
78
  - LICENSE
78
79
  - README.md
79
80
  - lib/rubocop-bridgetown.rb
81
+ - lib/rubocop/cop/bridgetown/html_escaped_heredoc.rb
80
82
  - lib/rubocop/cop/bridgetown/no_p_allowed.rb
81
83
  - lib/rubocop/cop/bridgetown/no_puts_allowed.rb
82
84
  homepage: https://github.com/bridgetownrb/rubocop-bridgetown
83
85
  licenses:
84
86
  - MIT
85
87
  metadata: {}
86
- post_install_message:
88
+ post_install_message:
87
89
  rdoc_options: []
88
90
  require_paths:
89
91
  - lib
@@ -98,8 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
100
  - !ruby/object:Gem::Version
99
101
  version: '0'
100
102
  requirements: []
101
- rubygems_version: 3.1.4
102
- signing_key:
103
+ rubygems_version: 3.3.3
104
+ signing_key:
103
105
  specification_version: 4
104
- summary: Code style check for Bridgetown plugins
106
+ summary: Code style check for Bridgetown projects
105
107
  test_files: []