ruby / ruby/rake

FileList#<< bypasses exclusions while FileList#include respects them

Open
#637 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.5k
Forks
650
Avg merge
6m
Merged PRs (30d)
3

Description

Problem

The << and include methods behave inconsistently with exclusions:

  • exclude then include: exclusion wins (correct)
  • exclude then <<: file gets included anyway (bug)
Example
include_list = FileList.new
include_list.exclude 'abc.c'
include_list.include 'abc.c'        # Correctly excluded: []

shovel_list = FileList.new  
shovel_list.exclude 'abc.c'
shovel_list << 'abc.c'              # Bug: returns ["abc.c"]
shovel_list.resolve                 # Still returns ["abc.c"] - resolve doesn't fix it
shovel_list.include 'xyz.rb'        # Now returns ["xyz.rb"], "abc.c" is finally removed
Fix

Add resolve_exclude to the << method:

def <<(obj)
  resolve
  @items << Rake.from_pathname(obj)
  resolve_exclude  # ADD THIS LINE
  self
end

I have a PR with fix & tests ready to go if this approach looks good to maintainers

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.

Research direction

Start with FileList#<< and compare its exclusion handling with FileList#include and resolve_exclude. Reproduce the abc.c example and verify that a file excluded before being appended remains absent after resolving; confirm the associated fix and tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.