Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add stdin-filename support #157

Merged
merged 3 commits into from
Jun 24, 2022
Merged

Conversation

arahatashun
Copy link
Contributor

What

add support for overwriting file names when using stdin.

Why

When I tried developing a VSCode extension for actionlint, I felt it would be helpful if we had this option.
FYI: https://github.com/fnando/vscode-linter/blob/main/docs/creating-linters.md

For example, eslint has this kind of option. https://eslint.org/docs/user-guide/command-line-interface#--stdin-filename

QA

With --stdin-filename

shun@Mac-mini actionlint % echo "foo"|  ./actionlint --stdin-filename "test.yml" -
test.yml:1:1: workflow is scalar node but mapping node is expected [syntax-check]
  |
1 | foo
  | ^~~
test.yml:1:1: "jobs" section is missing in workflow [syntax-check]
  |
1 | foo
  | ^~~

Without --stdin-filename

shun@Mac-mini actionlint % echo "foo"|  ./actionlint -
<stdin>:1:1: workflow is scalar node but mapping node is expected [syntax-check]
  |
1 | foo
  | ^~~
<stdin>:1:1: "jobs" section is missing in workflow [syntax-check]
  |
1 | foo
  | ^~~

command.go Outdated Show resolved Hide resolved
linter.go Outdated
@@ -79,6 +79,8 @@ type LinterOptions struct {
// Format is a custom template to format error messages. It must follow Go Template format and
// contain at least one {{ }} placeholder. https://pkg.go.dev/text/template
Format string
// Set FileName for stdin
StdInFileName string
Copy link
Owner

@rhysd rhysd Jun 24, 2022

Choose a reason for hiding this comment

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

Could you rename this to StdinFileName since stdin is a single word (e.g. os.Stdin)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for reviewing. I named it to StdinFileName.

@rhysd
Copy link
Owner

rhysd commented Jun 24, 2022

@arahatashun When you finish to build the VS Code plugin, I would be glad to hear that. I'll update document to include the URL to the project.

arahatashun and others added 2 commits June 24, 2022 22:44
Co-authored-by: Linda_pp <rhysd@users.noreply.github.com>
@arahatashun arahatashun requested a review from rhysd June 24, 2022 13:46
@rhysd
Copy link
Owner

rhysd commented Jun 24, 2022

Thanks!

@rhysd rhysd merged commit 3257a89 into rhysd:main Jun 24, 2022
@rhysd
Copy link
Owner

rhysd commented Jun 26, 2022

This change was included in the latest release v1.6.14.

@arahatashun
Copy link
Contributor Author

Thank you for the quick release. I published the VSCode extension https://marketplace.visualstudio.com/items?itemName=arahata.linter-actionlint.

@rollingmoai
Copy link

rollingmoai commented Jul 5, 2022

@rhysd Can you add a reference to the vscode extension in the docs now?

@rhysd
Copy link
Owner

rhysd commented Jul 6, 2022

I'm sorry for catching the comment lately since this issue was already closed. I added description about the VS Code extension. Thank you for making it!

49dede4

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.

3 participants