Dmytro Shteflyuk created THRIFT-5940:
----------------------------------------
Summary: Ruby generator should emit RuboCop-compliant code and SCA
should lint generated Ruby
Key: THRIFT-5940
URL: https://issues.apache.org/jira/browse/THRIFT-5940
Project: Thrift
Issue Type: New Feature
Components: Ruby - Compiler
Reporter: Dmytro Shteflyuk
h3. Problem
The Ruby SCA workflow currently runs RuboCop without regenerating Ruby output
first, so CI does not reliably lint freshly generated {code}gen-rb{code} files.
As a result, changes in the Ruby generator can introduce RuboCop violations
without the RuboCop job in {code}.github/workflows/sca.yml{code} catching them.
h3. Reproduction
# Rebuild {code}compiler/cpp{code}
# Regenerate Ruby output for {code}test/rb{code}, {code}tutorial/rb{code}, and
{code}lib/rb{code}
# Run RuboCop with the repository configuration
After regeneration, RuboCop inspected more files and reported offenses in
generated Ruby output.
h3. Actual Result
Generated Ruby code can violate the current RuboCop rules, and the existing SCA
workflow does not always catch that because it does not first regenerate the
Ruby artifacts that should be linted.
Observed generator issues included:
* extra blank lines around top-level generated blocks
* {code}message=nil{code} instead of {code}message = nil{code}
* trailing whitespace in generated service inheritance lines
* enum constant rendering with incorrect indentation
* blank RDoc lines emitted as {code}# {code} instead of {code}#{code}
h3. Expected Result
Generated Ruby code should be RuboCop-compliant as emitted by the generator
itself, and the SCA workflow should lint freshly generated Ruby output rather
than stale checked-in artifacts alone.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)