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
33 changes: 33 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ inherit_from: .rubocop_todo.yml

require:
- ./lib/rubocop/cop/rouge/no_building_alternation_pattern_in_regexp.rb
- ./lib/rubocop/cop/rouge/no_huge_collections.rb

plugins:
- rubocop-performance
Expand All @@ -18,6 +19,9 @@ AllCops:
- "lib/rouge/lexers/**/builtins.rb"
NewCops: enable

Rouge:
Enabled: true

Style:
Enabled: false

Expand Down Expand Up @@ -76,12 +80,41 @@ Lint/IneffectiveAccessModifier:
Lint/AmbiguousOperatorPrecedence:
Enabled: false

# this just is plain broken, disabling
Lint/OutOfRangeRegexpRef:
Enabled: false

# there are actual reasons to do this
Lint/MissingSuper:
Enabled: false

# sometimes the arguments are deprecated you guys
Lint/ToEnumArguments:
Enabled: false

# sometimes we deal with very gnarly strings, this is not useful
Lint/NestedPercentLiteral:
Enabled: false

# usually not actionable
Lint/DuplicateBranch:
Enabled: false

Naming/BlockForwarding:
Enabled: false

Naming/PredicateMethod:
Enabled: false

Naming/MethodParameterName:
Enabled: false

Naming/HeredocDelimiterNaming:
Enabled: false

Naming/VariableNumber:
Enabled: false

Performance/RegexpMatch:
Enabled: false

