slim_lint 0.17.0 → 0.20.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: c46c0d7a658f450e3e00c0f5748acb512c8e19b06be92654c70640231a24658c
4
- data.tar.gz: 4a53220961467310115ea4dd91242517a0bb13c549fd6035889ae3963adc779a
3
+ metadata.gz: 70c5fb4937778a7f451600310d934305853a938b8bf08df3e3c08b28f680b2a4
4
+ data.tar.gz: a1b2e962a79cf35c060768d562997e04bb0835a8d474cd1c85b54c22c98b3af7
5
5
  SHA512:
6
- metadata.gz: dd248063a6e41b9c25f29ecfcf8dbdd370cf0974217158f1c7be7e5d1989ad9861c3a6fd266b18bb6f4756698386580ab6c2f0ba746337d2edd989809e96641e
7
- data.tar.gz: f7735d7db2b0be57b832b0399b617a53709dda7c3e6c1ddc0eb3b9c1b58eea0619acc0cd93c8a12cf3c40b9d6916f096f6b18ae6c56fa2f8e91e9ec59321c127
6
+ metadata.gz: d0105fb2ef8ba6551b8a98f55677d939f922405150477cdaff62118caabb8d99f1c07426283e590e9ffb6fc9098bdd01c4214db612659f37fb4a087dd506836a
7
+ data.tar.gz: 8559c4cf8e7850a11657b9cffa9ff09fa6c08c4283f33638f7b604c63859ac24c52ff9c8e3366c7900a678240ae5876d71eb58de2bd2a8853138ec4e7a56af30
@@ -42,16 +42,18 @@ linters:
42
42
  # WARNING: If you define this list in your own .slim-lint.yml file, you'll
43
43
  # be overriding the list defined here.
44
44
  ignored_cops:
45
- - Layout/AlignArguments
46
- - Layout/AlignArray
47
- - Layout/AlignHash
48
- - Layout/AlignParameters
45
+ - Layout/ArgumentAlignment
46
+ - Layout/ArrayAlignment
47
+ - Layout/BlockAlignment
49
48
  - Layout/EmptyLineAfterGuardClause
49
+ - Layout/EndAlignment
50
+ - Layout/FirstArrayElementIndentation
50
51
  - Layout/FirstParameterIndentation
51
- - Layout/IndentArray
52
+ - Layout/HashAlignment
52
53
  - Layout/IndentationConsistency
53
54
  - Layout/IndentationWidth
54
55
  - Layout/InitialIndentation
56
+ - Layout/LineLength
55
57
  - Layout/MultilineArrayBraceLayout
56
58
  - Layout/MultilineAssignmentLayout
57
59
  - Layout/MultilineHashBraceLayout
@@ -59,16 +61,15 @@ linters:
59
61
  - Layout/MultilineMethodCallIndentation
60
62
  - Layout/MultilineMethodDefinitionBraceLayout
61
63
  - Layout/MultilineOperationIndentation
62
- - Layout/TrailingBlankLines
64
+ - Layout/ParameterAlignment
65
+ - Layout/TrailingEmptyLines
63
66
  - Layout/TrailingWhitespace
64
- - Lint/BlockAlignment
65
- - Lint/EndAlignment
66
67
  - Lint/Void
67
68
  - Metrics/BlockLength
68
69
  - Metrics/BlockNesting
69
- - Metrics/LineLength
70
70
  - Naming/FileName
71
71
  - Style/FrozenStringLiteralComment
72
+ - Style/IdenticalConditionalBranches
72
73
  - Style/IfUnlessModifier
73
74
  - Style/Next
74
75
  - Style/WhileUntilModifier
@@ -19,7 +19,7 @@ require 'slim_lint/logger'
19
19
  require 'slim_lint/version'
20
20
 
21
21
  # Load all filters (required by SlimLint::Engine)
22
- Dir[File.expand_path('slim_lint/filters/*.rb', File.dirname(__FILE__))].each do |file|
22
+ Dir[File.expand_path('slim_lint/filters/*.rb', File.dirname(__FILE__))].sort.each do |file|
23
23
  require file
24
24
  end
25
25
 
@@ -37,16 +37,16 @@ require 'slim_lint/runner'
37
37
 
38
38
  # Load all matchers
39
39
  require 'slim_lint/matcher/base'
40
- Dir[File.expand_path('slim_lint/matcher/*.rb', File.dirname(__FILE__))].each do |file|
40
+ Dir[File.expand_path('slim_lint/matcher/*.rb', File.dirname(__FILE__))].sort.each do |file|
41
41
  require file
42
42
  end
43
43
 
44
44
  # Load all linters
45
- Dir[File.expand_path('slim_lint/linter/*.rb', File.dirname(__FILE__))].each do |file|
45
+ Dir[File.expand_path('slim_lint/linter/*.rb', File.dirname(__FILE__))].sort.each do |file|
46
46
  require file
47
47
  end
48
48
 
49
49
  # Load all reporters
50
- Dir[File.expand_path('slim_lint/reporter/*.rb', File.dirname(__FILE__))].each do |file|
50
+ Dir[File.expand_path('slim_lint/reporter/*.rb', File.dirname(__FILE__))].sort.each do |file|
51
51
  require file
52
52
  end
@@ -3,11 +3,18 @@
3
3
  require 'slim_lint'
4
4
  require 'slim_lint/options'
5
5
 
6
- require 'sysexits'
7
-
8
6
  module SlimLint
9
7
  # Command line application interface.
10
8
  class CLI # rubocop:disable Metrics/ClassLength
