vinter 0.6.1 → 0.6.2

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: 18b99e927ea645baaa6bf8290f53625a800c64a36e7bcb681d8096f7591ab862
4
- data.tar.gz: 35660a038fcc98c284731d75fe3644d41ff5a9212dd1ca7930d21d72b9f02764
3
+ metadata.gz: e47fb1e67cb9cf9a42ef421129fc7002bcc1471c39e4e62ff3ff78a480498fe6
4
+ data.tar.gz: d6b42a562879298291c5e613ef76a6af680f9aaf794152c4ced90aebe37f51a4
5
5
  SHA512:
6
- metadata.gz: f9ed5e432fcdc6e0a88545e15da0996dda4c31176c88fdcbb46f2ea4228bc4c431fe1e569b3e7420f370ab8147ac290738ac27dd21f1f7bed0a0d2093da5b933
7
- data.tar.gz: be685a411f5592425d122ea8a3080208c1cad58566dc88b7e5850a0e017ae9beebfff1c1a019955a47eb7e54a732ba94e4f2966d52e536404ce35ad1096465f9
6
+ metadata.gz: 62cb9236451e5a58a36115d307b5a98bbd8e0759cb0212b97a53908168b74d4ee04a375798f6b34e3e79625aa1bf22be7cfb3b4c66b9b10fe41cc9bf969d0cea
7
+ data.tar.gz: ed8cf7eaccb6e1fc46080b41f66502c375cca18762ea8c38369f71ede1a850c2b843cc9afa1ff32575ec056c2fa38397adee0a6c8f473727fe1a3ec266221e48
data/lib/vinter/cli.rb CHANGED
@@ -6,21 +6,45 @@ module Vinter
6
6
 
7
7
  def run(args)
8
8
  if args.empty?
9
- puts "Usage: vinter [file.vim|directory]"
9
+ puts "Usage: vinter [file.vim|directory] [--exclude=dir1,dir2]"
10
10
  return 1
11
11
  end
12
12
 
13
- target_path = args[0]
13
+ # Parse args: first non-option argument is the target path.
14
+ exclude_value = nil
15
+ target_path = nil
16
+
17
+ args.each_with_index do |a, i|
18
+ if a.start_with?("--exclude=")
19
+ exclude_value = a.split("=", 2)[1]
20
+ elsif a == "--exclude"
21
+ exclude_value = args[i + 1]
22
+ elsif !a.start_with?('-') && target_path.nil?
23
+ target_path = a
24
+ end
25
+ end
26
+
27
+ if target_path.nil?
28
+ puts "Usage: vinter [file.vim|directory] [--exclude=dir1,dir2]"
29
+ return 1
30
+ end
14
31
 
15
32
  unless File.exist?(target_path)
16
33
  puts "Error: File or directory not found: #{target_path}"
17
34
  return 1
18
35
  end
19
36
 
37
+ excludes = Array(exclude_value).flat_map { |v| v.to_s.split(',') }.map(&:strip).reject(&:empty?)
38
+
20
39
  vim_files = if File.directory?(target_path)
21
- find_vim_files(target_path)
40
+ find_vim_files(target_path, excludes)
22
41
  else
23
- [target_path]
42
+ # Check if single file is inside an excluded directory
43
+ if excluded_file?(target_path, excludes, File.dirname(target_path))
44
+ []
45
+ else
46
+ [target_path]
47
+ end
24
48
  end
25
49
 
26
50
  if vim_files.empty?
@@ -68,8 +92,32 @@ module Vinter
68
92
 
69
93
  private
70
94
 
71
- def find_vim_files(directory)
72
- Dir.glob(File.join(directory, "**", "*.vim")).sort
95
+ def find_vim_files(directory, excludes = [])
96
+ files = Dir.glob(File.join(directory, "**", "*.vim")).sort
97
+
98
+ return files if excludes.empty?
99
+
100
+ # Normalize exclude directories to absolute paths (relative to the target directory)
101
+ normalized = excludes.map { |e| File.expand_path(e, directory) }
102
+
103
+ files.reject do |f|
104
+ normalized.any? do |ex|
105
+ ex_with_slash = ex.end_with?(File::SEPARATOR) ? ex : ex + File::SEPARATOR
106
+ f.start_with?(ex_with_slash) || File.expand_path(f).start_with?(ex_with_slash)
107
+ end
108
+ end
109
+ end
110
+
111
+ def excluded_file?(file_path, excludes, base_dir)
112
+ return false if excludes.empty?
113
+
114
+ normalized = excludes.map { |e| File.expand_path(e, base_dir) }
115
+ file_abs = File.expand_path(file_path)
116
+
117
+ normalized.any? do |ex|
118
+ ex_with_slash = ex.end_with?(File::SEPARATOR) ? ex : ex + File::SEPARATOR
119
+ file_abs.start_with?(ex_with_slash)
120
+ end
73
121
  end
74
122
  end
75
123
  end
data/lib/vinter/parser.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'pry'
1
2
  module Vinter
2
3
  class Parser
3
4
  def initialize(tokens, source_text = nil)
data/lib/vinter.rb CHANGED
@@ -5,5 +5,5 @@ require "vinter/cli"
5
5
  require "vinter/ast_printer"
6
6
 
7
7
  module Vinter
8
- VERSION = "0.6.1"
8
+ VERSION = "0.6.2"
9
9
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vinter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Bradbury
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-11-30 00:00:00.000000000 Z
11
12
  dependencies: []
12
- description: A linter for the Vim9 script language, helping to identify issues and
13
- enforce best practices
13
+ description: A linter for vim9script
14
14
  email: dan.luckydaisy@gmail.com
15
15
  executables:
16
16
  - vinter
@@ -30,6 +30,7 @@ homepage: https://github.com/DanBradbury/vinter
30
30
  licenses:
31
31
  - MIT
32
32
  metadata: {}
33
+ post_install_message:
33
34
  rdoc_options: []
34
35
  require_paths:
35
36
  - lib
@@ -44,7 +45,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
45
  - !ruby/object:Gem::Version
45
46
  version: '0'
46
47
  requirements: []
47
- rubygems_version: 3.6.9
48
+ rubygems_version: 3.5.11
49
+ signing_key:
48
50
  specification_version: 4
49
- summary: A linter for leagacy + Vim9 script
51
+ summary: A vim9script linter
50
52
  test_files: []