gl_lint 0.7.0 → 0.9.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: '08cd9cba3726478b40c81f562807a19f326f4775a5c596c4705659711472329b'
4
- data.tar.gz: ed0b3df3071a7108ff5e53434f52354b1bf8a0a3c4cf8b613aa6e379b8edafaf
3
+ metadata.gz: 99f72c30fc5ab80f422a5a6911919739d695e8cd36a3067095b561bfc255dad5
4
+ data.tar.gz: 84144cee8bde61a10dc5a4250a1a8daafa71955f838e1fe21370ab40167aad69
5
5
  SHA512:
6
- metadata.gz: 8ac25dc4ba3b125fef0fbf080bd219f5dde88da9ad60986c69f3d8d37e33c49e1757e21829a1103dae8f8d2e3e75b7faaa54bcf9b12510ce43d269498467b351
7
- data.tar.gz: 445bdf50de42c415801beed42bd61556f300dd3e0620b1b067200016de4de4d151cec52e8bbd9237f77f8052c9389fc48ae0a61705d1e26588d2b3878a53cd96
6
+ metadata.gz: 2df622db916252bc2be9f2e1616dbdf1243b76433d2a1959f880ab2b108d3afe19c224403a4fb7f24722db01a6cb9cb2d5d68f08af9d3fa00e00c169c186b95b
7
+ data.tar.gz: 3b0c24fcb6a5c84e863de3d78416585bb66496d5e5891d07a35cdca8dd9840b02732fa7fcac17ba3464e062799d8f57169751507126c7f8e4131f47a8e2c3aa6
data/gl_lint.gemspec CHANGED
@@ -5,8 +5,6 @@ lib = File.expand_path('lib', __dir__)
5
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
  require 'gl_lint/version'
7
7
 
8
- NON_GEM_FILES = ['Gemfile', 'Gemfile.lock', 'Guardfile', 'bin/lint'].freeze
9
-
10
8
  Gem::Specification.new do |spec|
11
9
  spec.name = 'gl_lint'
12
10
  spec.version = GLLint::VERSION
@@ -20,8 +18,10 @@ Gem::Specification.new do |spec|
20
18
 
21
19
  spec.extra_rdoc_files = ['README.md']
22
20
 
23
- spec.files = `git ls-files`
24
- .split($INPUT_RECORD_SEPARATOR).grep_v(/^(spec|\.)/) - NON_GEM_FILES
21
+ spec.files =
22
+ `git ls-files`.split($INPUT_RECORD_SEPARATOR).grep_v(/^(spec|\.)/) -
23
+ %w[Gemfile Gemfile.lock Guardfile bin/lint]
24
+
25
25
  spec.require_paths = ['lib']
26
26
 
27
27
  spec.add_dependency 'optparse'
data/lib/gl_lint/cli.rb CHANGED
@@ -2,7 +2,7 @@ require 'optparse'
2
2
 
3
3
  module GLLint
4
4
  class CLI
5
- LINTERS = %w[rubocop eslint].freeze
5
+ LINTERS = %w[rubocop eslint herb].freeze
6
6
  DEFAULT_TARGET = '--changed'.freeze
7
7
 
