-
Notifications
You must be signed in to change notification settings - Fork 283
Description
This is something I've been thinking about for some time.
There have been quite a few long-standing issues in the tracker that are not about Reek's core functionality. These have to do with configuration, the todo file, and the inability to make Reek process files that do not end in .rb.
- Configuration-related issues: directories in config relative to cwd, not to configuration file itself. #1486, Directory configurations changed incompatibly in v5.4.0 #1482, Reek config inheritance #1434, Inherit reek config from a gem #1430, Piping source ignores
excluded_pathsconfiguration #1429, Use XDG standard for finding config files? #1417, Reek does not handle relative paths from config file #1283, and Clean up config handling #667. - Inspecting files with different names: Include .thor files #1485, Somehow let Reek examine ruby files that don't have the .rb extension #721.
- Creating to do items: A strategy for making our --todo feature more useful #1411.
- Other: Piping source ignores
excluded_pathsconfiguration #1429, Validate the data types given to our basic and custom configuration options via source code comment #1145, Add reporting of unneeded inline suppressions #961.
In addition, there are quite a few different strategies being used for finding smelly code and we do not have one preferred way.
The rubocop project has done all the work of creating a working config file system with all the features our users have been asking for, a great to do file generation system, and an unneeded suppression detector. In addition, it has a nice system for matching s-expressions with certain patterns, as I mentioned before.
I would like to propose re-using some or all of these features for Reek. This would involve something like:
- Depend on rubocop
- Re-use rubocop's configuration loading code to read
.reek.yml. This would mean adopting rubocop's file format - Eventually port our code smell detectors to use rubocop's node matchers
- Perhaps port our detectors to be rubocop cops, so they can hook into the unneeded suppression cop system
A more extreme option would be to transform reek into a rubocop plugin (i.e., rubocop-reek), and keep the reek executable as a thin layer over that, just to load the correct configuration.