Skip to content

Commit

Permalink
Upgrade rubocop and fix newly broken styles
Browse files Browse the repository at this point in the history
Also removed no longer used faraday gems.
  • Loading branch information
mikeastock committed Nov 18, 2017
1 parent 178675e commit a2bc522
Show file tree
Hide file tree
Showing 12 changed files with 519 additions and 502 deletions.
111 changes: 58 additions & 53 deletions .rubocop.yml
@@ -1,10 +1,8 @@
AllCops:
TargetRubyVersion: 2.4
Exclude:
- db/schema.rb
- vendor/**/*

Style/AccessorMethodName:
Naming/AccessorMethodName:
Description: Check the naming of accessor methods for get_/set_.
Enabled: false

Expand All @@ -23,7 +21,7 @@ Style/AsciiComments:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
Enabled: false

Style/AsciiIdentifiers:
Naming/AsciiIdentifiers:
Description: 'Use only ascii symbols in identifiers.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
Enabled: false
Expand All @@ -50,7 +48,7 @@ Style/CharacterLiteral:

Style/ClassAndModuleChildren:
Description: 'Checks style of children classes and modules.'
Enabled: false
Enabled: true
EnforcedStyle: nested

Metrics/ClassLength:
Expand Down Expand Up @@ -92,6 +90,13 @@ Metrics/AbcSize:
branches, and conditions.
Enabled: false

Metrics/BlockLength:
CountComments: true # count full line comments?
Max: 25
ExcludedMethods: []
Exclude:
- "spec/**/*"

Metrics/CyclomaticComplexity:
Description: >-
A complexity metric that is strongly correlated to the number
Expand All @@ -111,11 +116,6 @@ Style/Documentation:
Description: 'Document classes and non-namespace modules.'
Enabled: false

Style/DotPosition:
Description: 'Checks the position of the dot in multi-line method calls.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
EnforcedStyle: leading

Style/DoubleNegation:
Description: 'Checks for uses of double negation (!!).'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
Expand All @@ -141,11 +141,7 @@ Style/EvenOdd:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
Enabled: false

Style/ExtraSpacing:
Description: 'Do not use unnecessary spacing.'
Enabled: true

Style/FileName:
Naming/FileName:
Description: 'Use snake_case for source file names.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
Enabled: false
Expand Down Expand Up @@ -209,10 +205,17 @@ Style/LineEndConcatenation:
line end.
Enabled: false

Style/SymbolArray:
Enabled: true
EnforcedStyle: brackets

Style/DateTime:
Enabled: false

Metrics/LineLength:
Description: 'Limit lines to 150 characters.'
Description: 'Limit lines to 120 characters.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
Max: 150
Max: 120

Metrics/MethodLength:
Description: 'Avoid methods longer than 10 lines of code.'
Expand All @@ -224,25 +227,11 @@ Style/ModuleFunction:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
Enabled: false

Style/MultilineOperationIndentation:
Description: >-
Checks indentation of binary operations that span more than
one line.
Enabled: true
EnforcedStyle: indented

Style/MultilineBlockChain:
Description: 'Avoid multi-line chains of blocks.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
Enabled: false

Style/MultilineMethodCallIndentation:
Description: >-
Checks indentation of method calls with the dot operator
that span more than one line.
Enabled: true
EnforcedStyle: indented

Style/NegatedIf:
Description: >-
Favor unless over if for negative conditions
Expand Down Expand Up @@ -284,7 +273,7 @@ Style/OneLineConditional:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
Enabled: false

Style/OpMethod:
Naming/BinaryOperatorParameterName:
Description: 'When defining binary operators, name the argument other.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
Enabled: false
Expand All @@ -304,7 +293,7 @@ Style/PerlBackrefs:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
Enabled: false

Style/PredicateName:
Naming/PredicateName:
Description: 'Check the names of predicate methods.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
NamePrefixBlacklist:
Expand Down Expand Up @@ -342,7 +331,7 @@ Style/SingleLineBlockParams:
Style/SingleLineMethods:
Description: 'Avoid single-line methods.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
Enabled: true
Enabled: false

