vinter 0.2.0 → 0.4.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: 503bb79a2701783c22c7ef7f269bfc51dc93a72d68abc61286c4c0236aaa4d8f
4
- data.tar.gz: f9f58293732eb9179228ec8e4c04bd87f279fc2e7edf65dc9969d1fe6f680b66
3
+ metadata.gz: e6f99b1ca16b7bbca35229a549ceed21f3cdf9b8bc86a3fedff9b978b18717de
4
+ data.tar.gz: 2aa4e1df5ae4fc08e78c06cf2107c7192099326b073bf45e45a9532b3fb5d0c3
5
5
  SHA512:
6
- metadata.gz: 577a51ca98e7bd940ab48a6482978c5f098fbba5c5e6921105950086f92cc327e44edf10259a3aafdf6fe8ff068690fb5d8b387aed85f5e07f2fc57b7ea8ce5d
7
- data.tar.gz: 5f5e7316bd62168356532c07186e0a3ff03c2c4a49c8d43d7dff51d64f261bf9368598b80acc69ebcc802af64d5ef0906f8422a0c78e2401d87429668721e3f6
6
+ metadata.gz: d739b01780f6ce12654b09b701f343e850bd2eb750e705ca608f793e7e9cfef26b226927157ff595dcbb3f62ddbbd4f530439074ef9fdbc9a2cfd075dd78a3da
7
+ data.tar.gz: 7ec3181349383a4b9667aab046f56099d25f830a07aaa6a6135b8640a25d59e85c2191b3ffbecd263afe703f1f17a986f40f769e458bab532e70f837f9c9a029
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
+ Version 2, December 2004
3
+
4
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5
+
6
+ Everyone is permitted to copy and distribute verbatim or modified
7
+ copies of this license document, and changing it is allowed as long
8
+ as the name is changed.
9
+
10
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
+
13
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
data/README.md CHANGED
@@ -2,13 +2,6 @@
2
2
 
3
3
  A Ruby gem that provides linting capabilities for Vim9 script files. This linter helps identify syntax errors and enforce best practices for for Vim9 script.
4
4
 
5
- ## Features
6
-
7
- - Lexical analysis of Vim9 script syntax
8
- - Parsing of Vim9 script constructs
9
- - Detection of common errors and code smells
10
- - Command-line interface for easy integration with editors
11
-
12
5
  ## Installation
13
6
 
14
7
  Install the gem:
@@ -17,11 +10,22 @@ Install the gem:
17
10
  gem install vinter
18
11
  ```
19
12
 
13
+ ## Configure
14
+ Vinter will read config files on the following priority order
15
+ - User config (`~/.vinter`)
16
+ - Project config (`path/to/proj/.vinter`)
17
+
18
+ ```yaml
19
+ ignore_rules:
20
+ - missing-vim9script-declaration
21
+ - prefer-def-over-function
22
+ ```
23
+
20
24
  ## Usage
21
25
 
22
26
  ### Command Line
23
27
 
24
- Lint a Vim9 script file:
28
+ Updated vim linter for legacy and vim9script
25
29
 
26
30
  ```bash
27
31
  vinter path/to/your/script.vim
@@ -89,7 +93,3 @@ issues = linter.lint(content)
89
93
  3. Commit your changes: `git commit -am 'Add some feature'`
90
94
  4. Push to the branch: `git push origin my-new-feature`
91
95
  5. Submit a pull request
92
-
93
- ## License
94
-
95
- This project is licensed under the MIT License - see the LICENSE file for details.
data/bin/vinter CHANGED
File without changes
data/lib/vinter/cli.rb CHANGED
@@ -6,42 +6,70 @@ module Vinter
6
6
 
7
7
  def run(args)
8
8
  if args.empty?
9
- puts "Usage: vim9-lint [file.vim]"
9
+ puts "Usage: vinter [file.vim|directory]"
10
10
  return 1
11
11
  end
12
12
 
13
- file_path = args[0]
13
+ target_path = args[0]
14
14
 
15
- unless File.exist?(file_path)
16
- puts "Error: File not found: #{file_path}"
15
+ unless File.exist?(target_path)
16
+ puts "Error: File or directory not found: #{target_path}"
17
17
  return 1
18
18
  end
19
19
 
20
- content = File.read(file_path)
21
- issues = @linter.lint(content)
20
+ vim_files = if File.directory?(target_path)
21
+ find_vim_files(target_path)
22
+ else
23
+ [target_path]
24
+ end
22
25
 
23
- if issues.empty?
24
- puts "No issues found in #{file_path}"
26
+ if vim_files.empty?
27
+ puts "No .vim files found in #{target_path}"
25
28
  return 0
26
- else
27
- puts "Found #{issues.length} issues in #{file_path}:"
29
+ end
30
+
31
+ total_issues = 0
32
+ error_count = 0
33
+
34
+ vim_files.each do |file_path|
35
+ content = File.read(file_path)
36
+ issues = @linter.lint(content)
37
+ total_issues += issues.length
38
+
39
+ if issues.empty?
40
+ puts "No issues found in #{file_path}" if vim_files.length == 1
41
+ else
42
+ puts "Found #{issues.length} issues in #{file_path}:" if vim_files.length > 1
43
+
44
+ issues.each do |issue|
45
+ type_str = case issue[:type]
46
+ when :error then "ERROR"
47
+ when :warning then "WARNING"
48
+ when :rule then "RULE(#{issue[:rule]})"
49
+ else "UNKNOWN"
50
+ end
28
51
 
29
- issues.each do |issue|
30
- type_str = case issue[:type]
31
- when :error then "ERROR"
32
- when :warning then "WARNING"
33
- when :rule then "RULE(#{issue[:rule]})"
34
- else "UNKNOWN"
35
- end
52
+ line = issue[:line] || 1
53
+ column = issue[:column] || 1
36
54
 
37
- line = issue[:line] || 1
38
- column = issue[:column] || 1
55
+ puts "#{file_path}:#{line}:#{column}: #{type_str}: #{issue[:message]}"
56
+ end
39
57
 
40
- puts "#{file_path}:#{line}:#{column}: #{type_str}: #{issue[:message]}"
58
+ error_count += 1 if issues.any? { |i| i[:type] == :error }
41
59
  end
60
+ end
42
61
 
43
- return issues.any? { |i| i[:type] == :error } ? 1 : 0
62
+ if vim_files.length > 1
63
+ puts "\nProcessed #{vim_files.length} files, found #{total_issues} total issues"
44
64
  end
65
+
66
+ return error_count > 0 ? 1 : 0
67
+ end
68
+
69
+ private
70
+
71
+ def find_vim_files(directory)
72
+ Dir.glob(File.join(directory, "**", "*.vim")).sort
45
73
  end
46
74
  end
47
75
  end