Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use rspec2 instead of test unit to_source will be mutated with mutant soon. As mutant does only have an rspec2 compatible runner. * Introuce metrics * Bring code to 100% yard coverage * Add multiple assignment support
- Loading branch information
Markus Schirp
committed
Aug 19, 2012
1 parent
799c740
commit 388e4a3
Showing
26 changed files
with
1,763 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,36 @@ | ||
source "http://rubygems.org" | ||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in to_source.gemspec | ||
gemspec | ||
gem 'rake' | ||
|
||
gem 'immutable', :git => 'https://github.com/dkubb/immutable.git', :ref => '4a4b7ddd138a32944fa0ddaff8412490cf9dd875' | ||
gem 'abstract', :git => 'https://github.com/mbj/abstract.git' | ||
|
||
# Remove git version once original to_source is updated | ||
#gem 'to_source', :git => 'https://github.com/mbj/to_source' | ||
#gem 'to_source', :git => 'https://github.com/mbj/to_source.git' | ||
gem 'to_source', :path => '../to_source' | ||
|
||
group :development do | ||
gem 'rake', '~> 0.9.2' | ||
gem 'yard', '~> 0.8.1' | ||
gem 'rspec', '~> 2' | ||
# Remove this once https://github.com/nex3/rb-inotify/pull/20 is solved. | ||
# This patch makes rb-inotify a nice player with listen so it does not poll. | ||
gem 'rb-inotify', :git => 'https://github.com/mbj/rb-inotify' | ||
end | ||
|
||
group :guard do | ||
gem 'guard', '~> 1.3.1' | ||
gem 'guard-bundler', '~> 1.0.0' | ||
gem 'guard-rspec', '~> 1.2.0' | ||
end | ||
|
||
group :metrics do | ||
gem 'flay', '~> 1.4.2' | ||
gem 'flog', '~> 2.5.1' | ||
gem 'reek', '~> 1.2.8', :git => 'https://github.com/dkubb/reek.git' | ||
gem 'roodi', '~> 2.1.0' | ||
gem 'yardstick', '~> 0.5.0' | ||
gem 'yard-spellcheck', '~> 0.1.5' | ||
gem 'pelusa', '~> 0.2.1' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# encoding: utf-8 | ||
|
||
guard :bundler do | ||
watch('Gemfile') | ||
end | ||
|
||
guard :rspec, :version => 2 do | ||
# run all specs if the spec_helper or supporting files files are modified | ||
watch('spec/spec_helper.rb') { 'spec' } | ||
watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec' } | ||
|
||
# run unit specs if associated lib code is modified | ||
watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}"] } | ||
watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' } | ||
|
||
# run a spec if it is modified | ||
watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z}) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
require "bundler/gem_tasks" | ||
require 'rake' | ||
|
||
require 'rake/testtask' | ||
Rake::TestTask.new do |t| | ||
t.libs << "test" | ||
t.test_files = FileList['test/**/*_test.rb'] | ||
t.verbose = true | ||
end | ||
FileList['tasks/**/*.rake'].each { |task| import task } | ||
|
||
task :default => :test | ||
desc 'Default: run all specs' | ||
task :default => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* Fix parsing errors from ruby parser | ||
It breaks on def $keyword. | ||
* Do a metric driven refactor once flay flog and friends work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
threshold: 18 | ||
total_score: 296 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
threshold: 14.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
AbcMetricMethodCheck: | ||
score: 12.2 | ||
AssignmentInConditionalCheck: {} | ||
CaseMissingElseCheck: {} | ||
ClassLineCountCheck: | ||
line_count: 324 | ||
ClassNameCheck: | ||
pattern: !ruby/regexp /\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/ | ||
ClassVariableCheck: {} | ||
CyclomaticComplexityBlockCheck: | ||
complexity: 2 | ||
CyclomaticComplexityMethodCheck: | ||
complexity: 4 | ||
EmptyRescueBodyCheck: {} | ||
ForLoopCheck: {} | ||
MethodLineCountCheck: | ||
line_count: 9 | ||
MethodNameCheck: | ||
pattern: !ruby/regexp /\A(?:[a-z\d](?:_?[a-z\d])+[?!=]?|\[\]=?|==|<=>|<<|[+*&|-])\z/ | ||
ModuleLineCountCheck: | ||
line_count: 327 | ||
ModuleNameCheck: | ||
pattern: !ruby/regexp /\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/ | ||
ParameterNumberCheck: | ||
parameter_count: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
UncommunicativeParameterName: | ||
accept: [] | ||
exclude: [] | ||
enabled: true | ||
reject: | ||
- !ruby/regexp /^.$/ | ||
- !ruby/regexp /[0-9]$/ | ||
- !ruby/regexp /[A-Z]/ | ||
LargeClass: | ||
max_methods: 10 | ||
exclude: | ||
- "Mutant::Matcher::Method" # 13 methods | ||
enabled: true | ||
max_instance_variables: 3 | ||
UncommunicativeMethodName: | ||
accept: [] | ||
exclude: [] | ||
enabled: true | ||
reject: | ||
- !ruby/regexp /^[a-z]$/ | ||
- !ruby/regexp /[0-9]$/ | ||
- !ruby/regexp /[A-Z]/ | ||
LongParameterList: | ||
max_params: 2 | ||
exclude: | ||
- "Mutant::Context::Constant#initialize" # 3 params | ||
enabled: true | ||
overrides: {} | ||
FeatureEnvy: | ||
exclude: [] | ||
enabled: true | ||
ClassVariable: | ||
exclude: [] | ||
enabled: true | ||
BooleanParameter: | ||
exclude: [] | ||
enabled: true | ||
IrresponsibleModule: | ||
exclude: [] | ||
enabled: true | ||
UncommunicativeModuleName: | ||
accept: [] | ||
exclude: [] | ||
enabled: true | ||
reject: | ||
- !ruby/regexp /^.$/ | ||
- !ruby/regexp /[0-9]$/ | ||
NestedIterators: | ||
ignore_iterators: [] | ||
exclude: [] | ||
enabled: true | ||
max_allowed_nesting: 1 | ||
LongMethod: | ||
max_statements: 6 | ||
exclude: [] | ||
enabled: true | ||
Duplication: | ||
allow_calls: [] | ||
exclude: [] | ||
enabled: true | ||
max_calls: 1 | ||
UtilityFunction: | ||
max_helper_calls: 0 | ||
exclude: [] | ||
enabled: true | ||
Attribute: | ||
exclude: [] | ||
enabled: false | ||
UncommunicativeVariableName: | ||
accept: [] | ||
exclude: [] | ||
enabled: true | ||
reject: | ||
- !ruby/regexp /^.$/ | ||
- !ruby/regexp /[0-9]$/ | ||
- !ruby/regexp /[A-Z]/ | ||
SimulatedPolymorphism: | ||
exclude: [] | ||
enabled: true | ||
max_ifs: 1 | ||
DataClump: | ||
exclude: [] | ||
enabled: true | ||
max_copies: 2 | ||
min_clump_size: 2 | ||
ControlCouple: | ||
exclude: [] | ||
enabled: true | ||
LongYieldList: | ||
max_params: 1 | ||
exclude: [] | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
threshold: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
require "to_source/version" | ||
require "to_source/visitor" | ||
require 'to_source/version' | ||
require 'to_source/visitor' | ||
|
||
# Namespace of library | ||
module ToSource | ||
# Public: Converts the node back to its original source code. | ||
# Convert node to string | ||
# | ||
# Returns the String output. | ||
def to_source | ||
Visitor.run(self) | ||
# @param [Rubinius::AST::Node] node | ||
# | ||
# @return [String] | ||
# | ||
# @api private | ||
# | ||
def self.to_source(node) | ||
Visitor.run(node) | ||
end | ||
end | ||
|
||
Rubinius::AST::Node.send :include, ToSource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module ToSource | ||
VERSION = "0.1.3" | ||
VERSION = '0.1.3' | ||
end |
Oops, something went wrong.