-
Notifications
You must be signed in to change notification settings - Fork 154
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
feat: Lint actions #366
Open
msw-kialo
wants to merge
26
commits into
rhysd:main
Choose a base branch
from
kialo:lint-actions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Lint actions #366
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
61fecfd
Duplicate linting infrastructure to lint actions, too
msw-kialo dae9310
Draft action metadata parsing
lg-kialo 8992b49
Reenable a basic visitor and rules for action linting
msw-kialo 6b3655c
Add action input parsing
lg-kialo 5328f81
Start parsing actions
msw-kialo bf2f39c
Resolve staticcheck linting errors
msw-kialo cde5d87
Parse javascript and docker actions
msw-kialo f0c006c
Mimic dummy workflow/job while visits actions
msw-kialo f4693ce
Parse outputs
msw-kialo 88bbdc2
Add support for action linting to playground
lg-kialo ba8491f
Try to ignore broken test data for dogfooding tests
msw-kialo 8fe56c1
Fix more linting errors
msw-kialo 9f2987a
CI: workaround shellcheck/actionlint limitation
msw-kialo af49077
Fix playground TS linting errors
lg-kialo bb3a340
Merge branch 'rhysd:main' into lint-actions
lg-kialo 8c3038a
Add action specific methods to visit interface
msw-kialo 6cc4130
Parse action's branding info and validate it
msw-kialo bb1e69d
Link to right docs in comment
lg-kialo ef14959
Address TODO renaming `workflowKeyVal`
lg-kialo 1275407
Update comment
lg-kialo b95f955
Reverse ActionCommon / Action
msw-kialo 3bd8075
Unify interfaces
msw-kialo 4bf6973
Cleanups and improved naming
msw-kialo ae2dc96
More fixes
msw-kialo 847623f
Restructure / fix tests
msw-kialo 4b05130
Add more tests
msw-kialo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -4,6 +4,7 @@ import ( | |||||||
"flag" | ||||||||
"fmt" | ||||||||
"io" | ||||||||
"os" | ||||||||
"runtime" | ||||||||
"runtime/debug" | ||||||||
) | ||||||||
|
@@ -77,6 +78,15 @@ type Command struct { | |||||||
Stderr io.Writer | ||||||||
} | ||||||||
|
||||||||
func isDir(path string) bool { | ||||||||
// use a switch to make it a bit cleaner | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
todo or remove? (leaving suggestions for both; you pick? 😄) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
fi, err := os.Stat(path) | ||||||||
if err != nil { | ||||||||
return false | ||||||||
} | ||||||||
return fi.IsDir() | ||||||||
} | ||||||||
|
||||||||
func (cmd *Command) runLinter(args []string, opts *LinterOptions, initConfig bool) ([]*Error, error) { | ||||||||
l, err := NewLinter(cmd.Stdout, opts) | ||||||||
if err != nil { | ||||||||
|
@@ -91,6 +101,10 @@ func (cmd *Command) runLinter(args []string, opts *LinterOptions, initConfig boo | |||||||
return l.LintRepository(".") | ||||||||
} | ||||||||
|
||||||||
if len(args) == 1 && isDir(args[0]) { | ||||||||
return l.LintDirInRepository(args[0]) | ||||||||
} | ||||||||
|
||||||||
if len(args) == 1 && args[0] == "-" { | ||||||||
b, err := io.ReadAll(cmd.Stdin) | ||||||||
if err != nil { | ||||||||
|
@@ -142,6 +156,7 @@ func (cmd *Command) Main(args []string) int { | |||||||
flags.BoolVar(&opts.Debug, "debug", false, "Enable debug output (for development)") | ||||||||
flags.BoolVar(&ver, "version", false, "Show version and how this binary was installed") | ||||||||
flags.StringVar(&opts.StdinFileName, "stdin-filename", "", "File name when reading input from stdin") | ||||||||
flags.StringVar(&opts.InputFormat, "input-format", "auto-detect", "What syntax to check 'workflow', 'action' or 'auto-detect'") | ||||||||
flags.Usage = func() { | ||||||||
fmt.Fprintln(cmd.Stderr, commandUsageHeader) | ||||||||
flags.PrintDefaults() | ||||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.