-
Notifications
You must be signed in to change notification settings - Fork 3
fixed lint.sh, allowed 'all' to be passed to lint.sh to lint everything, not just changed files, and updated readme accordingly #9
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
Open
billy-kimble-sp
wants to merge
2
commits into
main
Choose a base branch
from
lint_sh
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
Changes from all commits
Commits
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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,22 +1,31 @@ | ||
| #!/bin/sh | ||
|
|
||
| LINTER_URL="https://raw.githubusercontent.com/sailpoint-oss/api-linter/main" | ||
| SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
|
||
| for file in $(git diff --name-only HEAD master) | ||
| args=("$@") | ||
|
|
||
| if [ "${args[0]}" = "all" ] | ||
| then | ||
| files=$(find . -name "*.yaml") | ||
| else | ||
| files=$(git diff --name-only HEAD main) | ||
| fi | ||
|
|
||
| for file in $files | ||
| do | ||
| if echo $file | grep "sailpoint-api.*" --quiet | ||
| then | ||
| # Don't ignore unkown format because we want to know if the root API spec is a valid OpenAPI version | ||
| spectral lint $file --ruleset "${LINTER_URL}/root-ruleset.yaml" | ||
| spectral lint $file --ruleset "${SCRIPT_DIR}/root-ruleset.yaml" | ||
| fi | ||
|
|
||
| if echo $file | grep paths --quiet | ||
| then | ||
| spectral lint $file --ruleset "${LINTER_URL}/path-ruleset.yaml" --ignore-unknown-format | ||
| spectral lint $file --ruleset "${SCRIPT_DIR}/path-ruleset.yaml" --ignore-unknown-format | ||
| fi | ||
|
|
||
| if echo $file | grep schemas --quiet | ||
| then | ||
| spectral lint $file --ruleset "${LINTER_URL}/schema-ruleset.yaml" --ignore-unknown-format | ||
| spectral lint $file --ruleset "${SCRIPT_DIR}/schema-ruleset.yaml" --ignore-unknown-format | ||
| fi | ||
| done | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -36,77 +36,77 @@ rules: | |
| function: parameter-example-check | ||
| functionOptions: | ||
| rule: 304 | ||
| path-parameters-must-have-valid-formats-for-numbers-and-integers: | ||
| message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#171" | ||
| given: $.[*].parameters[?(@.$ref == null)] | ||
| severity: error | ||
| then: | ||
| function: path-parameter-integer-number-formats | ||
| functionOptions: | ||
| rule: 171 | ||
| path-summary-length: | ||
| message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#305" | ||
| given: $[*].summary | ||
| severity: warn | ||
| then: | ||
| function: word-count | ||
| functionOptions: | ||
| maxWordCount: 5 | ||
|
Comment on lines
-39
to
-54
Contributor
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. Why are all of these path and schema rules commented out? |
||
| rule: 305 | ||
| path-description-html-chars: | ||
| message: "{{error}}" | ||
| given: $[*].description | ||
| severity: error | ||
| then: | ||
| function: path-descriptions-check | ||
| functionOptions: | ||
| rule: 405 | ||
| path-must-have-security-defined: | ||
| message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#104" | ||
| given: $[*] | ||
| severity: error | ||
| then: | ||
| function: path-oauth-scope-check | ||
| functionOptions: | ||
| rule: 104 | ||
| path-deprecated-apis-should-have-deprecation-and-sunset-dates: | ||
| message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#189" | ||
| given: $[*] | ||
| severity: warn | ||
| then: | ||
| function: deprecation | ||
| functionOptions: | ||
| rule: 189 | ||
| path-must-have-required-key-on-all-parameters: | ||
| description: "Rule 317: Operations must have required key on all parameters: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#317" | ||
| given: $.[*].parameters[?(@.$ref == null)] | ||
| severity: error | ||
| then: | ||
| field: required | ||
| function: defined | ||
| path-must-define-specific-response-codes: | ||
| message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#151" | ||
| given: $.[*].responses | ||
| severity: error | ||
| then: | ||
| function: response-validator | ||
| functionOptions: | ||
| rule: 151 | ||
| path-boolean-parameters-must-have-default: | ||
| message: "Rule 310: Optional boolean values must have a default https://sailpoint-oss.github.io/sailpoint-api-guidelines/#310" | ||
| given: $.[*].parameters.[?(@.$ref == null && @.required == false && @.schema.type == 'boolean')].schema | ||
| severity: error | ||
| then: | ||
| field: default | ||
| function: defined | ||
| path-operation-check: | ||
| message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#400" | ||
| given: $ | ||
| severity: error | ||
| then: | ||
| function: path-operation-check | ||
| functionOptions: | ||
| rule: 400 | ||
| # path-parameters-must-have-valid-formats-for-numbers-and-integers: | ||
| # message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#171" | ||
| # given: $.[*].parameters[?(@.$ref == null)] | ||
| # severity: error | ||
| # then: | ||
| # function: path-parameter-integer-number-formats | ||
| # functionOptions: | ||
| # rule: 171 | ||
| # path-summary-length: | ||
| # message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#305" | ||
| # given: $[*].summary | ||
| # severity: warn | ||
| # then: | ||
| # function: word-count | ||
| # functionOptions: | ||
| # maxWordCount: 5 | ||
| # rule: 305 | ||
| # path-description-html-chars: | ||
| # message: "{{error}}" | ||
| # given: $[*].description | ||
| # severity: error | ||
| # then: | ||
| # function: path-descriptions-check | ||
| # functionOptions: | ||
| # rule: 405 | ||
| # path-must-have-security-defined: | ||
| # message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#104" | ||
| # given: $[*] | ||
| # severity: error | ||
| # then: | ||
| # function: path-oauth-scope-check | ||
| # functionOptions: | ||
| # rule: 104 | ||
| # path-deprecated-apis-should-have-deprecation-and-sunset-dates: | ||
| # message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#189" | ||
| # given: $[*] | ||
| # severity: warn | ||
| # then: | ||
| # function: deprecation | ||
| # functionOptions: | ||
| # rule: 189 | ||
| # path-must-have-required-key-on-all-parameters: | ||
| # description: "Rule 317: Operations must have required key on all parameters: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#317" | ||
| # given: $.[*].parameters[?(@.$ref == null)] | ||
| # severity: error | ||
| # then: | ||
| # field: required | ||
| # function: defined | ||
| # path-must-define-specific-response-codes: | ||
| # message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#151" | ||
| # given: $.[*].responses | ||
| # severity: error | ||
| # then: | ||
| # function: response-validator | ||
| # functionOptions: | ||
| # rule: 151 | ||
| # path-boolean-parameters-must-have-default: | ||
| # message: "Rule 310: Optional boolean values must have a default https://sailpoint-oss.github.io/sailpoint-api-guidelines/#310" | ||
| # given: $.[*].parameters.[?(@.$ref == null && @.required == false && @.schema.type == 'boolean')].schema | ||
| # severity: error | ||
| # then: | ||
| # field: default | ||
| # function: defined | ||
| # path-operation-check: | ||
| # message: "{{error}}: https://sailpoint-oss.github.io/sailpoint-api-guidelines/#400" | ||
| # given: $ | ||
| # severity: error | ||
| # then: | ||
| # function: path-operation-check | ||
| # functionOptions: | ||
| # rule: 400 | ||
| # path-parameters-should-have-query-parameter-fields: | ||
| # given: $.[get] | ||
| # severity: warn | ||
|
|
@@ -122,4 +122,6 @@ rules: | |
| # function: path-query-parameter-check | ||
| # functionOptions: | ||
| # field: embed | ||
| # rule: 158 | ||
| # rule: 158 | ||
|
|
||
|
|
||
This file contains hidden or 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
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.
Are you linting agains cloud-api-client-commons? I don't see a main branch on our internal spec repo, just master.