8
8
  TARGET_FILE_OPTS = [
@@ -34,12 +34,24 @@ module GLLint
34
34
  end
35
35
 
36
36
  parser.on('--eslint', 'Lints only with eslint') do
37
- raise "This project doesn't support rubocop" unless LINTERS.include?('eslint')
38
- raise "You can't pass both --rubocop and --eslint" if options[:linters] == ['rubocop']
37
+ raise "This project doesn't support eslint" unless LINTERS.include?('eslint')
38
+ if options[:linters] == ['rubocop'] || options[:linters] == ['herb']
39
+ raise "You can't pass both --rubocop and --eslint"
40
+ end
39
41
 
40
42
  options[:linters] = ['eslint']
41
43
  end
42
44
 
45
+ parser.on('--herb', 'Lints only with herb') do
46
+ raise "This project doesn't support herb" unless LINTERS.include?('herb')
47
+
48
+ if options[:linters] == ['rubocop'] || options[:linters] == ['eslint']
49
+ raise "You can't pass --rubocop or --eslint and --herb"
50
+ end
51
+
52
+ options[:linters] = ['herb']
53
+ end
54
+
43
55
  parser.on('--no-fix', 'Does not auto-fix') do
44
56
  options[:no_fix] = true
45
57
  end
@@ -1,6 +1,6 @@
1
1
  module GLLint
2
2
  class FileSelector
3
- NON_RB_RUBY_FILES = %w[Gemfile Rakefile config.ru
3
+ NON_RB_RUBY_FILES = %w[Gemfile Rakefile config.ru .haml
4
4
  bin/bundle bin/lint bin/rubocop bin/setup bin/update].freeze
5
5
 
6
6
  class << self
@@ -8,15 +8,17 @@ module GLLint
8
8
  selected_files = filenames || filenames_from_target_files(target_files)
9
9
 
10
10
  if selected_files
11
- rubocop_files = selected_files.grep(/\.(rb|rake|gemspec)\z/)
12
- rubocop_files += selected_files.select { |f| f.end_with?(*NON_RB_RUBY_FILES) }
11
+ rubocop = selected_files.grep(/\.(rb|rake|gemspec)\z/)
12
+ rubocop += selected_files.select { |f| f.end_with?(*NON_RB_RUBY_FILES) }
13
13
  # Make certain that schemas are ignored
14
- rubocop_files.reject! { |f| f.match?(%r{db/.*schema.rb}) }
14
+ rubocop.reject! { |f| f.match?(%r{db/.*schema.rb}) }
15
15
 
16
- eslint_files = selected_files.grep(/\.(js|jsx|css)\z/)
16
+ eslint = selected_files.grep(/\.(js|jsx|css)\z/)
17
+
18
+ herb = selected_files.grep(/\.(erb|html|rhtml)\z/)
17
19
  end
18
20
 
19
- { rubocop: rubocop_files, eslint: eslint_files }
21
+ { rubocop:, eslint:, herb: }
20
22
  end
21
23
 
22
24
  private
@@ -7,8 +7,8 @@ module GLLint
7
7
  files = GLLint::FileSelector.files(filenames:, target_files:)
8
8
 
9
9
  lint_ruby_files(linters, target_files, files[:rubocop], lint_strategy)
10
-
11
10
  lint_eslint_files(linters, target_files, files[:eslint], lint_strategy)
11
+ lint_herb_files(linters, target_files, files[:herb], lint_strategy)
12
12
 
13
13
  puts '' # Add some space after printing linting out
14
14
 
@@ -63,11 +63,22 @@ module GLLint
63
63
  return unless linters.include?('eslint')
64
64
 
65
65
  result = print_files(target_files, files, strategy, 'eslint')
66
- return if result == :skip_lint
66
+ return if result == :no_lint
67
67
 
68
68
  # Need to manually call eslint, the package.json script specifies the folders to lint
69
69
  eslint_command = strategy == :no_fix ? 'eslint' : 'eslint --fix'
70
70
  run_linter("yarn run #{eslint_command} #{files&.join(' ')}")
71
71
  end
72
+
73
+ def lint_herb_files(linters, target_files, files, strategy)
74
+ return unless linters.include?('herb')
75
+
76
+ result = print_files(target_files, files, strategy, 'herb')
77
+ return if result == :no_lint
78
+
79
+ # Need to manually call herb, the .herb.yml specifies the folders to lint,
80
+ herb_command = strategy == :no_fix ? 'herb-format --check' : 'herb-format'
81
+ run_linter("yarn run #{herb_command} #{files&.join(' ')}")
82
+ end
72
83
  end
73
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GLLint
4
- VERSION = '0.7.0'
4
+ VERSION = '0.9.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gl_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Give Lively
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-21 00:00:00.000000000 Z
11
+ date: 2026-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: optparse
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.4.19
78
+ rubygems_version: 3.5.22
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Give Lively linter tool