diff options
| -rw-r--r-- | .rubocop.yml | 96 | ||||
| -rw-r--r-- | asciidoctor-pdf.gemspec | 1 | ||||
| -rw-r--r-- | tasks/rubocop.rake | 12 |
3 files changed, 109 insertions, 0 deletions
diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..54c2676e --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,96 @@ +AllCops: + TargetRubyVersion: 2.3 +Layout/SpaceInsideBlockBraces: + SpaceBeforeBlockParameters: false +Layout/AlignArguments: + EnforcedStyle: with_fixed_indentation + IndentationWidth: 4 +Layout/AlignParameters: + EnforcedStyle: with_fixed_indentation + IndentationWidth: 4 +Layout/IndentFirstArgument: + Enabled: false +Layout/LeadingCommentSpace: + Enabled: false +Layout/MultilineOperationIndentation: + EnforcedStyle: indented +Layout/RescueEnsureAlignment: + Enabled: false +Lint/AmbiguousBlockAssociation: + Enabled: false +Lint/ParenthesesAsGroupedExpression: + Enabled: false +Metrics/AbcSize: + Enabled: false +Metrics/BlockLength: + Enabled: false +Metrics/BlockNesting: + Max: 4 +Metrics/ClassLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/LineLength: + Enabled: false +# Max: 120 +Metrics/MethodLength: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false +Naming/ConstantName: + Enabled: false +Naming/FileName: + Enabled: false +Naming/PredicateName: + NameWhitelist: + - has_yaml_header? + - has_front_matter? +Style/CaseEquality: + Enabled: false +Style/CharacterLiteral: + Enabled: false +Style/ConditionalAssignment: + EnforcedStyle: assign_inside_condition + IncludeTernaryExpressions: false +Style/Documentation: + Enabled: false # FIXME reenable me +Style/DoubleNegation: + Enabled: false +Style/FrozenStringLiteralComment: + Enabled: false +Style/GuardClause: + Enabled: false +Style/HashSyntax: + EnforcedStyle: ruby19_no_mixed_keys +Style/MethodDefParentheses: + EnforcedStyle: require_no_parentheses +Style/MutableConstant: + Enabled: false +Style/MultilineIfModifier: + Enabled: false +Style/MultilineTernaryOperator: + Enabled: false +Style/NestedTernaryOperator: + Enabled: false +Style/NumericPredicate: + EnforcedStyle: comparison +Style/PercentLiteralDelimiters: + PreferredDelimiters: + default: () + '%w': () + '%r': // +Style/PerlBackrefs: + Enabled: false +Style/RescueStandardError: + EnforcedStyle: implicit +Style/SpecialGlobalVars: + EnforcedStyle: use_perl_names +Style/SymbolArray: + EnforcedStyle: brackets +# I'd like to enable this one, but rubocop gets confused +Style/TernaryParentheses: + Enabled: false +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: consistent_comma +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: consistent_comma diff --git a/asciidoctor-pdf.gemspec b/asciidoctor-pdf.gemspec index 1cd0238f..7c7f498f 100644 --- a/asciidoctor-pdf.gemspec +++ b/asciidoctor-pdf.gemspec @@ -52,6 +52,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'pdf-inspector', '~> 1.3.0' # Asciidoctor PDF supports Rouge >= 2 (verified in CI build using 2.0.0) s.add_development_dependency 'rouge', '~> 3.11.0' + s.add_development_dependency 'rubocop', '~> 0.74.0' s.add_development_dependency 'coderay', '~> 1.1.0' s.add_development_dependency 'chunky_png', '~> 1.3.0' end diff --git a/tasks/rubocop.rake b/tasks/rubocop.rake new file mode 100644 index 00000000..d2b06720 --- /dev/null +++ b/tasks/rubocop.rake @@ -0,0 +1,12 @@ +begin + require 'rubocop/rake_task' + RuboCop::RakeTask.new :lint do |t| + t.patterns = ['Rakefile', 'tasks/*.rake', 'lib/**/*.rb', 'spec/**/*.rb'] + end +rescue LoadError => e + task :lint do + raise 'Failed to load lint task. +Install required gems using: bundle --path=.bundle/gems +Then, invoke Rake using: bundle exec rake', cause: e + end +end |
