Skip to content

Commit

Permalink
Rubocop progress
Browse files Browse the repository at this point in the history
  • Loading branch information
cheerfulstoic committed Dec 28, 2014
1 parent 00a1b75 commit 5009427
Show file tree
Hide file tree
Showing 83 changed files with 1,255 additions and 974 deletions.
62 changes: 62 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,62 @@
inherit_from: .rubocop_todo.yml



#---------------------------
# Style configuration
#---------------------------

# Offense count: 169
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19

# Cop supports --auto-correct.
Style/SpaceInsideHashLiteralBraces:
Enabled: true
EnforcedStyle: no_space


#---------------------------
# Don't intend to fix these:
#---------------------------

# Cop supports --auto-correct.
# Reason: Double spaces can be useful for grouping code
Style/EmptyLines:
Enabled: false

# Cop supports --auto-correct.
# Reason: I have very big opinions on this one. See:
# https://github.com/bbatsov/ruby-style-guide/issues/329
# https://github.com/bbatsov/ruby-style-guide/pull/325
Style/NegatedIf:
Enabled: false

# Cop supports --auto-correct.
# Reason: I'm fine either way on this, but could maybe be convinced that this should be enforced
Style/Not:
Enabled: false

# Cop supports --auto-correct.
# Reason: I'm fine with this
Style/PerlBackrefs:
Enabled: false

# Configuration parameters: Methods.
# Reason: We should be able to specify full variable names, even if it's only one line
Style/SingleLineBlockParams:
Enabled: false

# Offense count: 1
# Reason: Switched `extend self` to `module_function` in id_property.rb but that caused errors
Style/ModuleFunction:
Enabled: false

# Configuration parameters: AllowSafeAssignment.
# Reason: I'm a proud user of assignment in conditionals.
Lint/AssignmentInCondition:
Enabled: false

164 changes: 164 additions & 0 deletions .rubocop_todo.yml
@@ -0,0 +1,164 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2014-12-28 12:03:39 +0100 using RuboCop version 0.28.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
# Cop supports --auto-correct.
Lint/BlockAlignment:
Enabled: false

# Offense count: 2
Lint/Eval:
Enabled: false

# Offense count: 2
Lint/HandleExceptions:
Enabled: false

# Offense count: 11
Lint/ShadowingOuterLocalVariable:
Enabled: false

# Offense count: 15
# Cop supports --auto-correct.
Lint/UnusedBlockArgument:
Enabled: false

# Offense count: 15
# Cop supports --auto-correct.
Lint/UnusedMethodArgument:
Enabled: false

# Offense count: 22
Lint/UselessAssignment:
Enabled: false

# Offense count: 17
Metrics/AbcSize:
Max: 35

# Offense count: 1
Metrics/BlockNesting:
Max: 4

# Offense count: 2
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 263

# Offense count: 5
Metrics/CyclomaticComplexity:
Max: 8

# Offense count: 739
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 216

# Offense count: 22
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 45

# Offense count: 1
Metrics/PerceivedComplexity:
Max: 10

# Offense count: 5
Style/AccessorMethodName:
Enabled: false

# Offense count: 2
Style/AsciiComments:
Enabled: false

# Offense count: 7
Style/CaseEquality:
Enabled: false

# Offense count: 26
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false

# Offense count: 3
Style/ClassVars:
Enabled: false

# Offense count: 2
# Configuration parameters: Keywords.
Style/CommentAnnotation:
Enabled: false

# Offense count: 155
Style/Documentation:
Enabled: false

# Offense count: 7
Style/DoubleNegation:
Enabled: false

# Offense count: 84
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundBlockBody:
Enabled: false

# Offense count: 24
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundClassBody:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/EmptyLinesAroundMethodBody:
Enabled: false

# Offense count: 41
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundModuleBody:
Enabled: false

# Offense count: 3
# Configuration parameters: Exclude.
Style/FileName:
Enabled: false

# Offense count: 13
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Enabled: false

# Offense count: 13
Style/Lambda:
Enabled: false

# Offense count: 2
Style/MultilineBlockChain:
Enabled: false

# Offense count: 10
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
Style/PredicateName:
Enabled: false

# Offense count: 84
# Cop supports --auto-correct.
Style/RedundantSelf:
Enabled: false

# Offense count: 3
Style/RegexpLiteral:
MaxSlashes: 0

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
Style/TrivialAccessors:
Enabled: false

4 changes: 3 additions & 1 deletion .travis.yml
@@ -1,4 +1,6 @@
script: "bundle exec rake neo4j:install['community-2.2.0-M01'] neo4j:disable_auth neo4j:start default --trace"
script:
- "bundle exec rubocop"
- "bundle exec rake neo4j:install['community-2.2.0-M01'] neo4j:disable_auth neo4j:start default --trace"
language: ruby
rvm:
- 2.1.5
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Expand Up @@ -4,8 +4,8 @@ gemspec

