0
0
Rubyprogramming~10 mins

Rubocop for linting in Ruby - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to run Rubocop on a Ruby file named example.rb.

Ruby
rubocop [1]
Drag options to blanks, or click blank then click option'
Aexample.rb
B--fix
C--version
D--help
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like --fix or --version instead of the file name.
Not specifying any file to check.
2fill in blank
medium

Complete the command to automatically fix offenses in script.rb using Rubocop.

Ruby
rubocop [1] script.rb
Drag options to blanks, or click blank then click option'
A--fix
B--auto-correct
C--version
D--help
Attempts:
3 left
💡 Hint
Common Mistakes
Using --fix which is not a valid Rubocop option.
Using --version or --help which do not fix code.
3fill in blank
hard

Fix the error in the Rubocop command to check all Ruby files in the current directory.

Ruby
rubocop [1]
Drag options to blanks, or click blank then click option'
A*.rb
B*.py
Call.rb
Drubyfiles
Attempts:
3 left
💡 Hint
Common Mistakes
Using file extensions for other languages like .py.
Using incorrect file names or folder names.
4fill in blank
hard

Fill both blanks to create a Rubocop configuration file that disables the Style/StringLiterals cop.

Ruby
Style/StringLiterals:
  Enabled: [1]
  EnforcedStyle: [2]
Drag options to blanks, or click blank then click option'
Afalse
Btrue
Cdouble_quotes
Dsingle_quotes
Attempts:
3 left
💡 Hint
Common Mistakes
Setting Enabled to true when wanting to disable.
Confusing quote styles.
5fill in blank
hard

Fill all three blanks to write a Rubocop command that checks app.rb, shows only offenses with severity 'error', and uses color output.

Ruby
rubocop [1] app.rb --severity [2] --[3]
Drag options to blanks, or click blank then click option'
A--only
Berror
Ccolor
D--auto-correct
Attempts:
3 left
💡 Hint
Common Mistakes
Using --auto-correct instead of --color for colored output.
Not specifying severity correctly.