ruby-lint 1.1.0 → 2.0.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/CONTRIBUTING.md +43 -29
- data/LICENSE +1 -1
- data/README.md +0 -1
- data/bin/ruby-lint +91 -3
- data/checksum/ruby-lint-1.1.0.gem.sha512 +1 -0
- data/doc/changelog.md +30 -0
- data/doc/code_analysis.md +13 -0
- data/doc/configuration.md +5 -24
- data/lib/ruby-lint.rb +7 -10
- data/lib/ruby-lint/analysis/argument_amount.rb +2 -0
- data/lib/ruby-lint/analysis/base.rb +12 -0
- data/lib/ruby-lint/analysis/pedantics.rb +2 -0
- data/lib/ruby-lint/analysis/shadowing_variables.rb +2 -0
- data/lib/ruby-lint/analysis/undefined_methods.rb +5 -2
- data/lib/ruby-lint/analysis/undefined_variables.rb +2 -0
- data/lib/ruby-lint/analysis/unused_variables.rb +2 -0
- data/lib/ruby-lint/analysis/useless_equality_checks.rb +2 -0
- data/lib/ruby-lint/ast/node.rb +0 -15
- data/lib/ruby-lint/command.rb +100 -0
- data/lib/ruby-lint/configuration.rb +35 -66
- data/lib/ruby-lint/constant_path.rb +7 -2
- data/lib/ruby-lint/definition/ruby_object.rb +20 -6
- data/lib/ruby-lint/definitions/core/argf.rb +3 -3
- data/lib/ruby-lint/definitions/gems/minitest.rb +792 -0
- data/lib/ruby-lint/file_list.rb +1 -1
- data/lib/ruby-lint/file_loader.rb +2 -20
- data/lib/ruby-lint/file_scanner.rb +11 -2
- data/lib/ruby-lint/method_evaluation.rb +21 -0
- data/lib/ruby-lint/presenter/base.rb +18 -0
- data/lib/ruby-lint/presenter/json.rb +3 -1
- data/lib/ruby-lint/presenter/syntastic.rb +3 -1
- data/lib/ruby-lint/presenter/text.rb +3 -1
- data/lib/ruby-lint/runner.rb +6 -63
- data/lib/ruby-lint/variable_predicates.rb +3 -3
- data/lib/ruby-lint/version.rb +1 -1
- data/lib/ruby-lint/virtual_machine.rb +4 -1
- data/ruby-lint.gemspec +13 -4
- metadata +12 -187
- data/.editorconfig +0 -15
- data/.gitignore +0 -6
- data/.ruby-version +0 -1
- data/.travis.yml +0 -19
- data/Gemfile +0 -15
- data/MANIFEST +0 -469
- data/Rakefile +0 -25
- data/benchmark/bootup.rb +0 -13
- data/benchmark/virtual_machine.rb +0 -17
- data/checksum/.gitkeep +0 -0
- data/doc/.gitkeep +0 -0
- data/doc/css/.gitkeep +0 -0
- data/doc/images/.gitkeep +0 -0
- data/gen/rails/constants.txt +0 -12
- data/gen/rails/requires.rb +0 -2
- data/gen/stdlib/constants.rb +0 -30
- data/gen/stdlib/constants.txt +0 -214
- data/gen/stdlib/requires.rb +0 -64
- data/lib/ruby-lint/benchmark/average.rb +0 -115
- data/lib/ruby-lint/cache.rb +0 -121
- data/lib/ruby-lint/cache_entry.rb +0 -44
- data/lib/ruby-lint/cli.rb +0 -4
- data/lib/ruby-lint/cli/analyze.rb +0 -209
- data/lib/ruby-lint/cli/base.rb +0 -103
- data/lib/ruby-lint/cli/cache.rb +0 -60
- data/lib/ruby-lint/default_names.rb +0 -19
- data/lib/ruby-lint/definitions/gems/.gitkeep +0 -0
- data/lib/ruby-lint/node_hash.rb +0 -105
- data/misc/stdlib.rb +0 -66
- data/profiling/virtual_machine.rb +0 -20
- data/ruby-lint.yml +0 -7
- data/spec/fixtures/associating.rb +0 -7
- data/spec/fixtures/complex/rails/basic_controller.rb +0 -9
- data/spec/fixtures/complex/rcap.rb +0 -67
- data/spec/fixtures/complex/slop.rb +0 -701
- data/spec/fixtures/config.yml +0 -8
- data/spec/fixtures/deeply/nested/file.rb +0 -1
- data/spec/fixtures/file_scanner/lib/example/recursive/source.rb +0 -6
- data/spec/fixtures/file_scanner/lib/example/recursive/target.rb +0 -8
- data/spec/fixtures/file_scanner/lib/example/user.rb +0 -6
- data/spec/fixtures/file_scanner/lib/ruby-lint/definition/constant_proxy.rb +0 -6
- data/spec/fixtures/file_scanner/lib/ruby-lint/global_scope.rb +0 -6
- data/spec/fixtures/file_scanner/lib/test-dashes/foo.rb +0 -4
- data/spec/fixtures/file_scanner/rails/app/models/example/user.rb +0 -6
- data/spec/fixtures/file_scanner/rails/app/models/user.rb +0 -4
- data/spec/fixtures/invalid.rb +0 -3
- data/spec/fixtures/invalid_2.rb +0 -3
- data/spec/fixtures/syntax_error.rb +0 -1
- data/spec/fixtures/uses_external.rb +0 -1
- data/spec/fixtures/uses_external_invalid.rb +0 -3
- data/spec/fixtures/uses_external_namespace.rb +0 -1
- data/spec/fixtures/valid.rb +0 -3
- data/spec/ruby-lint/analysis/argument_amount_spec.rb +0 -131
- data/spec/ruby-lint/analysis/base_spec.rb +0 -24
- data/spec/ruby-lint/analysis/pedantics_spec.rb +0 -63
- data/spec/ruby-lint/analysis/shadowing_variables_spec.rb +0 -85
- data/spec/ruby-lint/analysis/undefined_methods_spec.rb +0 -337
- data/spec/ruby-lint/analysis/undefined_variables_spec.rb +0 -138
- data/spec/ruby-lint/analysis/unused_variables_spec.rb +0 -270
- data/spec/ruby-lint/analysis/useless_equality_checks_spec.rb +0 -107
- data/spec/ruby-lint/ast/node_spec.rb +0 -39
- data/spec/ruby-lint/cache_entry_spec.rb +0 -25
- data/spec/ruby-lint/cache_spec.rb +0 -53
- data/spec/ruby-lint/cli/analyze_spec.rb +0 -52
- data/spec/ruby-lint/configuration_spec.rb +0 -126
- data/spec/ruby-lint/constant_loader_spec.rb +0 -79
- data/spec/ruby-lint/constant_path.rb +0 -63
- data/spec/ruby-lint/definition/constant_proxy_spec.rb +0 -85
- data/spec/ruby-lint/definition/dsl_spec.rb +0 -135
- data/spec/ruby-lint/definition/registry_spec.rb +0 -106
- data/spec/ruby-lint/definition/ruby_method_spec.rb +0 -106
- data/spec/ruby-lint/definition/ruby_object_spec.rb +0 -264
- data/spec/ruby-lint/definition_builder/primitive_spec.rb +0 -62
- data/spec/ruby-lint/definition_builder/ruby_class_spec.rb +0 -107
- data/spec/ruby-lint/definition_builder/ruby_method_spec.rb +0 -53
- data/spec/ruby-lint/definition_builder/ruby_module_spec.rb +0 -52
- data/spec/ruby-lint/definitions/argv_spec.rb +0 -18
- data/spec/ruby-lint/definitions/env_spec.rb +0 -13
- data/spec/ruby-lint/definitions/file_spec.rb +0 -17
- data/spec/ruby-lint/definitions/fixnum_spec.rb +0 -18
- data/spec/ruby-lint/definitions/io_spec.rb +0 -15
- data/spec/ruby-lint/definitions/kernel_spec.rb +0 -18
- data/spec/ruby-lint/definitions/range_spec.rb +0 -21
- data/spec/ruby-lint/definitions/string_spec.rb +0 -20
- data/spec/ruby-lint/docstring/mapping.rb +0 -27
- data/spec/ruby-lint/docstring/parser_spec.rb +0 -88
- data/spec/ruby-lint/extensions/string_spec.rb +0 -7
- data/spec/ruby-lint/file_list_spec.rb +0 -25
- data/spec/ruby-lint/file_loader_spec.rb +0 -69
- data/spec/ruby-lint/file_scanner_spec.rb +0 -84
- data/spec/ruby-lint/inspector_spec.rb +0 -224
- data/spec/ruby-lint/iterator_spec.rb +0 -151
- data/spec/ruby-lint/method_call/.gitkeep +0 -0
- data/spec/ruby-lint/nested_stack_spec.rb +0 -23
- data/spec/ruby-lint/node_hash_spec.rb +0 -56
- data/spec/ruby-lint/parser_spec.rb +0 -38
- data/spec/ruby-lint/presenter/json_spec.rb +0 -58
- data/spec/ruby-lint/presenter/syntastic_spec.rb +0 -49
- data/spec/ruby-lint/presenter/text_spec.rb +0 -49
- data/spec/ruby-lint/report/entry_spec.rb +0 -58
- data/spec/ruby-lint/report_spec.rb +0 -39
- data/spec/ruby-lint/runner_spec.rb +0 -74
- data/spec/ruby-lint/variable_predicates_spec.rb +0 -30
- data/spec/ruby-lint/virtual_machine/alias_spec.rb +0 -55
- data/spec/ruby-lint/virtual_machine/assignments/arrays_spec.rb +0 -87
- data/spec/ruby-lint/virtual_machine/assignments/assignment_arguments_spec.rb +0 -14
- data/spec/ruby-lint/virtual_machine/assignments/constants_spec.rb +0 -23
- data/spec/ruby-lint/virtual_machine/assignments/hashes_spec.rb +0 -52
- data/spec/ruby-lint/virtual_machine/assignments/optional_spec.rb +0 -41
- data/spec/ruby-lint/virtual_machine/assignments/range_spec.rb +0 -28
- data/spec/ruby-lint/virtual_machine/assignments/return_values_spec.rb +0 -78
- data/spec/ruby-lint/virtual_machine/assignments/variables_spec.rb +0 -130
- data/spec/ruby-lint/virtual_machine/associate_nodes_spec.rb +0 -61
- data/spec/ruby-lint/virtual_machine/autoloading_spec.rb +0 -18
- data/spec/ruby-lint/virtual_machine/blocks_spec.rb +0 -90
- data/spec/ruby-lint/virtual_machine/classes/class_methods_spec.rb +0 -21
- data/spec/ruby-lint/virtual_machine/classes/extending_spec.rb +0 -109
- data/spec/ruby-lint/virtual_machine/classes/redefining_spec.rb +0 -51
- data/spec/ruby-lint/virtual_machine/classes/sclass_spec.rb +0 -96
- data/spec/ruby-lint/virtual_machine/classes/scoping_spec.rb +0 -60
- data/spec/ruby-lint/virtual_machine/complex/rails_spec.rb +0 -21
- data/spec/ruby-lint/virtual_machine/complex/rcap_spec.rb +0 -15
- data/spec/ruby-lint/virtual_machine/complex/slop_spec.rb +0 -16
- data/spec/ruby-lint/virtual_machine/constants_spec.rb +0 -31
- data/spec/ruby-lint/virtual_machine/for_spec.rb +0 -16
- data/spec/ruby-lint/virtual_machine/freeze_spec.rb +0 -13
- data/spec/ruby-lint/virtual_machine/global_variables_spec.rb +0 -15
- data/spec/ruby-lint/virtual_machine/inherit_kernel_spec.rb +0 -15
- data/spec/ruby-lint/virtual_machine/interpolation_spec.rb +0 -12
- data/spec/ruby-lint/virtual_machine/location_spec.rb +0 -64
- data/spec/ruby-lint/virtual_machine/method_call_tracking_spec.rb +0 -57
- data/spec/ruby-lint/virtual_machine/methods/attr_spec.rb +0 -182
- data/spec/ruby-lint/virtual_machine/methods/calls_spec.rb +0 -25
- data/spec/ruby-lint/virtual_machine/methods/define_method_spec.rb +0 -41
- data/spec/ruby-lint/virtual_machine/methods/defining_spec.rb +0 -40
- data/spec/ruby-lint/virtual_machine/methods/docstrings_spec.rb +0 -80
- data/spec/ruby-lint/virtual_machine/methods/exporting_spec.rb +0 -19
- data/spec/ruby-lint/virtual_machine/methods/kernel_spec.rb +0 -25
- data/spec/ruby-lint/virtual_machine/methods/parameters_spec.rb +0 -89
- data/spec/ruby-lint/virtual_machine/methods/patching_spec.rb +0 -20
- data/spec/ruby-lint/virtual_machine/methods/scoping_spec.rb +0 -63
- data/spec/ruby-lint/virtual_machine/methods/square_bracket_spec.rb +0 -32
- data/spec/ruby-lint/virtual_machine/methods/visibility_spec.rb +0 -64
- data/spec/ruby-lint/virtual_machine/modules_spec.rb +0 -205
- data/spec/ruby-lint/virtual_machine/reference_amount_spec.rb +0 -81
- data/spec/ruby-lint/virtual_machine/self_spec.rb +0 -37
- data/spec/ruby-lint/virtual_machine/unused_spec.rb +0 -17
- data/spec/spec_helper.rb +0 -28
- data/spec/support/building.rb +0 -50
- data/spec/support/coveralls.rb +0 -5
- data/spec/support/definitions.rb +0 -39
- data/spec/support/fixtures.rb +0 -20
- data/spec/support/parsing.rb +0 -30
- data/spec/support/simplecov.rb +0 -18
- data/spec/support/versions.rb +0 -9
- data/task/build.rake +0 -4
- data/task/checksum.rake +0 -13
- data/task/coverage.rake +0 -6
- data/task/doc.rake +0 -16
- data/task/generate.rake +0 -77
- data/task/graphviz.rake +0 -12
- data/task/manifest.rake +0 -8
- data/task/tag.rake +0 -6
- data/task/test.rake +0 -4
- data/task/todo.rake +0 -6
- data/task/travis.rake +0 -8
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe RubyLint::VirtualMachine do
|
|
4
|
-
describe 'self in instances/classes' do
|
|
5
|
-
before :all do
|
|
6
|
-
code = <<-CODE
|
|
7
|
-
class Example
|
|
8
|
-
def self.class_method
|
|
9
|
-
@class_self = self
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def instance_method
|
|
13
|
-
@instance_self = self
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
CODE
|
|
17
|
-
|
|
18
|
-
definitions = build_definitions(code)
|
|
19
|
-
@constant = definitions.lookup(:const, 'Example')
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
example 'set the right instance type' do
|
|
23
|
-
@constant.lookup(:ivar, '@class_self').value.instance?.should == false
|
|
24
|
-
@constant.lookup(:ivar, '@instance_self').value.instance?.should == true
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
example 'self should be defined as a class method' do
|
|
28
|
-
@constant.lookup(:method, 'self').is_a?(ruby_method).should == true
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
example 'self should be defined as an instance method' do
|
|
32
|
-
@constant.lookup(:instance_method, 'self')
|
|
33
|
-
.is_a?(ruby_method)
|
|
34
|
-
.should == true
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe RubyLint::VirtualMachine do
|
|
4
|
-
describe 'marking variables as used/unused' do
|
|
5
|
-
example 'mark variables as unused by default' do
|
|
6
|
-
defs = build_definitions('number = 10')
|
|
7
|
-
|
|
8
|
-
defs.lookup(:lvar, 'number').used?.should == false
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
example 'mark variables as used' do
|
|
12
|
-
defs = build_definitions('number = 10; number')
|
|
13
|
-
|
|
14
|
-
defs.lookup(:lvar, 'number').used?.should == true
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
require 'rspec'
|
|
2
|
-
require 'stringio'
|
|
3
|
-
require 'redcard'
|
|
4
|
-
require 'tmpdir'
|
|
5
|
-
require 'fileutils'
|
|
6
|
-
require 'tempfile'
|
|
7
|
-
|
|
8
|
-
if ENV['COVERAGE']
|
|
9
|
-
require_relative 'support/simplecov'
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
if ENV['COVERALLS']
|
|
13
|
-
require_relative 'support/coveralls'
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Disable caching of RubyLint::Runner for all tests.
|
|
17
|
-
ENV['RUBY_LINT_DISABLE_CACHE'] = '1'
|
|
18
|
-
|
|
19
|
-
require_relative '../lib/ruby-lint'
|
|
20
|
-
require_relative 'support/building'
|
|
21
|
-
require_relative 'support/parsing'
|
|
22
|
-
require_relative 'support/definitions'
|
|
23
|
-
require_relative 'support/fixtures'
|
|
24
|
-
require_relative 'support/versions'
|
|
25
|
-
|
|
26
|
-
RSpec.configure do |config|
|
|
27
|
-
config.color = true
|
|
28
|
-
end
|
data/spec/support/building.rb
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# Builds a list of definitions for the specified block of Ruby code.
|
|
3
|
-
#
|
|
4
|
-
# @param [String] code The code to analyze.
|
|
5
|
-
# @return [RubyLint::Definition::RubyObject]
|
|
6
|
-
#
|
|
7
|
-
def build_definitions(code)
|
|
8
|
-
ast, comments = parse_with_comments(code)
|
|
9
|
-
vm = RubyLint::VirtualMachine.new(:comments => comments)
|
|
10
|
-
|
|
11
|
-
vm.run(ast)
|
|
12
|
-
|
|
13
|
-
return vm.definitions
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
##
|
|
17
|
-
# Builds a report for the given code and iterator class.
|
|
18
|
-
#
|
|
19
|
-
# @param [String] code
|
|
20
|
-
# @param [Class] iterator
|
|
21
|
-
# @return [RubyLint::Report]
|
|
22
|
-
#
|
|
23
|
-
def build_report(code, iterator)
|
|
24
|
-
ast, comments = parse_with_comments(code)
|
|
25
|
-
vm = RubyLint::VirtualMachine.new(:comments => comments)
|
|
26
|
-
|
|
27
|
-
vm.run(ast)
|
|
28
|
-
|
|
29
|
-
report = RubyLint::Report.new
|
|
30
|
-
iterator = iterator.new(:report => report, :vm => vm)
|
|
31
|
-
|
|
32
|
-
iterator.iterate(ast)
|
|
33
|
-
|
|
34
|
-
return report
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
##
|
|
38
|
-
# Processes the given AST and returns the node associations.
|
|
39
|
-
#
|
|
40
|
-
# @see build_definitions
|
|
41
|
-
# @return [Hash]
|
|
42
|
-
#
|
|
43
|
-
def build_associations(code)
|
|
44
|
-
ast, comments = parse_with_comments(code)
|
|
45
|
-
vm = RubyLint::VirtualMachine.new(:comments => comments)
|
|
46
|
-
|
|
47
|
-
vm.run(ast)
|
|
48
|
-
|
|
49
|
-
return vm.associations
|
|
50
|
-
end
|
data/spec/support/coveralls.rb
DELETED
data/spec/support/definitions.rb
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# @return [Class]
|
|
3
|
-
#
|
|
4
|
-
def ruby_object
|
|
5
|
-
return RubyLint::Definition::RubyObject
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
##
|
|
9
|
-
# @return [Class]
|
|
10
|
-
#
|
|
11
|
-
def ruby_method
|
|
12
|
-
return RubyLint::Definition::RubyMethod
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
##
|
|
16
|
-
# @param [#to_s] type
|
|
17
|
-
# @return [RubyLint::Definition::RubyMethod]
|
|
18
|
-
#
|
|
19
|
-
def method_with_argument(object, type)
|
|
20
|
-
return object.define_method('example') do |example|
|
|
21
|
-
example.send("define_#{type}", 'number')
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
##
|
|
26
|
-
# Loads a list of built-in definitions.
|
|
27
|
-
#
|
|
28
|
-
# @param [String] names
|
|
29
|
-
#
|
|
30
|
-
def load_definitions(*names)
|
|
31
|
-
root = ruby_object.new
|
|
32
|
-
loader = RubyLint::ConstantLoader.new(:definitions => root)
|
|
33
|
-
|
|
34
|
-
names.each do |name|
|
|
35
|
-
loader.load_constant(name)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
return root
|
|
39
|
-
end
|
data/spec/support/fixtures.rb
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# Returns the source code of a fixture file.
|
|
3
|
-
#
|
|
4
|
-
# @param [String] path The path to the fixture file, relative to the fixture
|
|
5
|
-
# directory
|
|
6
|
-
# @return [String]
|
|
7
|
-
#
|
|
8
|
-
def fixture(path)
|
|
9
|
-
return File.read(fixture_path(path))
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
##
|
|
13
|
-
# Returns the path to the given fixture file.
|
|
14
|
-
#
|
|
15
|
-
# @param [String] path The path relative to the fixtures directory.
|
|
16
|
-
# @return [String]
|
|
17
|
-
#
|
|
18
|
-
def fixture_path(path)
|
|
19
|
-
return File.join(File.expand_path('../../fixtures', __FILE__), path)
|
|
20
|
-
end
|
data/spec/support/parsing.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# Parses the specified Ruby code and returns the first instance of
|
|
3
|
-
# {RubyLint::Node} (excluding the root node).
|
|
4
|
-
#
|
|
5
|
-
# @param [String] code The code to parse.
|
|
6
|
-
# @param [TrueClass|FalseClass] first When set to `true` only the first node
|
|
7
|
-
# is returned.
|
|
8
|
-
# @return [RubyLint::Node]
|
|
9
|
-
#
|
|
10
|
-
def parse(code, first = true)
|
|
11
|
-
ast, _ = RubyLint::Parser.new.parse(code)
|
|
12
|
-
|
|
13
|
-
return first ? ast.children[0] : ast
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
##
|
|
17
|
-
# Parses the block of code and returns both the AST and comments.
|
|
18
|
-
#
|
|
19
|
-
# @see #parse
|
|
20
|
-
#
|
|
21
|
-
def parse_with_comments(code)
|
|
22
|
-
return RubyLint::Parser.new.parse(code)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
##
|
|
26
|
-
# Shorthand for creating instances of a AST node.
|
|
27
|
-
#
|
|
28
|
-
def s(type, *children)
|
|
29
|
-
return RubyLint::AST::Node.new(type, children)
|
|
30
|
-
end
|
data/spec/support/simplecov.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require 'simplecov'
|
|
2
|
-
|
|
3
|
-
SimpleCov.configure do
|
|
4
|
-
root File.expand_path('../../../', __FILE__)
|
|
5
|
-
command_name 'rspec'
|
|
6
|
-
project_name 'ruby-lint'
|
|
7
|
-
|
|
8
|
-
add_group 'Analysis', 'ruby-lint/analysis'
|
|
9
|
-
add_group 'Definition Containers', 'ruby-lint/definition'
|
|
10
|
-
add_group 'Definition Builders', 'ruby-lint/definition_builder'
|
|
11
|
-
add_group 'Presenters', 'ruby-lint/presenter'
|
|
12
|
-
|
|
13
|
-
add_filter 'spec'
|
|
14
|
-
add_filter 'lib/ruby-lint/version'
|
|
15
|
-
add_filter 'lib/ruby-lint/definitions'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
SimpleCov.start
|
data/spec/support/versions.rb
DELETED
data/task/build.rake
DELETED
data/task/checksum.rake
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
desc 'Creates a SHA512 checksum of the current version'
|
|
2
|
-
task :checksum do
|
|
3
|
-
checksums = File.expand_path('../../checksum', __FILE__)
|
|
4
|
-
name = "#{GEMSPEC.name}-#{GEMSPEC.version}.gem"
|
|
5
|
-
path = File.join(File.expand_path('../../pkg', __FILE__), name)
|
|
6
|
-
|
|
7
|
-
checksum_name = File.basename(path) + '.sha512'
|
|
8
|
-
checksum = Digest::SHA512.new.hexdigest(File.read(path))
|
|
9
|
-
|
|
10
|
-
File.open(File.join(checksums, checksum_name), 'w') do |handle|
|
|
11
|
-
handle.write(checksum)
|
|
12
|
-
end
|
|
13
|
-
end
|
data/task/coverage.rake
DELETED
data/task/doc.rake
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
desc 'Builds the documentation'
|
|
2
|
-
task :doc do
|
|
3
|
-
sh('rake graphviz')
|
|
4
|
-
sh('yard doc')
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
desc 'Generates and uploads the documentation'
|
|
8
|
-
task :upload_doc => :doc do
|
|
9
|
-
root_dir = "/srv/http/code.yorickpeterse.com/public/ruby-lint"
|
|
10
|
-
version_dir = File.join(root_dir, RubyLint::VERSION)
|
|
11
|
-
|
|
12
|
-
sh "scp -r yardoc europa:#{version_dir}"
|
|
13
|
-
|
|
14
|
-
sh "ssh europa 'rm -f #{root_dir}/latest " \
|
|
15
|
-
"&& ln -s #{version_dir} #{root_dir}/latest'"
|
|
16
|
-
end
|
data/task/generate.rake
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
namespace :generate do
|
|
2
|
-
desc 'Generates a set of definitions for a constant'
|
|
3
|
-
task :definitions, :constant, :directory, :overwrite do |task, args|
|
|
4
|
-
abort 'You have to specify a constant' unless args[:constant]
|
|
5
|
-
abort 'You have to specify a directory' unless args[:directory]
|
|
6
|
-
|
|
7
|
-
generator = RubyLint::DefinitionGenerator.new(
|
|
8
|
-
args[:constant],
|
|
9
|
-
args[:directory],
|
|
10
|
-
:overwrite => !!args[:overwrite]
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
generator.generate
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
desc 'Generates definitions for all available constants'
|
|
17
|
-
task :everything, :overwrite do |task, args|
|
|
18
|
-
args.with_defaults(:overwrite => false)
|
|
19
|
-
|
|
20
|
-
require_relative '../gen/stdlib/requires'
|
|
21
|
-
|
|
22
|
-
directory = File.expand_path(
|
|
23
|
-
'../../lib/ruby-lint/definitions/core/',
|
|
24
|
-
__FILE__
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
constants_file = File.expand_path(
|
|
28
|
-
'../../gen/stdlib/constants.txt',
|
|
29
|
-
__FILE__
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
allowed = File.read(constants_file).split("\n")
|
|
33
|
-
ignore = Object.constants.map(&:to_s) - allowed
|
|
34
|
-
generator = RubyLint::DefinitionGenerator.new(
|
|
35
|
-
Object,
|
|
36
|
-
directory,
|
|
37
|
-
:overwrite => !!args[:overwrite],
|
|
38
|
-
:ignore => ignore
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
generator.generate
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
desc 'Generates definitions for Rails'
|
|
45
|
-
task :rails do
|
|
46
|
-
require_relative '../gen/rails/requires'
|
|
47
|
-
|
|
48
|
-
directory = File.expand_path(
|
|
49
|
-
'../../lib/ruby-lint/definitions/rails',
|
|
50
|
-
__FILE__
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
constants_file = File.expand_path(
|
|
54
|
-
'../../gen/rails/constants.txt',
|
|
55
|
-
__FILE__
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
constants = File.read(constants_file).split("\n")
|
|
59
|
-
|
|
60
|
-
# Deal with Rails' autoloading nonsense.
|
|
61
|
-
constants.each do |name|
|
|
62
|
-
constant = Object.const_get(name)
|
|
63
|
-
|
|
64
|
-
constant.eager_load! if constant.respond_to?(:eager_load!)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
ignore = Object.constants.map(&:to_s) - constants
|
|
68
|
-
generator = RubyLint::DefinitionGenerator.new(
|
|
69
|
-
Object,
|
|
70
|
-
directory,
|
|
71
|
-
:overwrite => true,
|
|
72
|
-
:ignore => ignore
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
generator.generate
|
|
76
|
-
end
|
|
77
|
-
end
|
data/task/graphviz.rake
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
desc 'Generates all the Graphviz graphs'
|
|
2
|
-
task :graphviz do
|
|
3
|
-
pattern = File.expand_path('../../doc/graphviz/*.dot', __FILE__)
|
|
4
|
-
output = File.expand_path('../../doc/images/', __FILE__)
|
|
5
|
-
|
|
6
|
-
Dir.glob(pattern) do |file|
|
|
7
|
-
name = File.basename(file, '.dot') + '.png'
|
|
8
|
-
destination = File.join(output, name)
|
|
9
|
-
|
|
10
|
-
sh("dot -T png -o #{destination} #{file}")
|
|
11
|
-
end
|
|
12
|
-
end
|
data/task/manifest.rake
DELETED
data/task/tag.rake
DELETED
data/task/test.rake
DELETED
data/task/todo.rake
DELETED