troessner / reek

Code smell detector for Ruby
https://github.com/troessner/reek
MIT License
4k stars 279 forks source link

Add --exclude-smell CLI option #1751

Open willianveiga opened 7 months ago

willianveiga commented 7 months ago

Add exclude-smell CLI option:

Example without the new option:

$ reek app/controllers/users_controller.rb 
Inspecting 1 file(s):
S

app/controllers/users_controller.rb -- 6 warnings:
  [82, 82]:DuplicateMethodCall: UsersController#session_id calls 'params[:user_id]' 2 times [https://github.com/troessner/reek/blob/v6.1.4/docs/Duplicate-Method-Call.md]
  [72, 72]:DuplicateMethodCall: UsersController#email calls 'email_params[:p]' 2 times [https://github.com/troessner/reek/blob/v6.1.4/docs/Duplicate-Method-Call.md]
  [1]:IrresponsibleModule: UsersController has no descriptive comment [https://github.com/troessner/reek/blob/v6.1.4/docs/Irresponsible-Module.md]
  [82]:NilCheck: UsersController#session_id performs a nil-check [https://github.com/troessner/reek/blob/v6.1.4/docs/Nil-Check.md]
  [99]:NilCheck: UsersController#email_params performs a nil-check [https://github.com/troessner/reek/blob/v6.1.4/docs/Nil-Check.md]
  [1]:TooManyMethods: UsersController has at least 18 methods [https://github.com/troessner/reek/blob/v6.1.4/docs/Too-Many-Methods.md]

Example with the new option:

$ reek --exclude-smell IrresponsibleModule --exclude-smell DuplicateMethodCall app/controllers/users_controller.rb 
Inspecting 1 file(s):
S

app/controllers/users_controller.rb -- 3 warnings:
  [82]:NilCheck: UsersController#session_id performs a nil-check [https://github.com/troessner/reek/blob/v6.1.4/docs/Nil-Check.md]
  [99]:NilCheck: UsersController#email_params performs a nil-check [https://github.com/troessner/reek/blob/v6.1.4/docs/Nil-Check.md]
  [1]:TooManyMethods: UsersController has at least 18 methods [https://github.com/troessner/reek/blob/v6.1.4/docs/Too-Many-Methods.md]