Bird
0
0

What is wrong with this Rubocop command?

medium📝 Debug Q7 of 15
Ruby - Ecosystem and Best Practices

What is wrong with this Rubocop command?

rubocop --format json --out report.txt
AThe --format option is invalid
BCommand is correct and will run successfully
CMissing the --config option
DOutput file extension should be .json, not .txt
Step-by-Step Solution
Solution:
  1. Step 1: Understand format and output options

    The --format json option outputs JSON data, so the output file should have a .json extension.
  2. Step 2: Check command validity

    The command syntax is valid, but saving JSON output to a .txt file is misleading and may cause confusion.
  3. Final Answer:

    Output file extension should be .json, not .txt -> Option D
  4. Quick Check:

    Match output file extension to format [OK]
Quick Trick: Match --format with output file extension [OK]
Common Mistakes:
  • Ignoring file extension mismatch
  • Thinking --format json is invalid
  • Assuming --config is always required

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes