Skip to content

Add --exclude option to skip files matching glob patterns#368

Open
sinsoku wants to merge 1 commit intoruby:masterfrom
sinsoku:add-exclude-option
Open

Add --exclude option to skip files matching glob patterns#368
sinsoku wants to merge 1 commit intoruby:masterfrom
sinsoku:add-exclude-option

Conversation

@sinsoku
Copy link
Contributor

@sinsoku sinsoku commented Feb 14, 2026

Summary

Adds --exclude option to skip files matching glob patterns from analysis.

Some projects contain .rb files that are not valid Ruby syntax, such as:

CLI

$ typeprof --exclude "**/templates/**/*.rb" lib/

The --exclude option can be specified multiple times.

LSP

Add the exclude key to typeprof.conf.jsonc:

{
  "typeprof_version": "experimental",
  "rbs_dir": "sig/",
  "analysis_unit_dirs": ["lib/"],
  "exclude": ["**/templates/**/*.rb"]
}

Note

This can also be useful as a workaround to skip files that cause infinite loops or errors during analysis.

Some projects contain .rb files that are not valid Ruby syntax.
This option allows users to exclude those files from analysis.

Examples of such files:
- ERB templates with .rb extension
  https://github.com/heartcombo/devise/blob/v5.0.1/lib/generators/active_record/templates/migration.rb
- .rb files embedding RBS syntax for testing
  https://github.com/ruby/typeprof/tree/v0.31.1/scenario/**/*.rb

Usage:
  typeprof --exclude "**/templates/**/*.rb" lib/

For LSP mode, the "exclude" key can be set in typeprof.conf.jsonc.
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.

1 participant