rubocop-bridgetown 0.3.1 → 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/.rubocop.yml +2 -0
- data/README.md +1 -1
- data/lib/rubocop/cop/bridgetown/html_escaped_heredoc.rb +26 -0
- metadata +10 -8
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/.rubocop.yml
CHANGED
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
|
-
autorequire:
|
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
|
@@ -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
|
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.
|
102
|
-
signing_key:
|
103
|
+
rubygems_version: 3.3.3
|
104
|
+
signing_key:
|
103
105
|
specification_version: 4
|
104
|
-
summary: Code style check for Bridgetown
|
106
|
+
summary: Code style check for Bridgetown projects
|
105
107
|
test_files: []
|