Skip to content

Integrate InSpec check with Cookstyle - #5618

Merged
clintoncwolfe merged 7 commits into
mainfrom
nm/check-cookstyle
Oct 25, 2021
Merged

clintoncwolfe merged 7 commits into
mainfrom
nm/check-cookstyle

Conversation

@Nik08

@Nik08 Nik08 commented Aug 16, 2021 •

Copy link
Copy Markdown
Contributor

Signed-off-by: Nikita Mathur nikita.mathur@chef.io

Description

InSpec check now also checks for code offenses using cookstyle gem.
Only using InSpec cops of cookstyle for the check.

Related Issue

Closes #5611

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.

@Nik08
Nik08 requested a review from a team as a code owner August 16, 2021 10:24
@Nik08 Nik08 self-assigned this Aug 16, 2021
@Nik08
Nik08 requested review from Vasu1105 and alexpop August 16, 2021 10:24
@netlify

netlify Bot commented Aug 16, 2021 •

Copy link
Copy Markdown

✔️ Deploy Preview for chef-inspec ready!

🔨 Explore the source changes: ec7526f

🔍 Inspect the deploy log: https://app.netlify.com/sites/chef-inspec/deploys/6156bb1ee6fa0200084c8b13

😎 Browse the preview: https://deploy-preview-5618--chef-inspec.netlify.app/inspec/cli

@Nik08 Nik08 changed the title Integrate InSpec check with Cookstyle [W.I.P] Integrate InSpec check with Cookstyle Aug 16, 2021
@Nik08 Nik08 changed the title [W.I.P] Integrate InSpec check with Cookstyle Integrate InSpec check with Cookstyle Aug 18, 2021
@Nik08
Nik08 force-pushed the nm/check-cookstyle branch 4 times, most recently from 3c4583f to ba7196a Compare August 20, 2021 09:18
Comment thread lib/inspec/cli.rb Resolved
Comment thread Gemfile Resolved
Comment thread lib/inspec/profile.rb Resolved
Comment thread test/functional/inspec_check_test.rb Resolved

@clintoncwolfe clintoncwolfe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor things to change - most important one being we need to call cookstyle without specifying the exact rules, we want all the rules in the InSpec category.

@tas50

tas50 commented Aug 24, 2021

Copy link
Copy Markdown
Contributor

Sadly right now you can't say --only InSpec. We're the only people doing the 3 level configs and that's a use case they haven't gotten working. It's something we need to track down and fix so people can do the same thing with the Chef cops. What you can do is this though:

InSpec/Deprecations, InSpec/Correctness, InSpec/Modernize InSpec/RedundantCode, InSpec/Style, and InSpec/Sharing. Those match the categories we have for Chef cops right now and it's pretty future proof.

@sonarqubecloud

Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
7.2% 7.2% Duplication

@Nik08

Nik08 commented Aug 25, 2021

Copy link
Copy Markdown
Contributor Author

Couple of minor things to change - most important one being we need to call cookstyle without specifying the exact rules, we want all the rules in the InSpec category.

I have made the minor changes as requested @clintoncwolfe. About not specifying the exact rules, I tried using the cop categories mentioned by @tas50 but since most of those cops definitions do not exist for InSpec right now in cookstyle gem, those were overriding the offenses produced by the one cop which does exist and was returning zero offenses.

So for now i have only included InSpec/Deprecations cop which exists in cookstyle.

@clintoncwolfe
clintoncwolfe self-requested a review September 28, 2021 04:50
@clintoncwolfe

Copy link
Copy Markdown
Contributor

Before we can merge this, we need to update the CLI docs with an updated description of what inspec check does, as its behavior has changed. See https://github.com/inspec/inspec/blob/main/docs-chef-io/content/inspec/cli.md

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
@Nik08
Nik08 force-pushed the nm/check-cookstyle branch from 2c2f7aa to 11b9196 Compare September 29, 2021 08:23
@Nik08
Nik08 requested a review from a team as a code owner September 29, 2021 08:23
@github-actions github-actions Bot added the Documentation ZH multi-repo label for the docs-team label Sep 29, 2021
Comment thread docs-chef-io/content/inspec/cli.md Resolved
cookstyle relevant changes in inspec check

Co-authored-by: Ian Maddaus <IanMadd@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2021

Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
7.2% 7.2% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate inspec check with cookstyle

4 participants