Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing nil check for control variable in formatter's base - Issue 6510 #6629

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

ahasunos
Copy link
Contributor

@ahasunos ahasunos commented Aug 30, 2023

Description

This PR fixes the issue #6510; missing nil check for control variable in the Base class of Inspec::Formatters. This issue is only faced in InSpec 5 (inspec-5 branch).

It was fixed in InSpec 6 (now main branch) with the other work on the base and streaming reporters.

Related Issue

#6510 - Base InSpec formatter class missing nil check

inspec/lib/inspec/formatters/base.rb:163:in `block in statistics': undefined method `any?' for nil:NilClass (NoMethodError)

          skipped += 1 if control[:results].any? { |r| r[:status] == "skipped" }
                                           ^^^^^

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change)
  • Breaking change (a content change which would break existing functionality or processes)

Checklist:

  • I have read the CONTRIBUTING document.

@ahasunos ahasunos requested a review from a team as a code owner August 30, 2023 10:29
@ahasunos ahasunos requested review from Vasu1105 and Nik08 and removed request for a team August 30, 2023 10:29
@clintoncwolfe clintoncwolfe merged commit 29c5695 into inspec-5 Aug 31, 2023
4 of 6 checks passed
@clintoncwolfe clintoncwolfe deleted the ss/fix-missing-nil-check-issue-6510 branch August 31, 2023 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants