Skip to content

Commit

Permalink
Merge pull request #501 from crystal-ameba/fix-stdin_filename-flag
Browse files Browse the repository at this point in the history
While passing file through `STDIN` we should lint just that
  • Loading branch information
Sija authored Nov 19, 2024
2 parents a5c99e2 + 229a3e4 commit c26b5a5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/ameba/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,12 @@ class Ameba::Config
# config.sources # => list of sources pointing to files found by the wildcards
# ```
def sources
srcs = (find_files_by_globs(globs) - find_files_by_globs(excluded))
.map { |path| Source.new File.read(path), path }

if file = stdin_filename
srcs << Source.new(STDIN.gets_to_end, file)
[Source.new(STDIN.gets_to_end, file)]
else
(find_files_by_globs(globs) - find_files_by_globs(excluded))
.map { |path| Source.new File.read(path), path }
end

srcs
end

# Returns a formatter to be used while inspecting files.
Expand Down

0 comments on commit c26b5a5

Please sign in to comment.