9
+ # Exit codes
10
+ # @see https://man.openbsd.org/sysexits.3
11
+ EX_OK = 0
12
+ EX_USAGE = 64
13
+ EX_DATAERR = 65
14
+ EX_NOINPUT = 67
15
+ EX_SOFTWARE = 70
16
+ EX_CONFIG = 78
17
+
11
18
  # Create a CLI that outputs to the specified logger.
12
19
  #
13
20
  # @param logger [SlimLint::Logger]
@@ -39,16 +46,16 @@ module SlimLint
39
46
 
40
47
  if options[:help]
41
48
  print_help(options)
42
- Sysexits::EX_OK
49
+ EX_OK
43
50
  elsif options[:version] || options[:verbose_version]
44
51
  print_version(options)
45
- Sysexits::EX_OK
52
+ EX_OK
46
53
  elsif options[:show_linters]
47
54
  print_available_linters
48
- Sysexits::EX_OK
55
+ EX_OK
49
56
  elsif options[:show_reporters]
50
57
  print_available_reporters
51
- Sysexits::EX_OK
58
+ EX_OK
52
59
  else
53
60
  scan_for_lints(options)
54
61
  end
@@ -60,20 +67,20 @@ module SlimLint
60
67
  case exception
61
68
  when SlimLint::Exceptions::ConfigurationError
62
69
  log.error exception.message
63
- Sysexits::EX_CONFIG
70
+ EX_CONFIG
64
71
  when SlimLint::Exceptions::InvalidCLIOption
65
72
  log.error exception.message
66
73
  log.log "Run `#{APP_NAME}` --help for usage documentation"
67
- Sysexits::EX_USAGE
74
+ EX_USAGE
68
75
  when SlimLint::Exceptions::InvalidFilePath
69
76
  log.error exception.message
70
- Sysexits::EX_NOINPUT
77
+ EX_NOINPUT
71
78
  when SlimLint::Exceptions::NoLintersError
72
79
  log.error exception.message
73
- Sysexits::EX_NOINPUT
80
+ EX_NOINPUT
74
81
  else
75
82
  print_unexpected_exception(exception)
76
- Sysexits::EX_SOFTWARE
83
+ EX_SOFTWARE
77
84
  end
78
85
  end
79
86
 
@@ -83,7 +90,7 @@ module SlimLint
83
90
  def scan_for_lints(options)
84
91
  report = Runner.new.run(options)
85
92
  print_report(report, options)
86
- report.failed? ? Sysexits::EX_DATAERR : Sysexits::EX_OK
93
+ report.failed? ? EX_DATAERR : EX_OK
87
94
  end
88
95
 
89
96
  # Outputs a report of the linter run using the specified reporter.
@@ -38,7 +38,7 @@ module SlimLint
38
38
  #
39
39
  # @param patterns [Array<String>]
40
40
  # @return [Array<String>]
41
- def extract_files_from(patterns) # rubocop:disable MethodLength
41
+ def extract_files_from(patterns) # rubocop:disable Metrics/MethodLength
42
42
  files = []
43
43
 
44
44
  patterns.each do |pattern|
@@ -11,6 +11,8 @@ module SlimLint
11
11
 
12
12
  comment = code[/\A\s*#(.*\z)/, 1]
13
13
 
14
+ next if comment =~ /^\s*rubocop:\w+/
15
+
14
16
  report_lint(sexp,
15
17
  "Slim code comments (`/#{comment}`) are preferred over " \
16
18
  "control statement comments (`-##{comment}`)")
@@ -9,7 +9,6 @@ module SlimLint
9
9
 
10
10
  on [:html, :tag, anything, [],
11
11
  [:slim, :output, anything, capture(:ruby, anything)]] do |sexp|
12
-
13
12
  # Fetch original Slim code that contains an element with a control statement.
14
13
  line = document.source_lines[sexp.line() - 1]
15
14
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module SlimLint
5
- VERSION = '0.17.0'
5
+ VERSION = '0.20.1'
6
6
  end
metadata CHANGED
@@ -1,49 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slim_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-03 00:00:00.000000000 Z
11
+ date: 2020-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '10'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '13'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '10'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '13'
33
13
  - !ruby/object:Gem::Dependency
34
14
  name: rubocop
35
15
  requirement: !ruby/object:Gem::Requirement
36
16
  requirements:
37
17
  - - ">="
38
18
  - !ruby/object:Gem::Version
39
- version: 0.50.0
19
+ version: 0.78.0
40
20
  type: :runtime
41
21
  prerelease: false
42
22
  version_requirements: !ruby/object:Gem::Requirement
43
23
  requirements:
44
24
  - - ">="
45
25
  - !ruby/object:Gem::Version
46
- version: 0.50.0
26
+ version: 0.78.0
47
27
  - !ruby/object:Gem::Dependency
48
28
  name: slim
49
29
  requirement: !ruby/object:Gem::Requirement
@@ -64,20 +44,6 @@ dependencies:
64
44
  - - "<"
65
45
  - !ruby/object:Gem::Version
66
46
  version: '5.0'
67
- - !ruby/object:Gem::Dependency
68
- name: sysexits
69
- requirement: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: '1.1'
74
- type: :runtime
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - "~>"
79
- - !ruby/object:Gem::Version
80
- version: '1.1'
81
47
  - !ruby/object:Gem::Dependency
82
48
  name: rspec
83
49
  requirement: !ruby/object:Gem::Requirement
@@ -189,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
155
  - !ruby/object:Gem::Version
190
156
  version: '0'
191
157
  requirements: []
192
- rubygems_version: 3.0.3
158
+ rubygems_version: 3.1.1
193
159
  signing_key:
194
160
  specification_version: 4
195
161
  summary: Slim template linting tool