linters 1.1.0 → 2.0.1

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: ad70ce7250bd12937bb5605599a38688c7a494a506fbf84b68608385c1a0e6c3
4
- data.tar.gz: dbd4946b3b06497ffe5c68f14aa3ef1dc44ed35a6513e72139617c66a062d5e4
3
+ metadata.gz: a559b44af47629a4611187a2c524cb3dd2cb0d6ef8b4aeb16dbe75b7fdf0ce64
4
+ data.tar.gz: fa688a4549d7766f2ff664d112598b9dd74cdd0928f5966bca670535d75ceb0f
5
5
  SHA512:
6
- metadata.gz: 98ef6821304298355c4b36abd5464d054be5ac0fad5349d21520760e7682e0634a13fb7363cfba67092f516e4c4cf85b75ef8864fdacb03373e790082f57b16b
7
- data.tar.gz: 8165791ae0cd6631e89e280fde7747f6fc7376718294dcaa64c67b37ef738bfaa5048fd90003a106ac3ca4857b968842a439c1e82ab945ad1ceda4956cda3004
6
+ metadata.gz: e9b627626fcff7b5d72c74ab99c71eb69a7d9230f8c2902a3597134f0091abd32773dc5549bc0d5483e58fd2529b58e1eb515a9abfcb6b13df56b8af24eba330
7
+ data.tar.gz: de39b2917ac97a0e9815a1e51d60680af74f03b0e146e059d2d321bfef4b82dab8de3f023e78746eb394f7f688622b987cdf9646bc0e18506c6fbe24b5905b37
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- linters (1.0.3)
4
+ linters (1.1.1)
5
5
  rake
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -49,13 +49,18 @@ Settings with default values:
49
49
  Linters.configure do |config|
50
50
  config.custom_linters = {}
51
51
  config.linters = %i[rubocop reek bundle_audit fasterer]
52
- config.settings_path = 'config/settings.yml'
52
+ config.settings_path = 'config/linter_settings.yml'
53
53
  end
54
54
  ```
55
55
 
56
- Default config/settings.yml:
56
+ Default config/linter_settings.yml:
57
57
 
58
58
  ```
59
+ checkers:
60
+ - rubocop
61
+ - reek
62
+ - bundle_audit
63
+ - fasterer
59
64
  rubocop:
60
65
  warnings_number: 0
61
66
  reek:
@@ -1,4 +1,9 @@
1
1
  linters:
2
+ checkers:
3
+ - rubocop
4
+ - reek
5
+ - bundle_audit
6
+ - fasterer
2
7
  rubocop:
3
8
  warnings_number: 0
4
9
  reek:
@@ -3,10 +3,20 @@ module Linters
3
3
  # :reek:Attribute
4
4
  attr_accessor :custom_linters, :linters, :settings_path
5
5
 
6
+ DEFAULT_CHECKERS = %i[rubocop reek bundle_audit fasterer].freeze
7
+
6
8
  def initialize
7
9
  @custom_linters = {}
8
- @linters = %i[rubocop reek bundle_audit fasterer]
9
- @settings_path = 'config/settings.yml'
10
+ @settings_path = ENV.fetch('LINTERS_SETTING_PATH', 'config/linter_settings.yml')
11
+ @linters = ENV.fetch('LINTERS_CHECKERS', load_checkers(@settings_path))
12
+ end
13
+
14
+ private
15
+
16
+ def load_checkers(path)
17
+ return DEFAULT_CHECKERS unless File.exist?(path)
18
+
19
+ (YAML.load_file(path)['linters']['checkers'] || DEFAULT_CHECKERS).map(&:to_sym)
10
20
  end
11
21
  end
12
22
  end
@@ -23,7 +23,7 @@ module Linters
23
23
  parse_output: ->(output) { JSON.parse(output).size }
24
24
  },
25
25
  rubocop: {
26
- default_command: 'rubocop --format json',
26
+ default_command: 'rubocop --parallel --format json',
27
27
  parse_output: ->(output) { JSON.parse(output)['summary']['offense_count'] }
28
28
  }
29
29
  }.freeze
@@ -39,7 +39,7 @@ module Linters
39
39
  end
40
40
 
41
41
  def warnings_number
42
- settings.fetch(:warnings_number) { 0 }
42
+ ENV.fetch("LINTERS_#{ name.upcase }_NUMBER_WARNINGS", settings.fetch(:warnings_number) { 0 })
43
43
  end
44
44
 
45
45
  def command
@@ -1,3 +1,3 @@
1
1
  module Linters
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linters
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - skrinits
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-21 00:00:00.000000000 Z
11
+ date: 2022-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -142,7 +142,7 @@ files:
142
142
  - Rakefile
143
143
  - bin/console
144
144
  - bin/setup
145
- - config/settings.yml
145
+ - config/linter_settings.yml
146
146
  - lib/linters.rb
147
147
  - lib/linters/builder.rb
148
148
  - lib/linters/configuration.rb