Skip to content

Commit

Permalink
Updated rubocop rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
lfittl committed May 24, 2015
1 parent 7f242b8 commit f9c73ba
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 10 deletions.
8 changes: 7 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ MethodLength:
ClassLength:
Enabled: false

Style/BlockNesting:
Metrics/AbcSize:
Enabled: false

Metrics/BlockNesting:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://rubygems.org'

gemspec
gemspec
2 changes: 1 addition & 1 deletion ext/pg_query/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
system("cd #{pgdir}; CFLAGS=-fPIC ./configure -q") || fail('ERROR')
system("cd #{pgdir}; make -C src/backend lib-recursive") # Ensures headers are generated
PG_OBJS.each do |directory, objs|
system("cd #{pgdir}; make -C src/#{directory} #{objs.join(' ')}") || fail('ERROR')
system("cd #{pgdir}; make -C src/#{directory} #{objs.join(' ')}") || fail('ERROR')
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/pg_query/deparse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def deparse

private

def deparse_item(item, context = nil) # rubocop:disable Style/CyclomaticComplexity
def deparse_item(item, context = nil) # rubocop:disable Metrics/CyclomaticComplexity
return if item.nil?

type = item.keys[0]
Expand Down
2 changes: 1 addition & 1 deletion lib/pg_query/filter_columns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class PgQuery
# target list, but includes things like JOIN condition and WHERE clause.
#
# Note: This also traverses into sub-selects.
def filter_columns # rubocop:disable Style/CyclomaticComplexity
def filter_columns # rubocop:disable Metrics/CyclomaticComplexity
load_tables_and_aliases! if @aliases.nil?

# Get condition items from the parsetree
Expand Down
6 changes: 3 additions & 3 deletions lib/pg_query/fingerprint.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'digest'

class PgQuery
def fingerprint # rubocop:disable Style/CyclomaticComplexity
def fingerprint # rubocop:disable Metrics/CyclomaticComplexity
normalized_parsetree = deep_dup(parsetree)

# First delete all simple elements and attributes that can be removed
Expand All @@ -23,11 +23,11 @@ def fingerprint # rubocop:disable Style/CyclomaticComplexity
elsif k == 'targetList' && v.is_a?(Array)
# Remove SELECT target list names & ignore order
v.each { |v2| v2['RESTARGET']['name'] = nil if v2['RESTARGET'] } # Remove names
v.sort_by! { |v2| v2.to_s }
v.sort_by!(&:to_s)
expr[k] = v
elsif k == 'cols' && v.is_a?(Array)
# Ignore INSERT cols order
v.sort_by! { |v2| v2.to_s }
v.sort_by!(&:to_s)
expr[k] = v
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pg_query/param_refs.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class PgQuery
def param_refs # rubocop:disable Style/CyclomaticComplexity
def param_refs # rubocop:disable Metrics/CyclomaticComplexity
results = []

treewalker! parsetree do |_, _, v|
Expand Down
2 changes: 1 addition & 1 deletion lib/pg_query/parse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def aliases

protected

def load_tables_and_aliases! # rubocop:disable Style/CyclomaticComplexity
def load_tables_and_aliases! # rubocop:disable Metrics/CyclomaticComplexity
@tables = []
@aliases = {}

Expand Down

0 comments on commit f9c73ba

Please sign in to comment.