danger-sarif 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/FUNDING.yml +2 -0
- data/.github/workflows/deploy_rubygems.yml +24 -0
- data/.github/workflows/test.yml +13 -0
- data/.gitignore +177 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +96 -0
- data/LICENSE +13 -0
- data/README.md +34 -0
- data/Rakefile +18 -0
- data/danger-sarif.gemspec +28 -0
- data/lib/danger_plugin.rb +3 -0
- data/lib/danger_sarif.rb +3 -0
- data/lib/sarif/gem_version.rb +5 -0
- data/lib/sarif/plugin.rb +68 -0
- data/spec/fixtures/android-lint.sarif +129 -0
- data/spec/fixtures/detekt.sarif +61 -0
- data/spec/fixtures/ktlint.sarif +50 -0
- data/spec/fixtures/pull_request_event.json +6 -0
- data/spec/fixtures/qodana-community-android-short.sarif +109 -0
- data/spec/fixtures/qodana-community-android.sarif +224 -0
- data/spec/sarif_spec.rb +81 -0
- data/spec/spec_helper.rb +54 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8760f99338fc4d1ae9953f9cf38632fb55bbc1a414cd7d9bd7a645592211233e
|
4
|
+
data.tar.gz: f8fb9752cf57614a66c51de7628e70a74f332b953734b347463d807f539f91b3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bbed21ac1459ff7344787101caa6093f3f9daaec7186a8baf09e6a217e944c49ecb3747281650e34f15fb0e1313a8795d1b1061cd14150fb35cff5647a6901d0
|
7
|
+
data.tar.gz: faa5abb83218dbb3797e3cf72de594c20ca5fce35e326b5812d21cf16cc17d769a32a185cb8a8a94092466bcb8e110163ef7a3fb6802aa29a74bdec26b1f4b86
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# v*.*.* tag -> deploy to RubyGems.org
|
2
|
+
name: Deploy to RubyGems.org
|
3
|
+
|
4
|
+
on:
|
5
|
+
push:
|
6
|
+
tags:
|
7
|
+
- v[0-9]+.[0-9]+.[0-9]+*
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
deploy-rubygems:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v3
|
14
|
+
- uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
bundler-cache: true
|
17
|
+
- name: Run Test
|
18
|
+
run: |
|
19
|
+
bundle exec rake spec
|
20
|
+
- name: Deploy to RubyGems.org
|
21
|
+
env:
|
22
|
+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
23
|
+
run: |
|
24
|
+
bundle exec rake release
|
data/.gitignore
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
|
2
|
+
.idea
|
3
|
+
|
4
|
+
# Created by https://www.toptal.com/developers/gitignore/api/intellij,ruby
|
5
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij,ruby
|
6
|
+
|
7
|
+
### Intellij ###
|
8
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
9
|
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
10
|
+
|
11
|
+
# User-specific stuff
|
12
|
+
.idea/**/workspace.xml
|
13
|
+
.idea/**/tasks.xml
|
14
|
+
.idea/**/usage.statistics.xml
|
15
|
+
.idea/**/dictionaries
|
16
|
+
.idea/**/shelf
|
17
|
+
|
18
|
+
# AWS User-specific
|
19
|
+
.idea/**/aws.xml
|
20
|
+
|
21
|
+
# Generated files
|
22
|
+
.idea/**/contentModel.xml
|
23
|
+
|
24
|
+
# Sensitive or high-churn files
|
25
|
+
.idea/**/dataSources/
|
26
|
+
.idea/**/dataSources.ids
|
27
|
+
.idea/**/dataSources.local.xml
|
28
|
+
.idea/**/sqlDataSources.xml
|
29
|
+
.idea/**/dynamic.xml
|
30
|
+
.idea/**/uiDesigner.xml
|
31
|
+
.idea/**/dbnavigator.xml
|
32
|
+
|
33
|
+
# Gradle
|
34
|
+
.idea/**/gradle.xml
|
35
|
+
.idea/**/libraries
|
36
|
+
|
37
|
+
# Gradle and Maven with auto-import
|
38
|
+
# When using Gradle or Maven with auto-import, you should exclude module files,
|
39
|
+
# since they will be recreated, and may cause churn. Uncomment if using
|
40
|
+
# auto-import.
|
41
|
+
# .idea/artifacts
|
42
|
+
# .idea/compiler.xml
|
43
|
+
# .idea/jarRepositories.xml
|
44
|
+
# .idea/modules.xml
|
45
|
+
# .idea/*.iml
|
46
|
+
# .idea/modules
|
47
|
+
# *.iml
|
48
|
+
# *.ipr
|
49
|
+
|
50
|
+
# CMake
|
51
|
+
cmake-build-*/
|
52
|
+
|
53
|
+
# Mongo Explorer plugin
|
54
|
+
.idea/**/mongoSettings.xml
|
55
|
+
|
56
|
+
# File-based project format
|
57
|
+
*.iws
|
58
|
+
|
59
|
+
# IntelliJ
|
60
|
+
out/
|
61
|
+
|
62
|
+
# mpeltonen/sbt-idea plugin
|
63
|
+
.idea_modules/
|
64
|
+
|
65
|
+
# JIRA plugin
|
66
|
+
atlassian-ide-plugin.xml
|
67
|
+
|
68
|
+
# Cursive Clojure plugin
|
69
|
+
.idea/replstate.xml
|
70
|
+
|
71
|
+
# SonarLint plugin
|
72
|
+
.idea/sonarlint/
|
73
|
+
|
74
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
75
|
+
com_crashlytics_export_strings.xml
|
76
|
+
crashlytics.properties
|
77
|
+
crashlytics-build.properties
|
78
|
+
fabric.properties
|
79
|
+
|
80
|
+
# Editor-based Rest Client
|
81
|
+
.idea/httpRequests
|
82
|
+
|
83
|
+
# Android studio 3.1+ serialized cache file
|
84
|
+
.idea/caches/build_file_checksums.ser
|
85
|
+
|
86
|
+
### Intellij Patch ###
|
87
|
+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
88
|
+
|
89
|
+
# *.iml
|
90
|
+
# modules.xml
|
91
|
+
# .idea/misc.xml
|
92
|
+
# *.ipr
|
93
|
+
|
94
|
+
# Sonarlint plugin
|
95
|
+
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
96
|
+
.idea/**/sonarlint/
|
97
|
+
|
98
|
+
# SonarQube Plugin
|
99
|
+
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
100
|
+
.idea/**/sonarIssues.xml
|
101
|
+
|
102
|
+
# Markdown Navigator plugin
|
103
|
+
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
104
|
+
.idea/**/markdown-navigator.xml
|
105
|
+
.idea/**/markdown-navigator-enh.xml
|
106
|
+
.idea/**/markdown-navigator/
|
107
|
+
|
108
|
+
# Cache file creation bug
|
109
|
+
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
110
|
+
.idea/$CACHE_FILE$
|
111
|
+
|
112
|
+
# CodeStream plugin
|
113
|
+
# https://plugins.jetbrains.com/plugin/12206-codestream
|
114
|
+
.idea/codestream.xml
|
115
|
+
|
116
|
+
# Azure Toolkit for IntelliJ plugin
|
117
|
+
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
|
118
|
+
.idea/**/azureSettings.xml
|
119
|
+
|
120
|
+
### Ruby ###
|
121
|
+
*.gem
|
122
|
+
*.rbc
|
123
|
+
/.config
|
124
|
+
/coverage/
|
125
|
+
/InstalledFiles
|
126
|
+
/pkg/
|
127
|
+
/spec/reports/
|
128
|
+
/spec/examples.txt
|
129
|
+
/test/tmp/
|
130
|
+
/test/version_tmp/
|
131
|
+
/tmp/
|
132
|
+
|
133
|
+
# Used by dotenv library to load environment variables.
|
134
|
+
# .env
|
135
|
+
|
136
|
+
# Ignore Byebug command history file.
|
137
|
+
.byebug_history
|
138
|
+
|
139
|
+
## Specific to RubyMotion:
|
140
|
+
.dat*
|
141
|
+
.repl_history
|
142
|
+
build/
|
143
|
+
*.bridgesupport
|
144
|
+
build-iPhoneOS/
|
145
|
+
build-iPhoneSimulator/
|
146
|
+
|
147
|
+
## Specific to RubyMotion (use of CocoaPods):
|
148
|
+
#
|
149
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
150
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
151
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
152
|
+
# vendor/Pods/
|
153
|
+
|
154
|
+
## Documentation cache and generated files:
|
155
|
+
/.yardoc/
|
156
|
+
/_yardoc/
|
157
|
+
/doc/
|
158
|
+
/rdoc/
|
159
|
+
|
160
|
+
## Environment normalization:
|
161
|
+
/.bundle/
|
162
|
+
/vendor/bundle
|
163
|
+
/lib/bundler/man/
|
164
|
+
|
165
|
+
# for a library or gem, you might want to ignore these files since the code is
|
166
|
+
# intended to run in multiple environments; otherwise, check them in:
|
167
|
+
# Gemfile.lock
|
168
|
+
# .ruby-version
|
169
|
+
# .ruby-gemset
|
170
|
+
|
171
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
172
|
+
.rvmrc
|
173
|
+
|
174
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
175
|
+
# .rubocop-https?--*
|
176
|
+
|
177
|
+
# End of https://www.toptal.com/developers/gitignore/api/intellij,ruby
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.2.0
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
danger-sarif (0.1.0)
|
5
|
+
danger-plugin-api (>= 1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.8.5)
|
11
|
+
public_suffix (>= 2.0.2, < 6.0)
|
12
|
+
claide (1.1.0)
|
13
|
+
claide-plugins (0.9.2)
|
14
|
+
cork
|
15
|
+
nap
|
16
|
+
open4 (~> 1.3)
|
17
|
+
colored2 (3.1.2)
|
18
|
+
cork (0.3.0)
|
19
|
+
colored2 (~> 3.1)
|
20
|
+
danger (9.3.1)
|
21
|
+
claide (~> 1.0)
|
22
|
+
claide-plugins (>= 0.9.2)
|
23
|
+
colored2 (~> 3.1)
|
24
|
+
cork (~> 0.1)
|
25
|
+
faraday (>= 0.9.0, < 3.0)
|
26
|
+
faraday-http-cache (~> 2.0)
|
27
|
+
git (~> 1.13)
|
28
|
+
kramdown (~> 2.3)
|
29
|
+
kramdown-parser-gfm (~> 1.0)
|
30
|
+
no_proxy_fix
|
31
|
+
octokit (~> 6.0)
|
32
|
+
terminal-table (>= 1, < 4)
|
33
|
+
danger-plugin-api (1.0.0)
|
34
|
+
danger (> 2.0)
|
35
|
+
diff-lcs (1.5.0)
|
36
|
+
faraday (2.7.10)
|
37
|
+
faraday-net_http (>= 2.0, < 3.1)
|
38
|
+
ruby2_keywords (>= 0.0.4)
|
39
|
+
faraday-http-cache (2.5.0)
|
40
|
+
faraday (>= 0.8)
|
41
|
+
faraday-net_http (3.0.2)
|
42
|
+
faraday-retry (2.2.0)
|
43
|
+
faraday (~> 2.0)
|
44
|
+
git (1.18.0)
|
45
|
+
addressable (~> 2.8)
|
46
|
+
rchardet (~> 1.8)
|
47
|
+
kramdown (2.4.0)
|
48
|
+
rexml
|
49
|
+
kramdown-parser-gfm (1.1.0)
|
50
|
+
kramdown (~> 2.0)
|
51
|
+
nap (1.1.0)
|
52
|
+
no_proxy_fix (0.1.2)
|
53
|
+
octokit (6.1.1)
|
54
|
+
faraday (>= 1, < 3)
|
55
|
+
sawyer (~> 0.9)
|
56
|
+
open4 (1.3.4)
|
57
|
+
public_suffix (5.0.3)
|
58
|
+
rake (13.0.6)
|
59
|
+
rchardet (1.8.0)
|
60
|
+
rexml (3.2.6)
|
61
|
+
rspec (3.12.0)
|
62
|
+
rspec-core (~> 3.12.0)
|
63
|
+
rspec-expectations (~> 3.12.0)
|
64
|
+
rspec-mocks (~> 3.12.0)
|
65
|
+
rspec-core (3.12.2)
|
66
|
+
rspec-support (~> 3.12.0)
|
67
|
+
rspec-expectations (3.12.3)
|
68
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
69
|
+
rspec-support (~> 3.12.0)
|
70
|
+
rspec-mocks (3.12.6)
|
71
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
+
rspec-support (~> 3.12.0)
|
73
|
+
rspec-support (3.12.1)
|
74
|
+
ruby2_keywords (0.0.5)
|
75
|
+
sawyer (0.9.2)
|
76
|
+
addressable (>= 2.3.5)
|
77
|
+
faraday (>= 0.17.3, < 3)
|
78
|
+
terminal-table (3.0.2)
|
79
|
+
unicode-display_width (>= 1.1.1, < 3)
|
80
|
+
unicode-display_width (2.4.2)
|
81
|
+
yard (0.9.34)
|
82
|
+
|
83
|
+
PLATFORMS
|
84
|
+
arm64-darwin-21
|
85
|
+
x86_64-linux
|
86
|
+
|
87
|
+
DEPENDENCIES
|
88
|
+
bundler (>= 2.0)
|
89
|
+
danger-sarif!
|
90
|
+
faraday-retry (>= 2.2.0)
|
91
|
+
rake (>= 10.0)
|
92
|
+
rspec (>= 3.4)
|
93
|
+
yard (>= 0.9.34)
|
94
|
+
|
95
|
+
BUNDLED WITH
|
96
|
+
2.4.17
|
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2023 irgaly
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# danger-sarif
|
2
|
+
|
3
|
+
[Danger](https://github.com/danger/danger) plugin for reporting SARIF file.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```shell
|
8
|
+
$ gem install danger-sarif
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
report from SARIF file
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
# Dangerfile
|
17
|
+
sarif.report 'app/build/reports/lint-results-debug.sarif'
|
18
|
+
```
|
19
|
+
|
20
|
+
report from multiple SARIF files
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
# Dangerfile
|
24
|
+
Dir['**/build/reports/lint-results-*.sarif'].each do |file|
|
25
|
+
sarif.report file
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
## Development
|
30
|
+
|
31
|
+
1. Clone this repo
|
32
|
+
2. Run `bundle install` to setup dependencies.
|
33
|
+
3. Make your changes.
|
34
|
+
4. Run `bundle exec rake spec` to run the tests.
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:specs)
|
7
|
+
|
8
|
+
task default: :specs
|
9
|
+
|
10
|
+
task :spec do
|
11
|
+
Rake::Task["specs"].invoke
|
12
|
+
Rake::Task["spec_docs"].invoke
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Ensure that the plugin passes `danger plugins lint`"
|
16
|
+
task :spec_docs do
|
17
|
+
sh "bundle exec danger plugins lint"
|
18
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "sarif/gem_version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "danger-sarif"
|
9
|
+
spec.version = Sarif::VERSION
|
10
|
+
spec.authors = ["irgaly"]
|
11
|
+
spec.email = ["irgaly@gmail.com"]
|
12
|
+
spec.description = "Danger plugin for reporting SARIF file."
|
13
|
+
spec.summary = "Danger plugin for reporting SARIF file."
|
14
|
+
spec.homepage = "https://github.com/irgaly/danger-sarif"
|
15
|
+
spec.license = "Apache-2.0"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_runtime_dependency "danger-plugin-api", ">= 1.0"
|
23
|
+
spec.add_development_dependency "bundler", ">= 2.0"
|
24
|
+
spec.add_development_dependency "rake", ">= 10.0"
|
25
|
+
spec.add_development_dependency "rspec", ">= 3.4"
|
26
|
+
spec.add_development_dependency "faraday-retry", ">= 2.2.0"
|
27
|
+
spec.add_development_dependency "yard", ">= 0.9.34"
|
28
|
+
end
|
data/lib/danger_sarif.rb
ADDED
data/lib/sarif/plugin.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "uri"
|
4
|
+
require "pathname"
|
5
|
+
|
6
|
+
module Danger
|
7
|
+
# Danger plugin for reporting SARIF file.
|
8
|
+
#
|
9
|
+
# @example report from SARIF file
|
10
|
+
#
|
11
|
+
# sarif.report 'app/build/reports/lint-results-debug.sarif'
|
12
|
+
#
|
13
|
+
# @example report from multiple SARIF files
|
14
|
+
#
|
15
|
+
# Dir['**/build/reports/lint-results-*.sarif'].each do |file|
|
16
|
+
# sarif.report file
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# @see irgaly/danger-sarif
|
20
|
+
# @tags lint, sarif
|
21
|
+
#
|
22
|
+
class DangerSarif < Plugin
|
23
|
+
Warning = Struct.new(:message, :file, :line)
|
24
|
+
|
25
|
+
# Report errors from SARIF file
|
26
|
+
#
|
27
|
+
# @return [void]
|
28
|
+
def report(file, base_dir: nil)
|
29
|
+
parse(file, base_dir: base_dir).each do |warning|
|
30
|
+
warn(warning.message, file: warning.file, line: warning.line)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Parse SARIF file, then return Warnings
|
35
|
+
#
|
36
|
+
# @return [DangerSarif::Warning]
|
37
|
+
def parse(file, base_dir: nil)
|
38
|
+
raise "SARIF file was not found: #{file}" unless File.exist? file
|
39
|
+
base_dir_path = Pathname.new(base_dir || Dir.pwd)
|
40
|
+
json = JSON.parse(File.read(file))
|
41
|
+
json["runs"].flat_map do |run|
|
42
|
+
base_uris = run["originalUriBaseIds"] || {}
|
43
|
+
run["results"].flat_map do |result|
|
44
|
+
message = result["message"]["markdown"] || result["message"]["text"]
|
45
|
+
result["locations"].map do |location|
|
46
|
+
physicalLocation = location["physicalLocation"]
|
47
|
+
artifactLocation = physicalLocation["artifactLocation"]
|
48
|
+
base_uri = base_uris[artifactLocation["uriBaseId"]]
|
49
|
+
uri = artifactLocation["uri"]
|
50
|
+
target_uri = if base_uri&.key?("uri") then
|
51
|
+
File.join(base_uri["uri"], uri)
|
52
|
+
else
|
53
|
+
uri
|
54
|
+
end
|
55
|
+
file = begin
|
56
|
+
target_path = Pathname.new(URI.parse(target_uri).path)
|
57
|
+
target_path.relative_path_from(base_dir_path).to_s
|
58
|
+
rescue ArgumentError
|
59
|
+
target_path.to_s
|
60
|
+
end
|
61
|
+
line = physicalLocation["region"]["startLine"].to_i
|
62
|
+
Warning.new(message: message, file: file, line: line)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
{
|
2
|
+
"$schema" : "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
|
3
|
+
"version" : "2.1.0",
|
4
|
+
"runs" : [
|
5
|
+
{
|
6
|
+
"tool": {
|
7
|
+
"driver": {
|
8
|
+
"name": "Android Lint",
|
9
|
+
"fullName": "Android Lint (in gradle)",
|
10
|
+
"version": "8.0.0",
|
11
|
+
"semanticVersion": "8.0.0",
|
12
|
+
"organization": "Google",
|
13
|
+
"informationUri": "https://developer.android.com/studio/write/lint",
|
14
|
+
"fullDescription": {
|
15
|
+
"text": "Static analysis originally for Android source code but now performing general analysis"
|
16
|
+
},
|
17
|
+
"language": "en-US",
|
18
|
+
"rules": [
|
19
|
+
{
|
20
|
+
"id": "DuplicateIncludedIds",
|
21
|
+
"shortDescription": {
|
22
|
+
"text": "Duplicate ids across layouts combined with include tags"
|
23
|
+
},
|
24
|
+
"fullDescription": {
|
25
|
+
"text": "It's okay for two independent layouts to use the same ids. However, if layouts are combined with include tags, then the id's need to be unique within any chain of included layouts, or Activity#findViewById() can return an unexpected view.",
|
26
|
+
"markdown": "It's okay for two independent layouts to use the same ids. However, if layouts are combined with include tags, then the id's need to be unique within any chain of included layouts, or `Activity#findViewById()` can return an unexpected view."
|
27
|
+
},
|
28
|
+
"defaultConfiguration": {
|
29
|
+
"level": "warning",
|
30
|
+
"rank": 50
|
31
|
+
},
|
32
|
+
"properties": {
|
33
|
+
"tags": [
|
34
|
+
"Correctness"
|
35
|
+
]
|
36
|
+
}
|
37
|
+
}
|
38
|
+
]
|
39
|
+
}
|
40
|
+
},
|
41
|
+
"originalUriBaseIds": {
|
42
|
+
"%SRCROOT%": {
|
43
|
+
"uri": "file:///Users/user_name/"
|
44
|
+
},
|
45
|
+
"USER_HOME": {
|
46
|
+
"uri": "file:///Users/user_name/"
|
47
|
+
}
|
48
|
+
},
|
49
|
+
"results": [
|
50
|
+
{
|
51
|
+
"ruleId": "DuplicateIncludedIds",
|
52
|
+
"ruleIndex": 0,
|
53
|
+
"message": {
|
54
|
+
"text": "Duplicate id @+id/view_id, defined or included multiple times in layout/my_layout.xml: [layout/my_layout.xml defines @+id/view_id, layout/my_layout.xml => layout/my_layout2.xml defines @+id/view_id]",
|
55
|
+
"markdown": "Duplicate id @+id/view_id, defined or included multiple times in layout/my_layout.xml: [layout/my_layout.xml defines @+id/view_id, layout/my_layout.xml => layout/my_layout2.xml defines @+id/view_id]"
|
56
|
+
},
|
57
|
+
"locations": [
|
58
|
+
{
|
59
|
+
"message": {
|
60
|
+
"text": "Duplicate id @+id/view_id, defined or included multiple times in layout/my_layout.xml: [layout/my_layout.xml defines @+id/view_id, layout/my_layout.xml => layout/my_layout2.xml defines @+id/view_id]"
|
61
|
+
},
|
62
|
+
"physicalLocation": {
|
63
|
+
"artifactLocation": {
|
64
|
+
"uriBaseId": "%SRCROOT%",
|
65
|
+
"uri": "app/src/main/res/layout/my_layout.xml"
|
66
|
+
},
|
67
|
+
"region": {
|
68
|
+
"startLine": 10,
|
69
|
+
"startColumn": 20,
|
70
|
+
"endLine": 12,
|
71
|
+
"endColumn": 30,
|
72
|
+
"charOffset": 100,
|
73
|
+
"charLength": 200,
|
74
|
+
"snippet": {
|
75
|
+
"text": "<include\n android:id=\"@+id/view_id\"\n layout=\"@layout/my_layout2\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\" />"
|
76
|
+
}
|
77
|
+
},
|
78
|
+
"contextRegion": {
|
79
|
+
"startLine": 8,
|
80
|
+
"endLine": 16,
|
81
|
+
"snippet": {
|
82
|
+
"text": " android:paddingEnd=\"10dp\">\n\n <include\n android:id=\"@+id/view_id\"\n layout=\"@layout/my_layout2\"\n android:layout_width=\"wrap_content\"\n android:layout_height=\"wrap_content\" />\n"
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
],
|
88
|
+
"relatedLocations": [
|
89
|
+
{
|
90
|
+
"id": 1,
|
91
|
+
"message": {
|
92
|
+
"text": "Defined here"
|
93
|
+
},
|
94
|
+
"physicalLocation": {
|
95
|
+
"artifactLocation": {
|
96
|
+
"uriBaseId": "%SRCROOT%",
|
97
|
+
"uri": "app/src/main/res/layout/my_layout2.xml"
|
98
|
+
},
|
99
|
+
"region": {
|
100
|
+
"startLine": 10,
|
101
|
+
"startColumn": 13,
|
102
|
+
"endLine": 12,
|
103
|
+
"endColumn": 41,
|
104
|
+
"charOffset": 1000,
|
105
|
+
"charLength": 30,
|
106
|
+
"snippet": {
|
107
|
+
"text": "android:id=\"@+id/view_id\""
|
108
|
+
}
|
109
|
+
},
|
110
|
+
"contextRegion": {
|
111
|
+
"startLine": 8,
|
112
|
+
"endLine": 14,
|
113
|
+
"snippet": {
|
114
|
+
"text": "\n <View\n android:id=\"@+id/view_id\"\n android:layout_width=\"match_parent\""
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
],
|
120
|
+
"fixes": [
|
121
|
+
],
|
122
|
+
"partialFingerprints": {
|
123
|
+
"sourceContext/v1": "cd78196d6afed500"
|
124
|
+
}
|
125
|
+
}
|
126
|
+
]
|
127
|
+
}
|
128
|
+
]
|
129
|
+
}
|