Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 71ae820

Browse files
committed
Pass filename to parser servers
The ultimate aim here is to support parsing TypeScript and React (i.e. `tsx`) files. Ticket: codeclimate/app#6470.
1 parent 9896b02 commit 71ae820

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/cc/engine/processed_source.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def raw_source
1515
end
1616

1717
def ast
18-
@ast ||= CC::Parser.parse(raw_source, request_path)
18+
@ast ||= CC::Parser.parse(raw_source, request_path, filename: path)
1919
end
2020

2121
private

spec/cc/engine/analyzers/javascript/main_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
EOJS
104104

105105
error = CC::Parser::Client::HTTPError.new(500, "Error processing file: ./foo.js")
106-
allow(CC::Parser).to receive(:parse).with("", "/javascript").and_raise(error)
106+
allow(CC::Parser).to receive(:parse).with("", "/javascript", filename: "./foo.js").and_raise(error)
107107

108108
expect(CC.logger).to receive(:error).with("Error processing file: ./foo.js")
109109
expect(CC.logger).to receive(:error).with(error.message)

0 commit comments

Comments
 (0)