Skip to content

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

Merged
mame merged 1 commit intoruby:masterfrom
sinsoku:add-exclude-option
Feb 18, 2026
Merged

Add --exclude option to skip files matching glob patterns#368
mame merged 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.
Copy link
Member

@mame mame left a comment

Choose a reason for hiding this comment

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

I totally get why it's needed, so I'll merge it for now! I might want to change the name "--exclude" in future, though. sorry if that happens.

@mame mame merged commit 78bc8e6 into ruby:master Feb 18, 2026
7 checks passed
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.

2 participants

Comments