ruby-lint 2.1.0 → 2.2.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
  SHA1:
3
- metadata.gz: 57cc060a02f3673b6b1882db8d8336b0556d9068
4
- data.tar.gz: e82d93af41f14763d686945929d41febe3138445
3
+ metadata.gz: 8bf37bd3d8da6b4f67786c1a253264d9834ae60c
4
+ data.tar.gz: 55e7485469de13d24f95d09a3ba89e16b39e9d71
5
5
  SHA512:
6
- metadata.gz: d323ef78ba18926744314ec63c2f56d95ad497ad0493ed4d642392ee7d2c019bf3c4c3d72f23d4f946656a9f8098e49ecd9e93e886aa9df12b019a479df31ad6
7
- data.tar.gz: 6eb0838c420a61d30f26775502de4f7f8dbab35a11758658d408073d25f77acef5cfff898be975be4707e83d8b256594a71b3caf8e0e1d7e09ec87517382dbdc
6
+ metadata.gz: 0c35b467c325e8ade9eedbc0804a6fd1eff49c0afdee96449378923b2394e7a692f88a2c42985262b7af5cac5eea515d90242edda76c455f2e33c644404cdc35
7
+ data.tar.gz: a00707a3cbf48c2abf148c94417956d187bf2572f1d1f73c9468d255302605d818569cc5bd3b57a0733a05b9a7520f80631672d566c7aa1df96bf5db63ed27f2
@@ -0,0 +1 @@
1
+ e03c693a87efe6d6ad3a30d17827c07fe54fe7cf6248b03449caf7de5c0c37e454a826207b76bbc40dd207d8d684c15d1dc6851d44bd593bf4bab568fc92fc08
@@ -5,6 +5,20 @@ This document contains a short summary of the various releases of ruby-lint.
5
5
  For a full list of commits included in each release see the corresponding Git
6
6
  tags (named after the versions).
7
7
 
8
+ ## 2.2.0 - 2016-05-26
9
+
10
+ * Martin Vidner added a present for Emacs, see commit
11
+ ffd38a22cc840eb786088582efdfea1ba8635d8d for more information.
12
+ * Martin Vidner added tests for Report::Entry#<=>, see commits
13
+ 15d9797f7f32c7f615fb473a99ed8769e8b7a826 and
14
+ 1e77ab825ac5b254c096ff1d6d4eba1fc4e8ea86 for more information.
15
+ * Martin Vidner cleaned up some YARD comments and fixed the Travis
16
+ configuration. See commits e3acb83ecc4a7ff4f5f76130a68ea6a676d216f9,
17
+ 738fd2eae4811fb1617f475c552e763cc1fd460e, and
18
+ 1e364b6307b7f4b64b1eeeb0a05ccfe9c430b093 for more information.
19
+ * A bug with parallel assignments was fixed by Mistral Contrastin. See commit
20
+ f177ff67b9439b98678807d50efb433f4c3e774b for more information.
21
+
8
22
  ## 2.1.0 - 2016-01-22
9
23
 
10
24
  Ryan McKern added a definition for `Module#module_function` in pull request
@@ -86,6 +86,7 @@ analysis results. The following presenters are currently available:
86
86
  * text
87
87
  * json
88
88
  * syntastic
89
+ * emacs
89
90
 
90
91
  The default presenter is `text`.
91
92
 
@@ -74,3 +74,4 @@ require_relative 'ruby-lint/presenter/base'
74
74
  require_relative 'ruby-lint/presenter/text'
75
75
  require_relative 'ruby-lint/presenter/json'
76
76
  require_relative 'ruby-lint/presenter/syntastic'
77
+ require_relative 'ruby-lint/presenter/emacs'
@@ -112,6 +112,12 @@ module RubyLint
112
112
  max = min + method.amount(:optarg) + method.amount(:restarg)
113
113
  end
114
114
 
115
+ # If the method follows the writer naming pattern with a '=' ending,
116
+ # the parser generates send nodes with one less argument than needed in
117
+ # the case of parallel assignment. Here reducing minimum prevents false
118
+ # positive warnings to be generated.
119
+ min -= 1 if method.name =~ /=$/
120
+
115
121
  return min, max
116
122
  end
117
123
 
@@ -40,6 +40,7 @@ module RubyLint
40
40
  # Registers a new definition with the given name.
41
41
  #
42
42
  # @param [String] name The name of the constant.
43
+ # @yieldparam [RubyLint::Definition::RubyObject] defs
43
44
  #
44
45
  def register(name, &block)
45
46
  registered[name] = block
@@ -543,6 +543,7 @@ module RubyLint
543
543
  # string.define_constant('NEWLINE')
544
544
  #
545
545
  # @param [String] name
546
+ # @yieldparam [RubyLint::Definition::RubyObject] defs
546
547
  # @return [RubyLint::Definition::RubyObject]
547
548
  #
548
549
  def define_constant(name, &block)
@@ -578,7 +579,8 @@ module RubyLint
578
579
  # @example
579
580
  # string.define_method(:new)
580
581
  #
581
- # @param [String] name
582
+ # @param [String,Symbol] name
583
+ # @yieldparam [RubyLint::Definition::RubyMethod] method
582
584
  # @return [RubyLint::Definition::RubyMethod]
583
585
  #
584
586
  def define_method(name, &block)
@@ -592,6 +594,9 @@ module RubyLint
592
594
  # string.define_instance_method(:gsub)
593
595
  #
594
596
  # @see RubyLint::Definition::RubyObject#define_method