Style/SignalException:
Description: 'Checks for proper usage of fail and raise.'
Expand All @@ -364,7 +353,7 @@ Style/TrailingCommaInArguments:
Description: 'Checks for trailing comma in argument lists.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
EnforcedStyleForMultiline: comma
SupportedStyles:
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
Expand All @@ -374,7 +363,7 @@ Style/TrailingCommaInLiteral:
Description: 'Checks for trailing comma in array and hash literals.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
EnforcedStyleForMultiline: comma
SupportedStyles:
SupportedStylesForMultiline:
- comma
- consistent_comma
- no_comma
Expand Down Expand Up @@ -409,9 +398,40 @@ Style/WordArray:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
Enabled: false

Style/AlignParameters:
EnforcedStyle: with_fixed_indentation
# Layout

Layout/AlignParameters:
Description: 'Here we check if the parameters on a multi-line method call or definition are aligned.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
Enabled: false

Layout/DotPosition:
Description: 'Checks the position of the dot in multi-line method calls.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
EnforcedStyle: trailing

Layout/ExtraSpacing:
Description: 'Do not use unnecessary spacing.'
Enabled: true

Layout/MultilineOperationIndentation:
Description: >-
Checks indentation of binary operations that span more than
one line.
Enabled: true
EnforcedStyle: indented

Layout/MultilineMethodCallIndentation:
Description: >-
Checks indentation of method calls with the dot operator
that span more than one line.
Enabled: true
EnforcedStyle: indented

Layout/InitialIndentation:
Description: >-
Checks the indentation of the first non-blank non-comment line in a file.
Enabled: false

# Lint

Expand Down Expand Up @@ -469,21 +489,6 @@ Lint/HandleExceptions:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
Enabled: false

Lint/InvalidCharacterLiteral:
Description: >-
Checks for invalid character literals with a non-escaped
whitespace character.
Enabled: false

Style/InitialIndentation:
Description: >-
Checks the indentation of the first non-blank non-comment line in a file.
Enabled: false

Lint/LiteralInCondition:
Description: 'Checks of literals used in conditions.'
Enabled: false

Lint/LiteralInInterpolation:
Description: 'Checks for literals used in interpolation.'
Enabled: false
Expand Down
7 changes: 3 additions & 4 deletions feedjira.gemspec
@@ -1,4 +1,5 @@
# -*- encoding: utf-8 -*-

require File.expand_path("../lib/feedjira/version", __FILE__)

Gem::Specification.new do |s|
Expand All @@ -17,15 +18,13 @@ Gem::Specification.new do |s|

s.required_ruby_version = ">=1.9.3"

s.add_dependency "faraday", ">= 0.9"
s.add_dependency "faraday_middleware", ">= 0.9"
s.add_dependency "loofah", ">= 2.0"
s.add_dependency "sax-machine", ">= 1.0"

s.add_development_dependency "danger"
s.add_development_dependency "danger-commit_lint"
s.add_development_dependency "rspec"
s.add_development_dependency "rubocop", "0.46"
s.add_development_dependency "rubocop"
s.add_development_dependency "vcr"
s.add_development_dependency "yard", "~> 0.9"
s.add_development_dependency "yard"
end
2 changes: 0 additions & 2 deletions lib/feedjira.rb
@@ -1,6 +1,4 @@
require "zlib"
require "faraday"
require "faraday_middleware"
require "sax-machine"
require "loofah"
require "logger"
Expand Down
5 changes: 4 additions & 1 deletion lib/feedjira/parser.rb
@@ -1 +1,4 @@
module Feedjira::Parser; end # rubocop:disable Style/Documentation
module Feedjira
module Parser
end
end
2 changes: 1 addition & 1 deletion spec/feedjira/parser/atom_feed_burner_entry_spec.rb
Expand Up @@ -17,7 +17,7 @@
it "should be able to fetch a url via the 'alternate' rel if no origLink exists" do # rubocop:disable Metrics/LineLength
xml = File.read("#{File.dirname(__FILE__)}/../../sample_feeds/PaulDixExplainsNothingAlternate.xml") # rubocop:disable Metrics/LineLength
entry = Feedjira::Parser::AtomFeedBurner.parse(xml).entries.first
expect(entry.url).to eq "http://feeds.feedburner.com/~r/PaulDixExplainsNothing/~3/519925023/making-a-ruby-c-library-even-faster.html"
expect(entry.url).to eq("http://feeds.feedburner.com/~r/PaulDixExplainsNothing/~3/519925023/making-a-ruby-c-library-even-faster.html") # rubocop:disable Metrics/LineLength
end

it "should parse the url" do
Expand Down

0 comments on commit a2bc522

Please sign in to comment.