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

Make debug public #331

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (r *RuleBase) Errorf(pos *Pos, format string, args ...interface{}) {
r.errs = append(r.errs, err)
}

func (r *RuleBase) debug(format string, args ...interface{}) {
func (r *RuleBase) Debug(format string, args ...interface{}) {
if r.dbg == nil {
return
}
Expand Down
4 changes: 2 additions & 2 deletions rule_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ func (rule *RuleAction) checkRepoAction(spec string, exec *ExecAction) {

meta, ok := PopularActions[spec]
if !ok {
rule.debug("This action is not found in popular actions data set: %s", spec)
rule.Debug("This action is not found in popular actions data set: %s", spec)
return
}
if meta.SkipInputs {
rule.debug("This action skips to check inputs: %s", spec)
rule.Debug("This action skips to check inputs: %s", spec)
return
}

Expand Down
2 changes: 1 addition & 1 deletion rule_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ func (rule *RuleExpression) checkSemanticsOfExprNode(expr ExprNode, line, col in
if workflowKey != "" {
ctx, sp := WorkflowKeyAvailability(workflowKey)
if len(ctx) == 0 {
rule.debug("No context avaiability was found for workflow key %q", workflowKey)
rule.Debug("No context avaiability was found for workflow key %q", workflowKey)
}
c.SetContextAvailability(ctx)
c.SetSpecialFunctionAvailability(sp)
Expand Down
4 changes: 2 additions & 2 deletions rule_pyflakes.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ func (rule *RulePyflakes) isPythonShell(r *ExecRun) bool {

func (rule *RulePyflakes) runPyflakes(src string, pos *Pos) {
src = sanitizeExpressionsInScript(src) // Defined at rule_shellcheck.go
rule.debug("%s: Running %s for Python script:\n%s", pos, rule.cmd.exe, src)
rule.Debug("%s: Running %s for Python script:\n%s", pos, rule.cmd.exe, src)

rule.cmd.run([]string{}, src, func(stdout []byte, err error) error {
if err != nil {
rule.debug("Command %s failed: %v", rule.cmd.exe, err)
rule.Debug("Command %s failed: %v", rule.cmd.exe, err)
return fmt.Errorf("`%s` did not run successfully while checking script at %s: %w", rule.cmd.exe, pos, err)
}
if len(stdout) == 0 {
Expand Down
6 changes: 3 additions & 3 deletions rule_shellcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func sanitizeExpressionsInScript(src string) string {

func (rule *RuleShellcheck) runShellcheck(src, sh string, pos *Pos) {
src = sanitizeExpressionsInScript(src)
rule.debug("%s: Run shellcheck for %s script:\n%s", pos, sh, src)
rule.Debug("%s: Run shellcheck for %s script:\n%s", pos, sh, src)

// Reasons to exclude the rules:
//
Expand All @@ -173,7 +173,7 @@ func (rule *RuleShellcheck) runShellcheck(src, sh string, pos *Pos) {
// - SC2157: Argument to -z is always false due to literal strings. When the argument of -z is replaced from ${{ }},
// this can happen. For example, `if [ -z ${{ env.FOO }} ]` -> `if [ -z ______________ ]` (#113).
args := []string{"--norc", "-f", "json", "-x", "--shell", sh, "-e", "SC1091,SC2194,SC2050,SC2154,SC2157", "-"}
rule.debug("%s: Running %s command with %s", pos, rule.cmd.exe, args)
rule.Debug("%s: Running %s command with %s", pos, rule.cmd.exe, args)

// Use same options to run shell process described at document
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#using-a-specific-shell
Expand All @@ -185,7 +185,7 @@ func (rule *RuleShellcheck) runShellcheck(src, sh string, pos *Pos) {

rule.cmd.run(args, script, func(stdout []byte, err error) error {
if err != nil {
rule.debug("Command %s %s failed: %v", rule.cmd.exe, args, err)
rule.Debug("Command %s %s failed: %v", rule.cmd.exe, args, err)
return fmt.Errorf("`%s %s` did not run successfully while checking script at %s: %w", rule.cmd.exe, strings.Join(args, " "), pos, err)
}

Expand Down
4 changes: 2 additions & 2 deletions rule_workflow_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (rule *RuleWorkflowCall) checkWorkflowCallUsesLocal(call *WorkflowCall) {
return
}
if m == nil {
rule.debug("Skip workflow call %q since no metadata was found", u.Value)
rule.Debug("Skip workflow call %q since no metadata was found", u.Value)
return
}

Expand Down Expand Up @@ -142,7 +142,7 @@ func (rule *RuleWorkflowCall) checkWorkflowCallUsesLocal(call *WorkflowCall) {
}
}

rule.debug("Validated reusable workflow %q", u.Value)
rule.Debug("Validated reusable workflow %q", u.Value)
}

// Parse ./{path/{filename}
Expand Down