Expand Down
157 changes: 23 additions & 134 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,115 +1,23 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 50`
# on 2026-02-27 15:13:26 UTC using RuboCop version 1.85.0.
# on 2026-03-20 18:54:21 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: 8
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/formatters/html_spec.rb'
- 'spec/lexer_spec.rb'
- 'spec/theme_spec.rb'

# Offense count: 38
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
Lint/DuplicateBranch:
Exclude:
- 'lib/rouge/cli.rb'
- 'lib/rouge/lexers/apache.rb'
- 'lib/rouge/lexers/apex.rb'
- 'lib/rouge/lexers/batchfile.rb'
- 'lib/rouge/lexers/brightscript.rb'
- 'lib/rouge/lexers/common_lisp.rb'
- 'lib/rouge/lexers/coq.rb'
- 'lib/rouge/lexers/css.rb'
- 'lib/rouge/lexers/cython.rb'
- 'lib/rouge/lexers/ecl.rb'
- 'lib/rouge/lexers/idlang.rb'
- 'lib/rouge/lexers/llvm.rb'
- 'lib/rouge/lexers/php.rb'
- 'lib/rouge/lexers/python.rb'
- 'lib/rouge/lexers/robot_framework.rb'
- 'lib/rouge/lexers/ruby.rb'
- 'lib/rouge/lexers/sas.rb'
- 'lib/rouge/lexers/sqf.rb'
- 'lib/rouge/lexers/stan.rb'
- 'lib/rouge/lexers/varnish.rb'
- 'lib/rouge/lexers/viml.rb'
- 'lib/rouge/lexers/yang.rb'

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

# Offense count: 27
# Configuration parameters: AllowedParentClasses.
Lint/MissingSuper:
Exclude:
- 'lib/rouge/cli.rb'
- 'lib/rouge/formatters/html_inline.rb'
- 'lib/rouge/formatters/html_legacy.rb'
- 'lib/rouge/formatters/html_line_highlighter.rb'
- 'lib/rouge/formatters/html_line_table.rb'
- 'lib/rouge/formatters/html_linewise.rb'
- 'lib/rouge/formatters/html_pygments.rb'
- 'lib/rouge/formatters/html_table.rb'
- 'lib/rouge/formatters/null.rb'
- 'lib/rouge/formatters/terminal256.rb'
- 'lib/rouge/formatters/tex.rb'
- 'lib/rouge/guesser.rb'
- 'lib/rouge/guessers/disambiguation.rb'
- 'lib/rouge/guessers/filename.rb'
- 'lib/rouge/guessers/glob_mapping.rb'
- 'lib/rouge/guessers/mimetype.rb'
- 'lib/rouge/guessers/modeline.rb'
- 'lib/rouge/guessers/source.rb'
- 'lib/rouge/regex_lexer.rb'
- 'lib/rouge/theme.rb'
- 'lib/rouge/util.rb'

# Offense count: 4
Lint/NestedPercentLiteral:
Exclude:
- 'lib/rouge/lexers/hylang.rb'
- 'lib/rouge/lexers/janet.rb'
- 'lib/rouge/lexers/powershell.rb'
- 'spec/lexers/j_spec.rb'

# Offense count: 1
Lint/OutOfRangeRegexpRef:
Exclude:
- 'lib/rouge/tex_theme_renderer.rb'

# Offense count: 1
Lint/ToEnumArguments:
Exclude:
- 'lib/rouge/lexer.rb'

# Offense count: 43
Naming/ConstantName:
Exclude:
- 'lib/rouge/lexers/eiffel.rb'
- 'lib/rouge/themes/gruvbox.rb'

# Offense count: 8
# Configuration parameters: ForbiddenDelimiters.
# 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
# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
Expand All @@ -120,7 +28,6 @@ Naming/MemoizedInstanceVariableName:
- 'lib/rouge/lexers/hack.rb'
- 'lib/rouge/lexers/python.rb'
- 'lib/rouge/lexers/verilog.rb'
- 'lib/rouge/lexers/yang.rb'

# Offense count: 16
# Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
Expand All @@ -131,35 +38,6 @@ Naming/MethodName:
- 'lib/rouge/lexers/igorpro.rb'
- 'lib/rouge/lexers/xpath.rb'

# Offense count: 68
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'lib/rouge.rb'
- 'lib/rouge/cli.rb'
- 'lib/rouge/formatter.rb'
- 'lib/rouge/formatters/html.rb'
- 'lib/rouge/formatters/html_legacy.rb'
- 'lib/rouge/formatters/html_line_table.rb'
- 'lib/rouge/formatters/html_linewise.rb'
- 'lib/rouge/formatters/html_pygments.rb'
- 'lib/rouge/formatters/html_table.rb'
- 'lib/rouge/formatters/null.rb'
- 'lib/rouge/formatters/terminal256.rb'
- 'lib/rouge/formatters/tex.rb'
- 'lib/rouge/guessers/disambiguation.rb'
- 'lib/rouge/lexer.rb'
- 'lib/rouge/lexers/coq.rb'
- 'lib/rouge/lexers/escape.rb'
- 'lib/rouge/lexers/plain_text.rb'
- 'lib/rouge/regex_lexer.rb'
- 'lib/rouge/tex_theme_renderer.rb'
- 'lib/rouge/theme.rb'
- 'lib/rouge/token.rb'
- 'lib/rouge/util.rb'
- 'spec/support/lexing.rb'

# Offense count: 40
# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
# SupportedStyles: snake_case, camelCase
Expand All @@ -172,15 +50,6 @@ Naming/VariableName:
- 'lib/rouge/lexers/kotlin.rb'
- 'lib/rouge/lexers/xpath.rb'

# Offense count: 5
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# 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/StringInclude:
Expand Down Expand Up @@ -230,3 +99,23 @@ Rouge/NoBuildingAlternationPatternInRegexp:
- 'lib/rouge/lexers/vala.rb'
- 'lib/rouge/lexers/wollok.rb'
- 'lib/rouge/lexers/xojo.rb'

# Offense count: 20
Rouge/NoHugeCollections:
Exclude:
- 'lib/rouge/lexers/apple_script.rb'
- 'lib/rouge/lexers/cobol.rb'
- 'lib/rouge/lexers/common_lisp.rb'
- 'lib/rouge/lexers/css.rb'
- 'lib/rouge/lexers/datastudio.rb'
- 'lib/rouge/lexers/freefem.rb'
- 'lib/rouge/lexers/hql.rb'
- 'lib/rouge/lexers/idlang.rb'
- 'lib/rouge/lexers/igorpro.rb'
- 'lib/rouge/lexers/janet.rb'
- 'lib/rouge/lexers/openedge.rb'
- 'lib/rouge/lexers/plsql.rb'
- 'lib/rouge/lexers/racket.rb'
- 'lib/rouge/lexers/sas.rb'
- 'lib/rouge/lexers/sql.rb'
- 'lib/rouge/lexers/stata.rb'
4 changes: 1 addition & 3 deletions lib/rouge/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,7 @@ def run
out = []
argv.each do |arg|
case arg
when /^(--\w+)=(.*)$/
out << $1 << $2
when /^(-\w)(.+)$/
when /^(--\w+)=(.*)$/, /^(-\w)(.+)$/
out << $1 << $2
else
out << arg
Expand Down
32 changes: 28 additions & 4 deletions lib/rouge/demos/abap
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
lo_obj ?= lo_obj->do_nothing( 'Char' && ` String` ).
DATA(lo_obj) = new zcl_obj_factory(
EXPORTING
input = |some nice string|
)
DATA(lo_subobj) ?= lo_obj->do_nothing( 'Char' && ` String` ).

SELECT SINGLE * FROM mara INTO ls_mara WHERE matkl EQ '1324'.
LOOP AT lt_mara ASSIGNING <mara>.
CHECK <mara>-mtart EQ '0001'.
SELECT SINGLE matnr, matkl, mtart, maktx
FROM mara
INNER JOIN makt
ON makt~matnr EQ mara~matnr
INTO @data(ls_mara)
WHERE matkl EQ '1324'
AND spras EQ @sy-langu.

LOOP AT lt_mara ASSIGNING FIELD-SYMBOL(<mara>).
CHECK <mara>-mtart = '0001'.
ENDLOOP.

CALL FUNCTION 'DO_NOTHING'
EXPORTING
input = 'input'
IMPORTING
output = 'output'
CHANGING
to_change = lv_some_variable
TABLES
table_to_change = lt_some_table
EXCEPTIONS
ERROR = 1
OTHERS = 2.
Loading