597
+ # @param [String,Symbol] name
598
+ # @yieldparam [RubyLint::Definition::RubyMethod] method
599
+ # @return [RubyLint::Definition::RubyMethod]
595
600
  #
596
601
  def define_instance_method(name, &block)
597
602
  return add_child_method(:instance_method, name, &block)
@@ -615,7 +620,7 @@ module RubyLint
615
620
  ##
616
621
  # Adds the object(s) to the list of parent definitions.
617
622
  #
618
- # @param [Array] definitions
623
+ # @param [Array<RubyLint::Definition::ConstantProxy>] definitions
619
624
  #
620
625
  def inherits(*definitions)
621
626
  self.parents.concat(definitions)
@@ -623,6 +628,8 @@ module RubyLint
623
628
 
624
629
  ##
625
630
  # @see {RubyLint::Definition::ConstantProxy#initialize}
631
+ # @param [String] name
632
+ # @param [RubyLint::Definition::Registry] registry
626
633
  # @return [RubyLint::Definition::ConstantProxy]
627
634
  #
628
635
  def constant_proxy(name, registry = nil)
@@ -0,0 +1,39 @@
1
+ module RubyLint
2
+ module Presenter
3
+ ##
4
+ # {RubyLint::Presenter::Emacs} formats a instance of {RubyLint::Report} into
5
+ # a format parsable by Emacs compile mode
6
+ #
7
+ class Emacs < Base
8
+ register 'emacs'
9
+
10
+ ##
11
+ # The default format to use when presenting report entries.
12
+ #
13
+ # @return [String]
14
+ #
15
+ FORMAT = '%{file}:%{line}:%{column}:%{level}: %{message}'
16
+
17
+ ##
18
+ # @param [String] format The format to use for each entry.
19
+ #
20
+ def initialize(format = FORMAT.dup)
21
+ @format = format
22
+ end
23
+
24
+ ##
25
+ # @param [RubyLint::Report] report The report to present.
26
+ # @return [String]
27
+ #
28
+ def present(report)
29
+ entries = []
30
+
31
+ report.entries.sort.each do |entry|
32
+ entries << @format % entry.attributes
33
+ end
34
+
35
+ return entries.join("\n")
36
+ end
37
+ end # Emacs
38
+ end # Presenter
39
+ end # RubyLint
@@ -67,7 +67,7 @@ module RubyLint
67
67
  # @return [Numeric]
68
68
  #
69
69
  def <=>(other)
70
- return (filename <=> other.filename) <=> (other.line <=> line)
70
+ [filename, line] <=> [other.filename, other.line]
71
71
  end
72
72
  end # Entry
73
73
  end # Report
@@ -1,3 +1,3 @@
1
1
  module RubyLint
2
- VERSION = '2.1.0'
2
+ VERSION = '2.2.0'
3
3
  end # RubyLint
@@ -216,8 +216,6 @@ module RubyLint
216
216
  ##
217
217
  # Processes a regular variable assignment.
218
218
  #
219
- # @param [RubyLint::AST::Node] node
220
- #
221
219
  def on_assign
222
220
  reset_assignment_value
223
221
  value_stack.add_stack
@@ -226,6 +224,8 @@ module RubyLint
226
224
  ##
227
225
  # @see #on_assign
228
226
  #
227
+ # @param [RubyLint::AST::Node] node
228
+ #
229
229
  def after_assign(node)
230
230
  type = ASSIGNMENT_TYPES[node.type]
231
231
  name = node.children[0].to_s
@@ -279,9 +279,6 @@ module RubyLint
279
279
  add_variable(variable, scope)
280
280
  end
281
281
 
282
- ##
283
- # @param [RubyLint::AST::Node] node
284
- #
285
282
  def on_masgn
286
283
  add_stacks
287
284
  end
@@ -302,9 +299,6 @@ module RubyLint
302
299
  end
303
300
  end
304
301
 
305
- ##
306
- # @param [RubyLint::AST::Node] node
307
- #
308
302
  def on_or_asgn
309
303
  add_stacks
310
304
  end
@@ -321,9 +315,6 @@ module RubyLint
321
315
  end
322
316
  end
323
317
 
324
- ##
325
- # @param [RubyLint::AST::Node] node
326
- #
327
318
  def on_and_asgn
328
319
  add_stacks
329
320
  end
@@ -331,8 +322,6 @@ module RubyLint
331
322
  ##
332
323
  # Processes an `and` assignment in the form of `variable &&= value`.
333
324
  #
334
- # @param [RubyLint::AST::Node] node
335
- #
336
325
  def after_and_asgn
337
326
  variable = variable_stack.pop.first
338
327
  value = value_stack.pop.first
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yorick Peterse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -171,6 +171,7 @@ files:
171
171
  - checksum/ruby-lint-2.0.3.gem.sha512
172
172
  - checksum/ruby-lint-2.0.4.gem.sha512
173
173
  - checksum/ruby-lint-2.0.5.gem.sha512
174
+ - checksum/ruby-lint-2.1.0.gem.sha512
174
175
  - doc/architecture.md
175
176
  - doc/changelog.md
176
177
  - doc/code_analysis.md
@@ -459,6 +460,7 @@ files:
459
460
  - lib/ruby-lint/nested_stack.rb
460
461
  - lib/ruby-lint/parser.rb
461
462
  - lib/ruby-lint/presenter/base.rb
463
+ - lib/ruby-lint/presenter/emacs.rb
462
464
  - lib/ruby-lint/presenter/json.rb
463
465
  - lib/ruby-lint/presenter/syntastic.rb
464
466
  - lib/ruby-lint/presenter/text.rb