Module: Octokit::Client::CodeScanning
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/octokit/client/code_scanning.rb |
Overview
Methods for the code scanning alerts API
Instance Method Summary
-
#delete_code_scanning_analysis(repo, analysis_id, options = {}) ⇒ Sawyer::Resource
Delete a specified code scanning analysis from a repository.
-
#get_code_scanning_alert(repo, alert_number, options = {}) ⇒ Sawyer::Resource
Gets a single code scanning alert.
-
#get_code_scanning_analysis(repo, analysis_id, options = {}) ⇒ Sawyer::Resource
Get a code scanning analysis for a repository.
-
#get_code_scanning_default_config(repo, options = {}) ⇒ Sawyer::Resource
Get Code Scanning Default Configuration.
-
#get_codeql_database_for_repo(repo, language, options = {}) ⇒ Sawyer::Resource
Gets a CodeQL database for a language in a repository.
-
#get_sarif_upload_information(repo, sarif_id, options = {}) ⇒ Sawyer::Resource
Gets information about a SARIF upload.
-
#list_code_scanning_alerts_for_org(org, options = {}) ⇒ Array
List code scanning alerts for an organization.
-
#list_code_scanning_alerts_for_repo(repo, options = {}) ⇒ Array
List code scanning alerts for a repository.
-
#list_code_scanning_analysis(repo, options = {}) ⇒ Array
List code scanning analyses for a repository.
-
#list_codeql_database_for_repo(repo, options = {}) ⇒ Array
Lists the CodeQL databases that are available in a repository.
-
#list_instances_of_code_scanning_alert(repo, alert_number, options = {}) ⇒ Array
List instances of a code scanning alert.
-
#update_code_scanning_alert(repo, alert_number, state, reason, comment = nil, options = {}) ⇒ Sawyer::Resource
Update a code scanning alert.
-
#update_code_scanning_default_config(repo, state, query_suite = nil, languages = nil, options = {}) ⇒ Sawyer::Resource
Updates a code scanning default setup configuration.
-
#upload_sarif_data(repo, file, sha, ref, options = {}) ⇒ Sawyer::Resource
Uploads SARIF data containing the results of a code scanning analysis.
- #compress_sarif_data(file) private
Instance Method Details
#compress_sarif_data(file) (private)
[ GitHub ]# File 'lib/octokit/client/code_scanning.rb', line 180
def compress_sarif_data(file) Tempfile.create('sarif.gz') do |tempfile| Zlib::GzipWriter.open(tempfile) do |gz_file| gz_file.write File.binread(file) end [tempfile.read].pack('m0') # Base64.strict_encode64 end end
#delete_code_scanning_analysis(repo, analysis_id, options = {}) ⇒ Sawyer::Resource
Delete a specified code scanning analysis from a repository
# File 'lib/octokit/client/code_scanning.rb', line 67
def delete_code_scanning_analysis(repo, analysis_id, = {}) delete "#{Repository.path repo}/code-scanning/analyses/#{analysis_id}", end
#get_code_scanning_alert(repo, alert_number, options = {}) ⇒ Sawyer::Resource
Gets a single code scanning alert
# File 'lib/octokit/client/code_scanning.rb', line 126
def get_code_scanning_alert(repo, alert_number, = {}) get "#{Repository.path repo}/code-scanning/alerts/#{alert_number}", end
#get_code_scanning_analysis(repo, analysis_id, options = {}) ⇒ Sawyer::Resource
Get a code scanning analysis for a repository
# File 'lib/octokit/client/code_scanning.rb', line 78
def get_code_scanning_analysis(repo, analysis_id, = {}) get "#{Repository.path repo}/code-scanning/analyses/#{analysis_id}", end
#get_code_scanning_default_config(repo, options = {}) ⇒ Sawyer::Resource
Get Code Scanning Default Configuration
# File 'lib/octokit/client/code_scanning.rb', line 35
def get_code_scanning_default_config(repo, = {}) get "#{Repository.path repo}/code-scanning/default-setup", end
#get_codeql_database_for_repo(repo, language, options = {}) ⇒ Sawyer::Resource
Gets a CodeQL database for a language in a repository
# File 'lib/octokit/client/code_scanning.rb', line 46
def get_codeql_database_for_repo(repo, language, = {}) get "#{Repository.path repo}/code-scanning/codeql/databases/#{language}", end
#get_sarif_upload_information(repo, sarif_id, options = {}) ⇒ Sawyer::Resource
Gets information about a SARIF upload
# File 'lib/octokit/client/code_scanning.rb', line 174
def get_sarif_upload_information(repo, sarif_id, = {}) get "#{Repository.path repo}/code-scanning/sarifs/#{sarif_id}", end
#list_code_scanning_alerts_for_org(org, options = {}) ⇒ Array
List code scanning alerts for an organization
# File 'lib/octokit/client/code_scanning.rb', line 146
def list_code_scanning_alerts_for_org(org, = {}) paginate "orgs/#{org}/code-scanning/alerts", end
#list_code_scanning_alerts_for_repo(repo, options = {}) ⇒ Array
List code scanning alerts for a repository
# File 'lib/octokit/client/code_scanning.rb', line 136
def list_code_scanning_alerts_for_repo(repo, = {}) paginate "#{Repository.path repo}/code-scanning/alerts", end
#list_code_scanning_analysis(repo, options = {}) ⇒ Array
List code scanning analyses for a repository
# File 'lib/octokit/client/code_scanning.rb', line 88
def list_code_scanning_analysis(repo, = {}) paginate "#{Repository.path repo}/code-scanning/analyses", end
#list_codeql_database_for_repo(repo, options = {}) ⇒ Array
Lists the CodeQL databases that are available in a repository
# File 'lib/octokit/client/code_scanning.rb', line 56
def list_codeql_database_for_repo(repo, = {}) get "#{Repository.path repo}/code-scanning/codeql/databases", end
#list_instances_of_code_scanning_alert(repo, alert_number, options = {}) ⇒ Array
List instances of a code scanning alert
# File 'lib/octokit/client/code_scanning.rb', line 99
def list_instances_of_code_scanning_alert(repo, alert_number, = {}) paginate "#{Repository.path repo}/code-scanning/alerts/#{alert_number}/instances", end
#update_code_scanning_alert(repo, alert_number, state, reason, comment = nil, options = {}) ⇒ Sawyer::Resource
Update a code scanning alert
# File 'lib/octokit/client/code_scanning.rb', line 111
def update_code_scanning_alert(repo, alert_number, state, reason, comment = nil, = {}) [:state] = state [:dismissed_reason] = reason [:dismissed_comment] = comment if comment patch "#{Repository.path repo}/code-scanning/alerts/#{alert_number}", end
#update_code_scanning_default_config(repo, state, query_suite = nil, languages = nil, options = {}) ⇒ Sawyer::Resource
Updates a code scanning default setup configuration
# File 'lib/octokit/client/code_scanning.rb', line 21
def update_code_scanning_default_config(repo, state, query_suite = nil, languages = nil, = {}) [:state] = state [:query_suite] = query_suite if query_suite [:languages] = languages if languages patch "#{Repository.path repo}/code-scanning/default-setup", end
#upload_sarif_data(repo, file, sha, ref, options = {}) ⇒ Sawyer::Resource
Uploads SARIF data containing the results of a code scanning analysis
# File 'lib/octokit/client/code_scanning.rb', line 159
def upload_sarif_data(repo, file, sha, ref, = {}) [:sarif] = compress_sarif_data(file) [:commit_sha] = sha [:ref] = ref post "#{Repository.path repo}/code-scanning/sarifs", end