Skip to content

Add opt-in analyze support for extensionless/unknown file types#750

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/how-to-match-files-without-extension
Draft

Add opt-in analyze support for extensionless/unknown file types#750
Copilot wants to merge 2 commits into
mainfrom
copilot/how-to-match-files-without-extension

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

Bug Fix

DevSkim analyze skipped files with unknown language classification, which prevented rules (including applies_to_file_regex) from evaluating extensionless targets like passwd. This change adds an explicit CLI opt-in to analyze unknown file types while preserving current default behavior.

  • What was the bug?

    • Directory scans used *.*, excluding extensionless files from discovery.
    • Even when discovered, unknown-language files were unconditionally skipped before rule evaluation.
  • How did you fix it?

    • New analyze flag (opt-in):
      • Added --analyze-unknown-file-types to BaseAnalyzeCommandOptions (default: false).
    • Extensionless file discovery:
      • Updated directory enumeration in AnalyzeCommand from *.* to * so files like passwd are included.
    • Unknown-language handling:
      • Kept existing default skip behavior.
      • When the new flag is set, unknown-language files are analyzed instead of skipped.
      • Output language is emitted as "unknown" for those files.
  • Implementation details

    • Added focused analyzer coverage for an extensionless passwd file with applies_to_file_regex, asserting:
      • flag off ⇒ no findings
      • flag on ⇒ finding is produced
devskim analyze \
  --source-code /path/to/repo \
  --rules /path/to/passwd-rule.json \
  --analyze-unknown-file-types

Copilot AI assigned Copilot and gfs May 15, 2026
Copilot AI linked an issue May 15, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add support for matching files without an extension Add opt-in analyze support for extensionless/unknown file types May 15, 2026
Copilot AI requested a review from gfs May 15, 2026 14:32
Copilot finished work on behalf of gfs May 15, 2026 14:32
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.

How to match files without a file extension?

2 participants