From 85961be02e22b34c134817b12e3c1d4c92e913d4 Mon Sep 17 00:00:00 2001 From: dwelch-r7 Date: Tue, 25 May 2021 13:25:34 +0100 Subject: [PATCH] Ran rubocop and tidied up --- .rubocop.yml | 5 +++-- ...e_effects_in_notes.rb => module_side_effects_in_notes.rb} | 2 -- ...in_notes_spec.rb => module_side_effects_in_notes_spec.rb} | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) rename lib/rubocop/cop/lint/{side_effects_in_notes.rb => module_side_effects_in_notes.rb} (99%) rename spec/rubocop/cop/lint/{side_effects_in_notes_spec.rb => module_side_effects_in_notes_spec.rb} (98%) diff --git a/.rubocop.yml b/.rubocop.yml index a8fa7e3b76..4caa34f072 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -20,7 +20,7 @@ require: - ./lib/rubocop/cop/lint/module_disclosure_date_format.rb - ./lib/rubocop/cop/lint/module_disclosure_date_present.rb - ./lib/rubocop/cop/lint/deprecated_gem_version.rb - - ./lib/rubocop/cop/lint/side_effects_in_notes.rb + - ./lib/rubocop/cop/lint/module_side_effects_in_notes.rb Layout/SpaceBeforeBrackets: Description: >- @@ -161,8 +161,9 @@ Lint/ModuleDisclosureDatePresent: Lint/SideEffectsInNotes: Include: - # Only exploits require disclosure dates, but they can be present in auxiliary modules etc. + # Only exploits and auxiliary modules require SideEffects to be listed. - 'modules/exploits/**/*' + - 'modules/auxiliary/**/*' Lint/DeprecatedGemVersion: Enabled: true diff --git a/lib/rubocop/cop/lint/side_effects_in_notes.rb b/lib/rubocop/cop/lint/module_side_effects_in_notes.rb similarity index 99% rename from lib/rubocop/cop/lint/side_effects_in_notes.rb rename to lib/rubocop/cop/lint/module_side_effects_in_notes.rb index b01f341fca..c4269a64a9 100644 --- a/lib/rubocop/cop/lint/side_effects_in_notes.rb +++ b/lib/rubocop/cop/lint/module_side_effects_in_notes.rb @@ -8,7 +8,6 @@ module RuboCop NO_NOTES_MSG = 'Module is missing the Notes section which must include SideEffects - https://github.com/rapid7/metasploit-framework/wiki/Definition-of-Module-Reliability,-Side-Effects,-and-Stability' NO_SIDE_EFFECTS_MSG = 'Module is missing SideEffects from the Notes section - https://github.com/rapid7/metasploit-framework/wiki/Definition-of-Module-Reliability,-Side-Effects,-and-Stability' - def_node_matcher :find_update_info_node, <<~PATTERN (def :initialize _args (begin (super $(send nil? {:update_info :merge_info} (lvar :info) (hash ...))) ...)) PATTERN @@ -45,7 +44,6 @@ module RuboCop def check_for_side_effects(notes) last_key = nil side_effects_present = false - p notes notes.each_pair do |key, _value| if key.value == 'SideEffects' side_effects_present = true diff --git a/spec/rubocop/cop/lint/side_effects_in_notes_spec.rb b/spec/rubocop/cop/lint/module_side_effects_in_notes_spec.rb similarity index 98% rename from spec/rubocop/cop/lint/side_effects_in_notes_spec.rb rename to spec/rubocop/cop/lint/module_side_effects_in_notes_spec.rb index 45c522f56a..3cca3bd5c5 100644 --- a/spec/rubocop/cop/lint/side_effects_in_notes_spec.rb +++ b/spec/rubocop/cop/lint/module_side_effects_in_notes_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -require 'rubocop/cop/lint/side_effects_in_notes' +require 'rubocop/cop/lint/module_side_effects_in_notes' RSpec.describe RuboCop::Cop::Lint::SideEffectsInNotes do subject(:cop) { described_class.new(config) }