gem 'zip'

#gem 'neo4j-advanced', '>= 1.8.1', '< 2.0', :require => false
#gem 'neo4j-enterprise', '>= 1.8.1', '< 2.0', :require => false
# gem 'neo4j-advanced', '>= 1.8.1', '< 2.0', :require => false
# gem 'neo4j-enterprise', '>= 1.8.1', '< 2.0', :require => false

gem 'coveralls', require: false
gem 'simplecov-html', require: false
Expand All @@ -19,7 +19,7 @@ group 'development' do
end

group 'test' do
gem "rake", ">= 0.8.7"
gem "rspec", "~> 3.0"
gem 'rake', '>= 0.8.7'
gem 'rspec', '~> 3.0'
gem 'rspec-its'
end
29 changes: 29 additions & 0 deletions Guardfile
@@ -0,0 +1,29 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec feature)

## Uncomment to clear the screen before every task
# clearing :on

## Guard internally checks for changes in the Guardfile and exits.
## If you want Guard to automatically start up again, run guard in a
## shell loop, e.g.:
##
## $ while bundle exec guard; do echo "Restarting Guard..."; done
##
## Note: if you are using the `directories` clause above and you are not
## watching the project directory ('.'), the you will want to move the Guardfile
## to a watched dir and symlink it back, e.g.
#
# $ mkdir config
# $ mv Guardfile config/
# $ ln -s config/Guardfile .
#
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"

guard :rubocop, cli: '--auto-correct' do
watch(/.+\\.rb$/)
watch(%r{(?:.+/)?\.rubocop.*\.yml$}) { |m| File.dirname(m[0]) }
end
14 changes: 7 additions & 7 deletions Rakefile
@@ -1,36 +1,36 @@
require 'rake'
require "bundler/gem_tasks"
require 'bundler/gem_tasks'
load 'neo4j/tasks/neo4j_server.rake'
require 'yard'

load './spec/lib/yard_rspec.rb'

def jar_path
spec = Gem::Specification.find_by_name("neo4j-community")
spec = Gem::Specification.find_by_name('neo4j-community')
gem_root = spec.gem_dir
gem_root + "/lib/neo4j-community/jars"
gem_root + '/lib/neo4j-community/jars'
end

YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb', 'spec/**/*_spec.rb']
end

desc "Run neo4j-core specs"
desc 'Run neo4j-core specs'
task 'spec' do
success = system('rspec spec')
abort("RSpec neo4j-core failed") unless success
abort('RSpec neo4j-core failed') unless success
end

desc 'Generate coverage report'
task 'coverage' do
ENV['COVERAGE'] = 'true'
rm_rf "coverage/"
rm_rf 'coverage/'
task = Rake::Task['spec']
task.reenable
task.invoke
end

task :default => [:spec]
task default: [:spec]

# require 'coveralls/rake/task'
# Coveralls::RakeTask.new
Expand Down
1 change: 0 additions & 1 deletion lib/neo4j-core.rb
Expand Up @@ -27,4 +27,3 @@
module Neo4j::Embedded
end
end

2 changes: 0 additions & 2 deletions lib/neo4j-core/active_entity.rb
Expand Up @@ -9,5 +9,3 @@ def persisted?

end
end


10 changes: 5 additions & 5 deletions lib/neo4j-core/cypher_translator.rb
Expand Up @@ -35,18 +35,18 @@ def create_escape_value(value)
EMPTY_PROPS = ''

def sanitize_escape_sequences(s)
s.gsub SANITIZE_ESCAPED_REGEXP, EMPTY_PROPS
s.gsub SANITIZE_ESCAPED_REGEXP, EMPTY_PROPS
end

def escape_quotes(s)
s.gsub("'", %q(\\\'))
s.gsub("'", %q(\\\'))
end

# Cypher Helper
def cypher_prop_list(props)
return nil unless props
props.reject! {|k,v| v.nil? }
{ props: props.each { |k, v| props[k] = create_escape_value(v) } }
props.reject! { |k, v| v.nil? }
{props: props.each { |k, v| props[k] = create_escape_value(v) }}
end

# Stolen from keymaker
Expand All @@ -64,7 +64,7 @@ def cypher_string(labels, props)
end

def label_string(labels)
labels.empty? ? '' : ":#{labels.map{|k| "`#{k}`"}.join(':')}"
labels.empty? ? '' : ":#{labels.map { |k| "`#{k}`" }.join(':')}"
end

def prop_identifier(props)
Expand Down

0 comments on commit 5009427

Please sign in to comment.