Is it possible to match something that is missing in a file?

Open
#668 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
32/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
yaml
Domain
security, tooling

Research direction

No source files, tests, or entry points are named. Start by reviewing DevSkim's rule matching behavior and reproducing the negative-lookahead case against YAML and .sometool.yaml files; done means determining whether missing-content matching can be supported or clearly documenting its limits.

Written by the indexing model from the issue text.

Description

question

Is it possible to match something that is missing in a file? For example if I apply a DevSkim rule on all yaml files or better if possible on all files ending with .sometool.yaml, can I then specifically trigger a warning on something that does not exist? For example the file is expected to have a certain option but it doesn't contain it.

I tried to achieve it with regex negative lookaheads but it doesn't seem possible, I get the self-tests (must-match / must-not-match) to work but not triggering on the actual content.

Dominant language
C#
Stars
1k
Forks
132
Avg merge
1m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DevSkim

All issues in microsoft/DevSkim

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.