Skip to content

Commit 3895873

Browse files
avellablenjh
authored andcommitted
Add Rubocop and cleanup (#96)
* [Rubocop][Style] Fix Style/StringLiterals * [Rubocop][Style] Fix Style/EmptyLinesAroundModuleBody * [Rubocop][Style] Fix Style/EmptyLinesAroundClassBody * [Rubocop][Style] Fix Style/TrailingCommaInLiteral * [Rubocop][Style] Fix Style/IfUnlessModifier * [Rubocop][Style] Fix Style/RaiseArgs * [Rubocop][Style] Fix Style/CaseIndentation * [Rubocop][Style] Fix Style/EmptyLines * [Rubocop][Style] Fix Style/IndentationWidth * [Rubocop][Style] Fix Style/NumericPredicate * [Rubocop][Style] Fix Style/SpaceAfterComma * [Rubocop][Style] Fix Style/ElseAlignment * [Rubocop][Style] Fix Style/SpaceAroundEqualsInParameterDefault * [Rubocop][Style] Fix Style/NumericLiterals * [Rubocop][Style] Fix Style/RedundantReturn * [Rubocop][Style] Fix Style/RedundantSelf * [Rubocop][Style] Fix Style/GuardClause * [Rubocop][Style] Fix Style/AndOrElse * [Rubocop][Style] Fix Style/SpaceAroundOperators * [Rubocop][Style] Fix Style/TrivialAccessors * [Rubocop][Style] Fix Style/SpaceAroundKeyword * [Rubocop][Style] Fix Style/SpaceInsideHashLiteralBraces * [Rubocop][Style] Fix Style/SpaceInsideBlockBraces * [Rubocop][Style] Fix Style/SpaceInsideParens * [Rubocop][Style] Fix Style/SpaceBeforeBlockBraces * [Rubocop][Style] Fix Style/MultilineOperationIndentation * [Rubocop][Style] Fix Style/RedundantParentheses * [Rubocop][Style] Fix Style/LineEndConcatenation * [Rubocop][Style] Fix Style/Not * [Rubocop][Style] Fix Style/NegatedIf * [Rubocop][Style] Fix Style/ConditionalAssignment * [Rubocop][Style] Fix Style/ClassCheck * [Rubocop][Style] Fix Style/ParenthesesAroundCondition * [Rubocop][Style] Fix Style/WhileUntilModifier * [Rubocop][Style] Fix Style/RedundantParentheses * [Rubocop][Style] Fix Style/ClassAndModuleChildren * [Rubocop][Style] Fix Style/PercentLiteralDelimiters * [Rubocop][Style] Fix Style/WhileUntilDo * [Rubocop][Style] Fix Style/RedundantBegin * [Rubocop][Style] Fix Style/ZeroLengthPredicate * [Rubocop][Style] Fix Style/EmptyLinesAroundAccessModifier * [Rubocop][Style] Fix Style/AccessModifierIndentation * [Rubocop][Style] Fix Style/EmptyMethod * [Rubocop][Style] Fix Style/UnlessElse * [Rubocop][Style] Fix Style/IndentationConsistency * [Rubocop][Style] Fix Style/NestedParenthesizedCalls * [Rubocop][Style] Fix Style/NegatedWhile * [Rubocop][Style] Fix Style/EmptyElse * [Rubocop][Style] Fix Style/ExtraSpacing * [Rubocop][Style] Fix Style/IfUnlessModifier * [Rubocop][Style] Fix Style/IndentHash * [Rubocop][Lint] Fix Lint/UselessAssignment * [Rubocop][Lint] Fix Lint/Loop * [Rubocop][Lint] Fix Lint/UselessAccessModifier * [Rubocop][Lint] Disable Lint/RescueException * [Rubocop][Lint] Fix Lint/IneffectiveAccessModifier * [Rubocop][Lint] Disable Lint/InheritException * [Rubocop][Performance] Disable Performance/RedundantMerge
1 parent 0d3cb4e commit 3895873

File tree

10 files changed

+1213
-1319
lines changed

10 files changed

+1213
-1319
lines changed

.rubocop.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Style/Documentation:
2+
Enabled: false
3+
Style/HashSyntax:
4+
Enabled: false # Disabled to support older ruby versions
5+
Style/MutableConstant:
6+
Enabled: false
7+
Style/FormatString:
8+
Enabled: false
9+
10+
Lint/RescueException:
11+
Enabled: false
12+
Lint/InheritException:
13+
Enabled: false
14+
15+
# TODO: Enable this and fix offenses
16+
Metrics:
17+
Enabled: false
18+
19+
AllCops:
20+
Include:
21+
- 'lib/**/*'
22+
Exclude:
23+
- 'Gemfile'
24+
- 'Rakefile'
25+
- 'mqtt.gemspec'
26+
- 'examples/**'
27+
- 'spec/**/*'

Rakefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,23 @@ end
1919
namespace :doc do
2020
YARD::Rake::YardocTask.new
2121

22-
desc "Generate HTML report specs"
22+
desc 'Generate HTML report specs'
2323
RSpec::Core::RakeTask.new("spec") do |spec|
2424
spec.rspec_opts = ["--format", "html", "-o", "doc/spec.html"]
2525
end
2626
end
2727

2828
task :test => :spec
2929
task :specs => :spec
30-
task :default => :spec
30+
31+
if Gem.ruby_version > Gem::Version.new('2.0')
32+
require 'rubocop/rake_task'
33+
34+
RuboCop::RakeTask.new do |task|
35+
task.options = ["-DS"]
36+
end
37+
38+
task :default => [:spec, :rubocop]
39+
else
40+
task :default => :spec
41+
end

lib/mqtt.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
end
1414

1515
module MQTT
16-
1716
# Default port number for unencrypted connections
1817
DEFAULT_PORT = 1883
1918

@@ -41,7 +40,6 @@ class NotConnectedException < MQTT::Exception
4140

4241
# MQTT-SN
4342
module SN
44-
4543
# Default port number for unencrypted connections
4644
DEFAULT_PORT = 1883
4745

@@ -50,6 +48,6 @@ module SN
5048
class ProtocolException < MQTT::Exception
5149
end
5250

53-
autoload :Packet, 'mqtt/sn/packet'
51+
autoload :Packet, 'mqtt/sn/packet'
5452
end
5553
end

0 commit comments

Comments
 (0)