Ran rubocop and tidied up
This commit is contained in:
parent
34dec4f026
commit
85961be02e
|
@ -20,7 +20,7 @@ require:
|
||||||
- ./lib/rubocop/cop/lint/module_disclosure_date_format.rb
|
- ./lib/rubocop/cop/lint/module_disclosure_date_format.rb
|
||||||
- ./lib/rubocop/cop/lint/module_disclosure_date_present.rb
|
- ./lib/rubocop/cop/lint/module_disclosure_date_present.rb
|
||||||
- ./lib/rubocop/cop/lint/deprecated_gem_version.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:
|
Layout/SpaceBeforeBrackets:
|
||||||
Description: >-
|
Description: >-
|
||||||
|
@ -161,8 +161,9 @@ Lint/ModuleDisclosureDatePresent:
|
||||||
|
|
||||||
Lint/SideEffectsInNotes:
|
Lint/SideEffectsInNotes:
|
||||||
Include:
|
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/exploits/**/*'
|
||||||
|
- 'modules/auxiliary/**/*'
|
||||||
|
|
||||||
Lint/DeprecatedGemVersion:
|
Lint/DeprecatedGemVersion:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
|
@ -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_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'
|
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_node_matcher :find_update_info_node, <<~PATTERN
|
||||||
(def :initialize _args (begin (super $(send nil? {:update_info :merge_info} (lvar :info) (hash ...))) ...))
|
(def :initialize _args (begin (super $(send nil? {:update_info :merge_info} (lvar :info) (hash ...))) ...))
|
||||||
PATTERN
|
PATTERN
|
||||||
|
@ -45,7 +44,6 @@ module RuboCop
|
||||||
def check_for_side_effects(notes)
|
def check_for_side_effects(notes)
|
||||||
last_key = nil
|
last_key = nil
|
||||||
side_effects_present = false
|
side_effects_present = false
|
||||||
p notes
|
|
||||||
notes.each_pair do |key, _value|
|
notes.each_pair do |key, _value|
|
||||||
if key.value == 'SideEffects'
|
if key.value == 'SideEffects'
|
||||||
side_effects_present = true
|
side_effects_present = true
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'spec_helper'
|
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
|
RSpec.describe RuboCop::Cop::Lint::SideEffectsInNotes do
|
||||||
subject(:cop) { described_class.new(config) }
|
subject(:cop) { described_class.new(config) }
|
Loading…
Reference in New Issue