mirror of
https://github.com/lloeki/rebel.git
synced 2025-12-06 01:54:40 +01:00
Lint
This commit is contained in:
parent
2155aa8d43
commit
619837da62
3 changed files with 52 additions and 5 deletions
32
.rubocop.yml
Normal file
32
.rubocop.yml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
inherit_from: .rubocop_todo.yml
|
||||
|
||||
Metrics/LineLength:
|
||||
Enabled: false
|
||||
|
||||
Metrics/ParameterLists:
|
||||
Enabled: false
|
||||
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
Style/ClassAndModuleChildren:
|
||||
Enabled: false
|
||||
|
||||
Metrics/ModuleLength:
|
||||
Enabled: false
|
||||
|
||||
Style/TrailingCommaInLiteral:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/TrailingCommaInArguments:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/NestedParenthesizedCalls:
|
||||
Enabled: false
|
||||
|
||||
Style/BracesAroundHashParameters:
|
||||
Exclude:
|
||||
- 'test/test_*.rb'
|
||||
|
||||
Style/IndentArray:
|
||||
EnforcedStyle: consistent
|
||||
15
.rubocop_todo.yml
Normal file
15
.rubocop_todo.yml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2017-02-28 19:06:39 +0100 using RuboCop version 0.47.1.
|
||||
# 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: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: prefer_alias, prefer_alias_method
|
||||
Style/Alias:
|
||||
Exclude:
|
||||
- 'test/helper.rb'
|
||||
|
|
@ -105,7 +105,7 @@ module Rebel::SQL
|
|||
end
|
||||
|
||||
def update(table_name, set: nil, where: nil, inner: nil, left: nil, right: nil)
|
||||
fail ArgumentError if set.nil?
|
||||
raise ArgumentError if set.nil?
|
||||
|
||||
<<-SQL
|
||||
UPDATE #{Rebel::SQL.name(table_name)}
|
||||
|
|
@ -180,9 +180,9 @@ module Rebel::SQL
|
|||
case v
|
||||
when Raw then v
|
||||
when String then raw "'#{v.tr("'", "''")}'"
|
||||
when Fixnum, Bignum, Integer then raw v.to_s
|
||||
when Integer then raw v.to_s
|
||||
when nil then raw 'NULL'
|
||||
else fail NotImplementedError, v.inspect
|
||||
else raise NotImplementedError, v.inspect
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ module Rebel::SQL
|
|||
case e
|
||||
when Array then clause_term(e[0], e[1])
|
||||
when Raw, String then e
|
||||
else fail NotImplementedError, e.class
|
||||
else raise NotImplementedError, e.class
|
||||
end
|
||||
end.join(' AND ')
|
||||
end
|
||||
|
|
@ -226,7 +226,7 @@ module Rebel::SQL
|
|||
def where?(clause)
|
||||
return "WHERE #{clause}" if clause.is_a?(Raw) || clause.is_a?(String)
|
||||
|
||||
(clause && clause.any?) ? "WHERE #{Rebel::SQL.and_clause(clause)}" : nil
|
||||
clause && clause.any? ? "WHERE #{Rebel::SQL.and_clause(clause)}" : nil
|
||||
end
|
||||
|
||||
def inner?(join)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue