Skip to content
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
1 change: 1 addition & 0 deletions .github/workflows/check-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
- {linter: 'pylint', format: 'pylint', regex: '', levelMap: '', analysisPath: '.'}
- {linter: 'mdl', format: 'mdl', regex: '', levelMap: '', analysisPath: '.'}
- {linter: 'yamllint', format: 'yamllint', regex: '', levelMap: '', analysisPath: '.'}
- {linter: 'ghalint', format: 'ghalint', regex: '', levelMap: '', analysisPath: '.'}
- {linter: 'sarif', format: 'sarif', regex: '', levelMap: '', analysisPath: '.'}
- {linter: 'flake8subpath', format: 'flake8', regex: '', levelMap: '', analysisPath: 'A\B'}
- linter: 'custom'
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ This action supports a bunch of linter output formats, for which no `inputRegex`
- `yamllint`: The format of [yamllint](https://yamllint.readthedocs.io/en/stable/) linter's parsable output (requires using `-f parsable` in yamllint's command
line).

- `ghalint`: The format of [ghallint](https://github.com/suzuki-shunsuke/ghalint/cmd/ghalint/) linter's parsable output.

- `SARIF`: A [standard format for static analysis](https://sarifweb.azurewebsites.net/). This is useful if you already have a SARIF file and want to create a summary
for it, or create comments on the PR.

Expand Down
1 change: 1 addition & 0 deletions __tests__/bugalint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('fullConversion', () => {
['flake8', getKnownParser('flake8'), '.'],
['mdl', getKnownParser('mdl'), '.'],
['yamllint', getKnownParser('yamllint'), '.'],
['ghalint', getKnownParser('ghalint'), '.'],
['sarif', getKnownParser('sarif'), '.'],
['flake8subpath', getKnownParser('flake8'), 'A\\B'],
[
Expand Down
3 changes: 3 additions & 0 deletions __tests__/ghalint.input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Jan 22 09:42:27.969 ERR the job violates policies program=ghalint version="" workflow_file_path=.github/workflows/cancel-stale-merge-queue-workflows.yml policy_name=job_timeout_minutes_is_required reference=https://github.com/suzuki-shunsuke/ghalint/blob/main/docs/policies/012.md job_name=cancel-workflows error="job's timeout-minutes is required"
Jan 22 09:42:27.969 ERR the job violates policies program=ghalint version="" workflow_file_path=.github/workflows/cancel-stale-merge-queue-workflows.yml reference=https://github.com/suzuki-shunsuke/ghalint/blob/main/docs/policies/012.md job_name=cancel-workflows error="job's timeout-minutes is required" policy_name=job_timeout_minutes_is_required
Jan 22 09:42:27.969 ERR the job violates policies program=ghalint version="" reference=https://github.com/suzuki-shunsuke/ghalint/blob/main/docs/policies/012.md job_name=cancel-workflows error="job's timeout-minutes is required" policy_name=job_timeout_minutes_is_required workflow_file_path=.github/workflows/cancel-stale-merge-queue-workflows.yml
43 changes: 43 additions & 0 deletions __tests__/ghalint.output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": "2.1.0",
"$schema": "http://json.schemastore.org/sarif-2.1.0-rtm.6",
"runs": [
{
"tool": {
"driver": {
"name": "test",
"rules": []
}
},
"results": [
{
"locations": [
{
"physicalLocation": { "artifactLocation": { "uri": ".github/workflows/cancel-stale-merge-queue-workflows.yml" } }
}
],
"message": { "text": "job's timeout-minutes is required" },
"ruleId": "job_timeout_minutes_is_required"
},
{
"locations": [
{
"physicalLocation": { "artifactLocation": { "uri": ".github/workflows/cancel-stale-merge-queue-workflows.yml" } }
}
],
"message": { "text": "job's timeout-minutes is required" },
"ruleId": "job_timeout_minutes_is_required"
},
{
"locations": [
{
"physicalLocation": { "artifactLocation": { "uri": ".github/workflows/cancel-stale-merge-queue-workflows.yml" } }
}
],
"message": { "text": "job's timeout-minutes is required" },
"ruleId": "job_timeout_minutes_is_required"
}
]
}
]
}
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30007,7 +30007,8 @@ const knownParsers = {
mypy: (input) => parseRegex(input, /^(?<path>[^:\n]+):(?:(?<line>\d+):)?(?:(?<col>\d+):)?(?:(?<eline>\d+):)?(?:(?<ecol>\d+):)? (?<level>[^:\s]+): (?<msg>.+?)\s*(?:\[(?<id>\S+)\])?$/gm),
flake8: (input) => parseRegex(input, /^(?<path>[^:\n]+):(?<line>\d+):(?<col>\d+): (?<id>\w\d+) (?<msg>[^\n]+)$/gm),
mdl: (input) => parseRegex(input, /^(?<path>[^:\n]+)(?::(?<line>\d+))?(?::(?<col>\d+))? (?<id>[^/\n]+)\/(?<sym>[^\s]+) (?<msg>[^\n]+)$/gm),
yamllint: (input) => parseRegex(input, /^(?<path>[^:\n]+):(?<line>\d+):(?<col>\d+): \[(?<level>[^\n\]]+)\] (?<msg>[^\n]+) \((?<id>[^\n)]+)\)$/gm)
yamllint: (input) => parseRegex(input, /^(?<path>[^:\n]+):(?<line>\d+):(?<col>\d+): \[(?<level>[^\n\]]+)\] (?<msg>[^\n]+) \((?<id>[^\n)]+)\)$/gm),
ghalint: (input) => parseRegex(input, /^(?=.*\berror="(?<msg>[^\n=]*)")(?=.*\bpolicy_name=(?<sym>[^\s=\n]*))(?=.*\bworkflow_file_path=(?<path>[^\s=\n]*))[^\n]*$/gm)
};
function normalizePath(givenPath, analysisPath) {
const fileUrlPrefix = 'file:///';
Expand Down
4 changes: 3 additions & 1 deletion src/bugalint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ const knownParsers: Record<string, Parser> = {
),
flake8: (input: string) => parseRegex(input, /^(?<path>[^:\n]+):(?<line>\d+):(?<col>\d+): (?<id>\w\d+) (?<msg>[^\n]+)$/gm),
mdl: (input: string) => parseRegex(input, /^(?<path>[^:\n]+)(?::(?<line>\d+))?(?::(?<col>\d+))? (?<id>[^/\n]+)\/(?<sym>[^\s]+) (?<msg>[^\n]+)$/gm),
yamllint: (input: string) => parseRegex(input, /^(?<path>[^:\n]+):(?<line>\d+):(?<col>\d+): \[(?<level>[^\n\]]+)\] (?<msg>[^\n]+) \((?<id>[^\n)]+)\)$/gm)
yamllint: (input: string) => parseRegex(input, /^(?<path>[^:\n]+):(?<line>\d+):(?<col>\d+): \[(?<level>[^\n\]]+)\] (?<msg>[^\n]+) \((?<id>[^\n)]+)\)$/gm),
ghalint: (input: string) =>
parseRegex(input, /^(?=.*\berror="(?<msg>[^\n=]*)")(?=.*\bpolicy_name=(?<sym>[^\s=\n]*))(?=.*\bworkflow_file_path=(?<path>[^\s=\n]*))[^\n]*$/gm)
}

function normalizePath(givenPath: string, analysisPath: string): string {
Expand Down
Loading