Preprocessing before matching in custom rules?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start with the linked jq issue comment and the jq discussion, then trace how DevSkim custom rules perform matching and whether preprocessing is currently supported. Done means establishing whether either placeholder-based processing direction can be supported for the shown JQ/JSON example and documenting the resulting behavior or limitation.
Written by the indexing model from the issue text.
Description
I have a very specific use case where I would like to use custom DevSkim rules on.
I described the situation here: https://github.com/jqlang/jq/issues/566#issuecomment-2525047098 which I moved into a discussion here: https://github.com/jqlang/jq/discussions/3218.
For DevSkim purposes this for now can be considered a 'custom and unsupported language', JQ. JQ in itself is not valid JSON but in my use-case a large part of it is JSON. To avoid writing very complicated regular expressions on a complicated file structure only, if I enclosed it in placeholders like in below example.
{
"name": "Example",
"data": [
# __JQ_START__
.input | map({ key: .key, value: .value })
# __JQ_END__
]
}
Is there a way in DevSkim to first use regex to remove everything in between the placeholders, including the placeholders itself, and then use JSONpath on the remainder, which is now fully JSON?
Or visa versa remove everything outside the placeholders including the placeholders, and do another regex on the remainder (JQ only)?
- Dominant language
- C#
- Stars
- 1k
- Forks
- 132
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/DevSkim
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
enhancement
microsoft/DevSkim#747 · 4 comments · 1 reaction · 2 assignees ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
All issues in microsoft/DevSkim
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·