Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
inherit_from: .rubocop_todo.yml

plugins:
- rubocop-performance
- rubocop-minitest
- rubocop-rake

AllCops:
TargetRubyVersion: 3.0
DisplayCopNames: true
Exclude:
- "tasks/**/*"
- "vendor/**/*"
- "lib/rouge/lexers/**/keywords.rb"
- "lib/rouge/lexers/**/builtins.rb"
NewCops: enable

Style:
Enabled: false
Expand Down Expand Up @@ -39,3 +47,15 @@ Lint/RedundantSplatExpansion:

Lint/IneffectiveAccessModifier:
Enabled: false

Lint/AmbiguousOperatorPrecedence:
Enabled: false

Naming/BlockForwarding:
Enabled: false

Performance/RegexpMatch:
Enabled: false

Performance/ConstantRegexp:
Enabled: false
158 changes: 124 additions & 34 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-01-26 19:45:20 UTC using RuboCop version 1.11.0.
# on 2026-02-13 03:42:44 UTC using RuboCop version 1.84.2.
# 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
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'rouge.gemspec'

# Offense count: 8
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Expand All @@ -22,15 +15,27 @@ Lint/ConstantDefinitionInBlock:
- 'spec/lexer_spec.rb'
- 'spec/theme_spec.rb'

# Offense count: 27
Lint/MissingSuper:
# Offense count: 37
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
Lint/DuplicateBranch:
Enabled: false

# Offense count: 2
Lint/MixedRegexpCaptureTypes:
# Offense count: 149
# This cop supports safe autocorrection (--autocorrect).
Lint/DuplicateSetElement:
Enabled: false

# Offense count: 3
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'lib/rouge/lexers/elixir.rb'
- 'lib/rouge/lexers/lasso.rb'
- 'lib/rouge/lexers/nix.rb'
- 'spec/lexers/terraform_spec.rb'

# Offense count: 27
# Configuration parameters: AllowedParentClasses.
Lint/MissingSuper:
Enabled: false

# Offense count: 4
Lint/NestedPercentLiteral:
Expand All @@ -41,27 +46,32 @@ Lint/NestedPercentLiteral:
- 'spec/lexers/j_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Lint/NonDeterministicRequireOrder:
Lint/OutOfRangeRegexpRef:
Exclude:
- 'lib/rouge/tex_theme_renderer.rb'

# Offense count: 1
Lint/SharedMutableDefault:
Exclude:
- 'spec/spec_helper.rb'
- 'lib/rouge/lexers/j.rb'

# Offense count: 1
Lint/OutOfRangeRegexpRef:
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: strict, consistent
Lint/SymbolConversion:
Exclude:
- 'lib/rouge/tex_theme_renderer.rb'
- 'lib/rouge/lexers/postscript.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
Lint/UselessAccessModifier:
# Offense count: 1
Lint/ToEnumArguments:
Exclude:
- 'lib/rouge/cli.rb'
- 'lib/rouge/lexer.rb'

# Offense count: 1
Naming/AccessorMethodName:
Lint/UselessConstantScoping:
Exclude:
- 'lib/rouge/theme.rb'
- 'lib/rouge/formatters/terminal256.rb'

# Offense count: 43
Naming/ConstantName:
Expand All @@ -70,7 +80,7 @@ Naming/ConstantName:
- 'lib/rouge/themes/gruvbox.rb'

# Offense count: 21
# Cop supports --auto-correct.
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: lowercase, uppercase
Naming/HeredocDelimiterCase:
Expand All @@ -86,15 +96,18 @@ Naming/HeredocDelimiterCase:
- 'spec/theme_spec.rb'
- 'spec/visual_spec.rb'

# Offense count: 4
# Offense count: 8
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'lib/rouge/tex_theme_renderer.rb'
- 'spec/lexers/mason_spec.rb'
- 'spec/lexers/matlab_spec.rb'
- 'spec/lexers/swift_spec.rb'

# Offense count: 8
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
Naming/MemoizedInstanceVariableName:
Expand All @@ -107,21 +120,33 @@ Naming/MemoizedInstanceVariableName:
- 'lib/rouge/lexers/yang.rb'

# Offense count: 16
# Configuration parameters: EnforcedStyle, IgnoredPatterns.
# Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
# SupportedStyles: snake_case, camelCase
# ForbiddenIdentifiers: __id__, __send__
Naming/MethodName:
Exclude:
- 'lib/rouge/lexers/igorpro.rb'
- 'lib/rouge/lexers/xpath.rb'

# Offense count: 68
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Enabled: false

# Offense count: 4
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
# AllowedMethods: call
# WaywardPredicates: infinite?, nonzero?
Naming/PredicateMethod:
Exclude:
- 'lib/rouge/guessers/util.rb'
- 'lib/rouge/lexers/javascript.rb'
- 'lib/rouge/regex_lexer.rb'
- 'spec/visual/app.rb'

# Offense count: 40
# Configuration parameters: EnforcedStyle, AllowedIdentifiers.
# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
# SupportedStyles: snake_case, camelCase
Naming/VariableName:
Exclude:
Expand All @@ -133,10 +158,75 @@ Naming/VariableName:
- 'lib/rouge/lexers/xpath.rb'

# Offense count: 5
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
Naming/VariableNumber:
Exclude:
- 'lib/rouge/lexers/c.rb'
- 'lib/rouge/themes/gruvbox.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Performance/MapCompact:
Exclude:
- 'lib/rouge/guessers/glob_mapping.rb'
- 'lib/rouge/guessers/modeline.rb'

# Offense count: 1
Performance/MapMethodChain:
Exclude:
- 'lib/rouge/regex_lexer.rb'

# Offense count: 7
Performance/MethodObjectAsBlock:
Exclude:
- 'lib/rouge/cli.rb'
- 'lib/rouge/formatters/tex.rb'
- 'lib/rouge/lexers/console.rb'
- 'spec/visual/app.rb'

# Offense count: 10
# This cop supports safe autocorrection (--autocorrect).
Performance/RedundantBlockCall:
Exclude:
- 'lib/rouge/guesser.rb'
- 'lib/rouge/lexer.rb'
- 'lib/rouge/regex_lexer.rb'
- 'lib/rouge/token.rb'
- 'lib/rouge/util.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Performance/RedundantSplitRegexpArgument:
Exclude:
- 'lib/rouge/guessers/modeline.rb'

# Offense count: 12
# This cop supports unsafe autocorrection (--autocorrect-all).
Performance/StringInclude:
Exclude:
- 'lib/rouge/cli.rb'
- 'lib/rouge/lexers/hack.rb'
- 'lib/rouge/lexers/igorpro.rb'
- 'lib/rouge/lexers/lua.rb'
- 'lib/rouge/lexers/moonscript.rb'
- 'spec/formatters/html_pygments_spec.rb'
- 'spec/lexers/escape_spec.rb'
- 'spec/theme_spec.rb'

# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
Performance/UnfreezeString:
Exclude:
- 'lib/rouge/cli.rb'
- 'lib/rouge/formatter.rb'
- 'lib/rouge/formatters/terminal_truecolor.rb'
- 'lib/rouge/tex_theme_renderer.rb'
- 'spec/lexers_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Rake/Desc:
Exclude:
- 'Rakefile'
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ group :development do
gem 'git'
gem 'yard'

gem 'rubocop', '~> 1.0', '<= 1.11'
gem 'rubocop'
gem 'rubocop-performance'
gem 'rubocop-minitest'
gem 'rubocop-rake'

# docs
gem 'github-markup'
Expand Down