How blooper05/danger-reek works
Main Components
a. Danger Integration:
• This component represents Danger and its ecosystem, where the plugin is executed during a CI build (as indicated by the Travis CI configuration and Danger integration in the README).
b. Plugin Core (danger-reek):
• This includes the main files in the lib directory (e.g., danger_plugin.rb, danger_reek.rb, and submodules under lib/reek) that encapsulate the plugin’s logic.
c. Reek Linter:
d. Testing and Development Tools:
• Test specifications in the spec directory and guard for automated testing; these support the development and verification of the plugin.
Relationships and Interactions
• The Danger platform triggers the plugin (via methods like lint) during the pull request process.
• The plugin core, when invoked, calls the Reek linter to analyze modified or added Ruby files.
• Results from Reek are then processed by the plugin, which uses Danger’s inline commenting mechanism to mark any issues.
• Testing components (spec, Guardfile) are used by developers to validate that the integration behaves as expected before merging into production.
Architectural Pattern and Design Principles
• Modular Design: The structure in the lib directory suggests a separation of concerns; core plugin logic is encapsulated separately from versioning or external service interaction.
• Plugin Pattern: danger-reek extends the functionality of Danger by “plugging in” extra behavior (linting).
• Integration with External Services: The plugin relies on external tools like Reek for linting and potentially other CI/CD services (TravisCI, Dependabot) for build and dependency management.
Detail the Interactions
• Start at the Danger CI environment: show that when a new pull request is processed, Danger invokes the danger-reek plugin.
• That the plugin’s lint method takes care of identifying which files are modified or added (as noted in the README), then calls Reek to analyze these files.
• That any issues found by Reek are captured and then sent back to Danger to be displayed inline – making the plugin a mediator between code quality tools and CI feedback mechanisms.