Skip to content

Commit 450b1d1

Browse files
committed
Fix coding style
1 parent ee4e327 commit 450b1d1

File tree

5 files changed

+44
-10
lines changed

5 files changed

+44
-10
lines changed

.rubocop.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
AllCops:
2-
TargetRubyVersion: 2.5
2+
TargetRubyVersion: 2.4
33
Exclude:
4+
- bin/*
5+
- lib/generators/**/*.rb
46
- gemfiles/*
5-
- spec/**/*.rb
6-
- lib/ajax-datatables-rails.rb
7-
- lib/generators/rails/templates/*.rb
7+
- spec/**/*
88

9-
Documentation:
9+
Style/Documentation:
1010
Enabled: false
1111

12-
Layout/AlignHash:
12+
Layout/HashAlignment:
1313
Enabled: false
1414

1515
Layout/EmptyLines:
@@ -45,6 +45,10 @@ Metrics/ClassLength:
4545
Naming/AccessorMethodName:
4646
Enabled: false
4747

48+
Naming/FileName:
49+
Exclude:
50+
- lib/ajax-datatables-rails.rb
51+
4852
Style/TrailingCommaInArrayLiteral:
4953
EnforcedStyleForMultiline: comma
5054

ajax-datatables-rails.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ Gem::Specification.new do |s|
3131
s.add_development_dependency 'rails', '>= 5.0'
3232
s.add_development_dependency 'rake'
3333
s.add_development_dependency 'rspec'
34+
s.add_development_dependency 'rubocop'
3435
s.add_development_dependency 'simplecov'
3536
end

bin/rubocop

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rubocop' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("rubocop", "rubocop")

lib/ajax-datatables-rails.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
loader.ignore(generators)
99
loader.inflector.inflect(
1010
'orm' => 'ORM',
11-
'ajax-datatables-rails' => 'AjaxDatatablesRails',
11+
'ajax-datatables-rails' => 'AjaxDatatablesRails'
1212
)
1313
loader.setup
1414

lib/ajax-datatables-rails/datatable/simple_order.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def initialize(datatable, options = {})
1414
end
1515

1616
def query(sort_column)
17-
[sort_column, direction, nulls_last_sql].compact.join(" ")
17+
[sort_column, direction, nulls_last_sql].compact.join(' ')
1818
end
1919

2020
def column
@@ -44,9 +44,9 @@ def nulls_last_sql
4444

4545
case AjaxDatatablesRails.config.db_adapter
4646
when :pg, :postgresql, :postgres, :oracle
47-
"NULLS LAST"
47+
'NULLS LAST'
4848
when :mysql, :mysql2, :sqlite, :sqlite3
49-
"IS NULL"
49+
'IS NULL'
5050
else
5151
raise 'unsupported database adapter'
5252
end

0 commit comments

Comments
 (0)