rubocop-bridgetown 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/rubocop/cop/bridgetown/html_escaped_heredoc.rb +26 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 435813faf9f0e997e92553305d9d0a2d64626b25a5da3ae1d0e295a941bf692e
|
4
|
+
data.tar.gz: e89e35f60eae21b0ffa492f2b029b3180166b9c7af866829f632a7ad9ea1d981
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca0f8ac3b7511247f21b107b884577150419c3d510d051e130ece2574f7c375d67c6c20cd6648a568e406918f0f995a29b100972a1205d0fa7caa83a75fc9beb
|
7
|
+
data.tar.gz: c9c08cf182324b73901ff14c3f8d5ae16a435e4f8b69ebf5433530b8ec2a0782e56b3b5e271154b3307a2409832dff15669cf32b16433039b894cac45c996e2a
|
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.
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- LICENSE
|
79
79
|
- README.md
|
80
80
|
- lib/rubocop-bridgetown.rb
|
81
|
+
- lib/rubocop/cop/bridgetown/html_escaped_heredoc.rb
|
81
82
|
- lib/rubocop/cop/bridgetown/no_p_allowed.rb
|
82
83
|
- lib/rubocop/cop/bridgetown/no_puts_allowed.rb
|
83
84
|
homepage: https://github.com/bridgetownrb/rubocop-bridgetown
|
@@ -99,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
100
|
- !ruby/object:Gem::Version
|
100
101
|
version: '0'
|
101
102
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.3.3
|
103
104
|
signing_key:
|
104
105
|
specification_version: 4
|
105
106
|
summary: Code style check for Bridgetown projects
|