niftany 0.2.0 → 0.3.0

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: 36d4bc3b039fc06e75460a2b7a9bd74a129c304ed3a07e50d204c16da64f1b03
4
- data.tar.gz: e873f0b41fd689e454f0853549a821761fdddcf657325a1d5128c0f468549b38
3
+ metadata.gz: 480a861df2f423d46274cfc36d1d43f2e53c27cdfe0a2137bd94b9e689f97ce2
4
+ data.tar.gz: 88fe833628ae24a2618fcf57ed8ecc71e169aa4602177f6beb1c36284f0c21ab
5
5
  SHA512:
6
- metadata.gz: b1a8b4d479bbbbdf3f211cc900bb52e8bd058bc464db17ef43c68b66d3dfe4f504dd5e1632662a99daa44ad3241c8d2123b156f0ff4f794d7eb69c9e9973c957
7
- data.tar.gz: e5662b2c0bee1728d857a1190d5f435e79c198aad1352fd6d6ba8c79307464755bda9b041fe038d0232adb2a408e89d5c859f47f6b6f5f8d49324212078b1915
6
+ metadata.gz: 1741e91ee84d4ca1e72066fab2d0d00cb869a73696a03f639a5774d3a6bde56a5a1e87b37f888238c4baa656ea425402d506fa5cfe9b5de7cae8512e2294dcb3
7
+ data.tar.gz: 7c01795d03f0aa6c1061faa348270171ffc4f2e724b12f02b89362812cc953569a4aef95e0d8de89c22437cad6911d54d7ac58046bd24c7fa8cb1f0d40a55437
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ERBLint
4
+ module Linters
5
+ # Warns when a tag is not self-closed properly.
6
+ class SelfClosingTagCustom < Linter
7
+ include LinterRegistry
8
+
9
+ SELF_CLOSING_TAGS = %w(
10
+ area input param track img
11
+ )
12
+
13
+ def run(processed_source)
14
+ processed_source.ast.descendants(:tag).each do |tag_node|
15
+ tag = BetterHtml::Tree::Tag.from_node(tag_node)
16
+ next unless SELF_CLOSING_TAGS.include?(tag.name)
17
+
18
+ if tag.closing?
19
+ start_solidus = tag_node.children.first
20
+ add_offense(
21
+ start_solidus.loc,
22
+ "Tag `#{tag.name}` is self-closing, it must not start with `</`.",
23
+ ''
24
+ )
25
+ end
26
+
27
+ next if tag.self_closing?
28
+ add_offense(
29
+ tag_node.loc.end.offset(-1),
30
+ "Tag `#{tag.name}` is self-closing, it must end with `/>`.",
31
+ '/'
32
+ )
33
+ end
34
+ end
35
+
36
+ def autocorrect(_processed_source, offense)
37
+ lambda do |corrector|
38
+ corrector.replace(offense.source_range, offense.context)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Penn State University Libraries
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'niftany'
data/niftany.gemspec CHANGED
@@ -1,7 +1,9 @@
1
1
 
2
+ # frozen_string_literal: true
3
+
2
4
  Gem::Specification.new do |spec|
3
5
  spec.name = 'niftany'
4
- spec.version = '0.2.0'
6
+ spec.version = '0.3.0'
5
7
  spec.authors = ['Adam Wead']
6
8
  spec.email = ['amsterdamos@gmail.com']
7
9
  spec.summary = 'Manages configurations and versions of linters used in projects at '\
@@ -12,6 +14,7 @@ Gem::Specification.new do |spec|
12
14
  spec.bindir = 'exe'
13
15
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
14
16
 
17
+ spec.add_dependency 'colorize', '~> 0.8.1'
15
18
  spec.add_dependency 'erb_lint', '~> 0.0.22'
16
19
  spec.add_dependency 'rubocop', '~> 0.51', '<= 0.52.1'
17
20
  spec.add_dependency 'rubocop-rspec', '~> 1.22', '<= 1.22.2'
data/niftany_erblint.yml CHANGED
@@ -37,6 +37,8 @@ linters:
37
37
  Rails/OutputSafety:
38
38
  Enabled: false
39
39
  SelfClosingTag:
40
+ enabled: false
41
+ SelfClosingTagCustom:
40
42
  enabled: true
41
43
  SpaceAroundErbTag:
42
44
  enabled: true
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: niftany
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Wead
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-30 00:00:00.000000000 Z
11
+ date: 2018-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colorize
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: erb_lint
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -115,11 +129,13 @@ executables:
115
129
  extensions: []
116
130
  extra_rdoc_files: []
117
131
  files:
132
+ - ".erb-linters/self_closing_custom.rb"
118
133
  - ".gitignore"
119
134
  - ".rubocop.yml"
120
135
  - ".rubocop_todo.yml"
121
136
  - ".travis.yml"
122
137
  - Gemfile
138
+ - LICENSE.md
123
139
  - README.md
124
140
  - Rakefile
125
141
  - bin/console