overcommit 0.69.0 → 0.70.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 +4 -4
- data/config/default.yml +14 -0
- data/lib/overcommit/hook/pre_commit/ox_fmt.rb +35 -0
- data/lib/overcommit/hook/pre_commit/ox_lint.rb +35 -0
- data/lib/overcommit/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8040d08a9f79785e2cd046c2cf17996688fc0a83c81a9a21f0527501d3160b61
|
|
4
|
+
data.tar.gz: 7e2d8f6b3323dda0523a0f05994ad01e8321e652544ca3a71ffe746fa7e83b6d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa10fe74466654b81aca04252f85de4f7d34964250843a4908d7e3f6328ab63ec666e1cc9cd4c3d17a0aef63c2be4966a9f1a0ef1e2b3d25fd43beb33ecaa7fb
|
|
7
|
+
data.tar.gz: 64dbb9a221dcf7983923155f6bf461dd378b57969d0ac185856aa4fdc0908dd9c82b868f9f9db114712d5a4522ea74d9c4af5d255cd403ebdd181182ce440208
|
data/config/default.yml
CHANGED
|
@@ -565,6 +565,20 @@ PreCommit:
|
|
|
565
565
|
flags: ['-t']
|
|
566
566
|
include: '**/nginx.conf'
|
|
567
567
|
|
|
568
|
+
OxFmt:
|
|
569
|
+
enabled: false
|
|
570
|
+
description: 'Analyze with oxfmt'
|
|
571
|
+
required_executable: 'oxfmt'
|
|
572
|
+
flags: ['--check']
|
|
573
|
+
install_command: 'npm install -g oxfmt'
|
|
574
|
+
|
|
575
|
+
OxLint:
|
|
576
|
+
enabled: false
|
|
577
|
+
description: 'Analyze with oxlint'
|
|
578
|
+
required_executable: 'oxlint'
|
|
579
|
+
flags: ['--format=unix']
|
|
580
|
+
install_command: 'npm install -g oxlint'
|
|
581
|
+
|
|
568
582
|
Pep257: # Deprecated – use Pydocstyle instead.
|
|
569
583
|
enabled: false
|
|
570
584
|
description: 'Analyze docstrings with pep257'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Overcommit::Hook::PreCommit
|
|
4
|
+
# Runs `oxfmt` against any modified files.
|
|
5
|
+
#
|
|
6
|
+
# Protip: if you have an npm script set up to run oxfmt, you can configure
|
|
7
|
+
# this hook to run oxfmt via your npm script by using the `command` option in
|
|
8
|
+
# your .overcommit.yml file. This can be useful if you have some oxfmt
|
|
9
|
+
# configuration built into your npm script that you don't want to repeat
|
|
10
|
+
# somewhere else. Example:
|
|
11
|
+
#
|
|
12
|
+
# oxfmt:
|
|
13
|
+
# required_executable: 'npm'
|
|
14
|
+
# enabled: true
|
|
15
|
+
# command: ['npm', 'run', 'fmt', '--', '--check']
|
|
16
|
+
#
|
|
17
|
+
# Note: This hook only supports check mode.
|
|
18
|
+
#
|
|
19
|
+
# @see https://oxc.rs
|
|
20
|
+
class OxFmt < Base
|
|
21
|
+
def run
|
|
22
|
+
oxfmt_regex = /^(?<file>.+) \(\d+ms\)/
|
|
23
|
+
result = execute(command, args: applicable_files)
|
|
24
|
+
output = result.stdout.chomp
|
|
25
|
+
messages = output.split("\n").grep(oxfmt_regex)
|
|
26
|
+
|
|
27
|
+
return [:fail, result.stderr] if messages.empty? && !result.success?
|
|
28
|
+
return :pass if result.success? && output.empty?
|
|
29
|
+
|
|
30
|
+
# example message:
|
|
31
|
+
# test.js (5ms)
|
|
32
|
+
extract_messages(messages, oxfmt_regex)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Overcommit::Hook::PreCommit
|
|
4
|
+
# Runs `oxlint` against any modified JavaScript files.
|
|
5
|
+
#
|
|
6
|
+
# Protip: if you have an npm script set up to run oxlint, you can configure
|
|
7
|
+
# this hook to run oxlint via your npm script by using the `command` option in
|
|
8
|
+
# your .overcommit.yml file. This can be useful if you have some oxlint
|
|
9
|
+
# configuration built into your npm script that you don't want to repeat
|
|
10
|
+
# somewhere else. Example:
|
|
11
|
+
#
|
|
12
|
+
# OxLint:
|
|
13
|
+
# required_executable: 'npm'
|
|
14
|
+
# enabled: true
|
|
15
|
+
# command: ['npm', 'run', 'lint', '--', '--format=unix']
|
|
16
|
+
#
|
|
17
|
+
# Note: This hook supports only unix format.
|
|
18
|
+
#
|
|
19
|
+
# @see https://oxc.rs
|
|
20
|
+
class OxLint < Base
|
|
21
|
+
def run
|
|
22
|
+
oxlint_regex = %r{^(?:file://)?(?<file>[^:]+):(?<line>\d+):\d+:.*?(?<type>Error|Warning)}
|
|
23
|
+
result = execute(command, args: applicable_files)
|
|
24
|
+
output = result.stdout.chomp
|
|
25
|
+
messages = output.split("\n").grep(oxlint_regex)
|
|
26
|
+
|
|
27
|
+
return [:fail, result.stderr] if messages.empty? && !result.success?
|
|
28
|
+
return :pass if result.success? && output.empty?
|
|
29
|
+
|
|
30
|
+
# example message:
|
|
31
|
+
# file://test.js:5:1: `debugger` statement is not allowed [Error/eslint(no-debugger)]
|
|
32
|
+
extract_messages(messages, oxlint_regex, lambda { |type| type.downcase.to_sym })
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
data/lib/overcommit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: overcommit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.70.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shane da Silva
|
|
@@ -180,6 +180,8 @@ files:
|
|
|
180
180
|
- lib/overcommit/hook/pre_commit/merge_conflicts.rb
|
|
181
181
|
- lib/overcommit/hook/pre_commit/mix_format.rb
|
|
182
182
|
- lib/overcommit/hook/pre_commit/nginx_test.rb
|
|
183
|
+
- lib/overcommit/hook/pre_commit/ox_fmt.rb
|
|
184
|
+
- lib/overcommit/hook/pre_commit/ox_lint.rb
|
|
183
185
|
- lib/overcommit/hook/pre_commit/pep257.rb
|
|
184
186
|
- lib/overcommit/hook/pre_commit/pep8.rb
|
|
185
187
|
- lib/overcommit/hook/pre_commit/php_cs.rb
|