dependabot-linguist 0.0.1 → 0.212.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +25 -3
  3. data/Gemfile +0 -9
  4. data/Gemfile.lock +162 -5
  5. data/LICENSE +674 -1
  6. data/{LICENSE.Nonstandard → LICENSE.dependabot-core} +0 -0
  7. data/Makefile +8 -1
  8. data/README.md +39 -5
  9. data/demo_script.rb +50 -0
  10. data/dependabot-linguist.gemspec +16 -5
  11. data/devlog.md +186 -0
  12. data/exe/dependabot-linguist +145 -0
  13. data/lib/dependabot/linguist/dependabot_file_validator.rb +190 -0
  14. data/lib/dependabot/linguist/dependabot_patch.rb +8 -0
  15. data/lib/dependabot/linguist/file_fetchers/base.rb +48 -0
  16. data/lib/dependabot/linguist/file_fetchers/git_submodules.rb +63 -0
  17. data/lib/dependabot/linguist/file_fetchers/go_modules.rb +41 -0
  18. data/lib/dependabot/linguist/language.rb +62 -0
  19. data/lib/dependabot/linguist/languages_to_ecosystems/contexts.rb +234 -0
  20. data/lib/dependabot/linguist/languages_to_ecosystems/contexts_applied.rb +36 -0
  21. data/lib/dependabot/linguist/languages_to_ecosystems/languages.yaml +7950 -0
  22. data/lib/dependabot/linguist/languages_to_ecosystems/main.rb +55 -0
  23. data/lib/dependabot/linguist/languages_to_ecosystems/manager_ecosystem_maps.rb +154 -0
  24. data/lib/dependabot/linguist/languages_to_patch.txt +37 -0
  25. data/lib/dependabot/linguist/linguist_patch.rb +6 -0
  26. data/lib/dependabot/linguist/repository.rb +232 -0
  27. data/lib/dependabot/linguist/version.rb +1 -1
  28. data/lib/dependabot/linguist.rb +5 -2
  29. data/smoke-test/README.md +58 -0
  30. data/smoke-test/bundler/Gemfile +9 -0
  31. data/smoke-test/bundler/Gemfile.lock +47 -0
  32. data/smoke-test/bundler/dependabot-all-updates-test-staging.gemspec +10 -0
  33. data/smoke-test/cargo/Cargo.lock +90 -0
  34. data/smoke-test/cargo/Cargo.toml +8 -0
  35. data/smoke-test/composer/composer.json +5 -0
  36. data/smoke-test/composer/composer.lock +72 -0
  37. data/smoke-test/composer/vendor/autoload.php +7 -0
  38. data/smoke-test/composer/vendor/composer/ClassLoader.php +445 -0
  39. data/smoke-test/composer/vendor/composer/LICENSE +21 -0
  40. data/smoke-test/composer/vendor/composer/autoload_classmap.php +13 -0
  41. data/smoke-test/composer/vendor/composer/autoload_namespaces.php +9 -0
  42. data/smoke-test/composer/vendor/composer/autoload_psr4.php +9 -0
  43. data/smoke-test/composer/vendor/composer/autoload_real.php +55 -0
  44. data/smoke-test/composer/vendor/composer/autoload_static.php +23 -0
  45. data/smoke-test/composer/vendor/composer/installed.json +57 -0
  46. data/smoke-test/composer/vendor/phpmailer/phpmailer/.gitignore +3 -0
  47. data/smoke-test/composer/vendor/phpmailer/phpmailer/LICENSE +504 -0
  48. data/smoke-test/composer/vendor/phpmailer/phpmailer/README.md +112 -0
  49. data/smoke-test/composer/vendor/phpmailer/phpmailer/changelog.md +530 -0
  50. data/smoke-test/composer/vendor/phpmailer/phpmailer/class.phpmailer.php +2758 -0
  51. data/smoke-test/composer/vendor/phpmailer/phpmailer/class.pop3.php +417 -0
  52. data/smoke-test/composer/vendor/phpmailer/phpmailer/class.smtp.php +1075 -0
  53. data/smoke-test/composer/vendor/phpmailer/phpmailer/composer.json +32 -0
  54. data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/Callback_function_notes.txt +17 -0
  55. data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/DomainKeys_notes.txt +55 -0
  56. data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/Note_for_SMTP_debugging.txt +23 -0
  57. data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/extending.html +148 -0
  58. data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/faq.html +67 -0
  59. data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/generatedocs.sh +4 -0
  60. data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/pop3_article.txt +39 -0
  61. data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/use_gmail.txt +44 -0
  62. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/contents.html +20 -0
  63. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/images/phpmailer.gif +0 -0
  64. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/images/phpmailer_mini.gif +0 -0
  65. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/index.html +50 -0
  66. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_db_smtp_basic.php +58 -0
  67. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_mail_advanced.php +30 -0
  68. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_mail_basic.php +41 -0
  69. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_pop_before_smtp_advanced.php +39 -0
  70. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_pop_before_smtp_basic.php +49 -0
  71. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_sendmail_advanced.php +33 -0
  72. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_sendmail_basic.php +43 -0
  73. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_advanced.php +42 -0
  74. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_advanced_no_auth.php +36 -0
  75. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_basic.php +58 -0
  76. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_basic_no_auth.php +53 -0
  77. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_gmail_advanced.php +42 -0
  78. data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_gmail_basic.php +59 -0
  79. data/smoke-test/composer/vendor/phpmailer/phpmailer/extras/class.html2text.inc +489 -0
  80. data/smoke-test/composer/vendor/phpmailer/phpmailer/extras/htmlfilter.php +861 -0
  81. data/smoke-test/composer/vendor/phpmailer/phpmailer/extras/ntlm_sasl_client.php +185 -0
  82. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ar.php +26 -0
  83. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-br.php +25 -0
  84. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ca.php +25 -0
  85. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ch.php +25 -0
  86. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-cz.php +24 -0
  87. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-de.php +24 -0
  88. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-dk.php +25 -0
  89. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php +25 -0
  90. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-et.php +25 -0
  91. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php +26 -0
  92. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fo.php +26 -0
  93. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php +24 -0
  94. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-hu.php +24 -0
  95. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-it.php +26 -0
  96. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php +25 -0
  97. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-nl.php +24 -0
  98. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-no.php +24 -0
  99. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-pl.php +24 -0
  100. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php +26 -0
  101. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php +24 -0
  102. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-se.php +25 -0
  103. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-sk.php +25 -0
  104. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php +26 -0
  105. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh.php +25 -0
  106. data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php +25 -0
  107. data/smoke-test/composer/vendor/phpmailer/phpmailer/test/contents.html +10 -0
  108. data/smoke-test/composer/vendor/phpmailer/phpmailer/test/phpmailerTest.php +1084 -0
  109. data/smoke-test/composer/vendor/phpmailer/phpmailer/test/test.png +0 -0
  110. data/smoke-test/composer/vendor/phpmailer/phpmailer/test/test_callback.php +84 -0
  111. data/smoke-test/composer/vendor/phpmailer/phpmailer/test/testemail.php +48 -0
  112. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/LGPLv3.txt +165 -0
  113. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/contents.html +14 -0
  114. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/images/aikido.gif +0 -0
  115. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/images/bkgrnd.gif +0 -0
  116. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/images/phpmailer.gif +0 -0
  117. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/index.php +427 -0
  118. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/clipboard.swf +0 -0
  119. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushBash.js +59 -0
  120. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushCSharp.js +64 -0
  121. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushCpp.js +99 -0
  122. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushCss.js +93 -0
  123. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushDelphi.js +57 -0
  124. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushDiff.js +43 -0
  125. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushGroovy.js +69 -0
  126. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushJScript.js +51 -0
  127. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushJava.js +55 -0
  128. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushPerl.js +74 -0
  129. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushPhp.js +91 -0
  130. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushPlain.js +35 -0
  131. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushPython.js +56 -0
  132. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushRuby.js +57 -0
  133. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushScala.js +53 -0
  134. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushSql.js +68 -0
  135. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushVb.js +58 -0
  136. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushXml.js +71 -0
  137. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shCore.js +30 -0
  138. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shLegacy.js +30 -0
  139. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/src/shCore.js +1949 -0
  140. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/src/shLegacy.js +172 -0
  141. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/help.png +0 -0
  142. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/magnifier.png +0 -0
  143. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/page_white_code.png +0 -0
  144. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/page_white_copy.png +0 -0
  145. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/printer.png +0 -0
  146. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shCore.css +321 -0
  147. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeDefault.css +191 -0
  148. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeDjango.css +193 -0
  149. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeEmacs.css +192 -0
  150. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeFadeToGrey.css +193 -0
  151. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeMidnight.css +192 -0
  152. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeRDark.css +192 -0
  153. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/wrapping.png +0 -0
  154. data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/test.html +46 -0
  155. data/smoke-test/dependabot-file/no-config/.github/TARGET.yaml +14 -0
  156. data/smoke-test/dependabot-file/no-config/bundler/Gemfile +9 -0
  157. data/smoke-test/dependabot-file/no-config/bundler/Gemfile.lock +47 -0
  158. data/smoke-test/dependabot-file/no-config/bundler/dependabot-all-updates-test-staging.gemspec +10 -0
  159. data/smoke-test/dependabot-file/no-config/cargo/Cargo.lock +90 -0
  160. data/smoke-test/dependabot-file/no-config/cargo/Cargo.toml +8 -0
  161. data/smoke-test/dependabot-file/no-config/composer/composer.json +5 -0
  162. data/smoke-test/dependabot-file/no-config/composer/composer.lock +72 -0
  163. data/smoke-test/dependabot-file/over-config/.github/TARGET.yaml +17 -0
  164. data/smoke-test/dependabot-file/over-config/.github/dependabot.yaml +12 -0
  165. data/smoke-test/dependabot-file/over-config/bundler/Gemfile +9 -0
  166. data/smoke-test/dependabot-file/over-config/bundler/Gemfile.lock +47 -0
  167. data/smoke-test/dependabot-file/over-config/bundler/dependabot-all-updates-test-staging.gemspec +10 -0
  168. data/smoke-test/dependabot-file/over-config/cargo/Cargo.lock +90 -0
  169. data/smoke-test/dependabot-file/over-config/cargo/Cargo.toml +8 -0
  170. data/smoke-test/dependabot-file/over-config/composer/composer.json +5 -0
  171. data/smoke-test/dependabot-file/over-config/composer/composer.lock +72 -0
  172. data/smoke-test/dependabot-file/overer-config/.github/TARGET.yaml +19 -0
  173. data/smoke-test/dependabot-file/overer-config/.github/dependabot.yaml +12 -0
  174. data/smoke-test/dependabot-file/overer-config/bundler/Gemfile +9 -0
  175. data/smoke-test/dependabot-file/overer-config/bundler/Gemfile.lock +47 -0
  176. data/smoke-test/dependabot-file/overer-config/bundler/dependabot-all-updates-test-staging.gemspec +10 -0
  177. data/smoke-test/dependabot-file/overer-config/cargo/Cargo.lock +90 -0
  178. data/smoke-test/dependabot-file/overer-config/cargo/Cargo.toml +8 -0
  179. data/smoke-test/dependabot-file/overer-config/composer/composer.json +5 -0
  180. data/smoke-test/dependabot-file/overer-config/composer/composer.lock +72 -0
  181. data/smoke-test/dependabot-file/partial-config/.github/TARGET.yaml +17 -0
  182. data/smoke-test/dependabot-file/partial-config/.github/dependabot.yaml +7 -0
  183. data/smoke-test/dependabot-file/partial-config/bundler/Gemfile +9 -0
  184. data/smoke-test/dependabot-file/partial-config/bundler/Gemfile.lock +47 -0
  185. data/smoke-test/dependabot-file/partial-config/bundler/dependabot-all-updates-test-staging.gemspec +10 -0
  186. data/smoke-test/dependabot-file/partial-config/cargo/Cargo.lock +90 -0
  187. data/smoke-test/dependabot-file/partial-config/cargo/Cargo.toml +8 -0
  188. data/smoke-test/dependabot-file/partial-config/composer/composer.json +5 -0
  189. data/smoke-test/dependabot-file/partial-config/composer/composer.lock +72 -0
  190. data/smoke-test/docker/Dockerfile +19 -0
  191. data/smoke-test/elm/elm-package.json +15 -0
  192. data/smoke-test/elm/elm.json +31 -0
  193. data/smoke-test/github-actions/both/.github/workflows/this.yaml +11 -0
  194. data/smoke-test/github-actions/both/yaml/action.yml +13 -0
  195. data/smoke-test/github-actions/invalid/invalid_file.yaml +0 -0
  196. data/smoke-test/github-actions/workflow/.github/workflows/this.yaml +11 -0
  197. data/smoke-test/github-actions/yaml/action.yml +13 -0
  198. data/smoke-test/gitsubmodule/.gitmodules +4 -0
  199. data/smoke-test/gomod/go.mod +16 -0
  200. data/smoke-test/gomod/go.sum +18 -0
  201. data/smoke-test/gomod/gomain.go +14 -0
  202. data/smoke-test/gradle/.gitignore +1 -0
  203. data/smoke-test/gradle/build.gradle +65 -0
  204. data/smoke-test/maven/pom.xml +65 -0
  205. data/smoke-test/mix/mix.exs +24 -0
  206. data/smoke-test/mix/mix.lock +5 -0
  207. data/smoke-test/npm/package-lock.json +166 -0
  208. data/smoke-test/npm/package.json +22 -0
  209. data/smoke-test/npm/removed/package-lock.json +44 -0
  210. data/smoke-test/npm/removed/package.json +15 -0
  211. data/smoke-test/nuget/project.csproj +14 -0
  212. data/smoke-test/pip/pip/requirements.txt +5 -0
  213. data/smoke-test/pip/pip-compile/requirements.in +2 -0
  214. data/smoke-test/pip/pip-compile/requirements.txt +16 -0
  215. data/smoke-test/pip/pipenv/Pipfile +13 -0
  216. data/smoke-test/pip/pipenv/Pipfile.lock +86 -0
  217. data/smoke-test/pip/poetry/poetry.lock +33 -0
  218. data/smoke-test/pip/poetry/pyproject.toml +18 -0
  219. data/smoke-test/pub/pubspec.lock +40 -0
  220. data/smoke-test/pub/pubspec.yaml +10 -0
  221. data/smoke-test/terraform/main.tf +143 -0
  222. metadata +314 -6
  223. data/LICENSE.GPL-3.0-only +0 -674
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # All the entries in this file are for facilitating the journey of starting with
4
+ # a list of languages detected by linguist; to travel via the list of "package
5
+ # managers" -> "package ecosystems", to then use those "package ecosystems" to
6
+ # yield the set of keys given to the file_fetchers register function.
7
+ #
8
+ # That is to say; going from the linguist languages to the
9
+ # list of file_fetcher classes that should be checked against!
10
+
11
+ require_relative "contexts_applied"
12
+
13
+ module Dependabot
14
+ module Linguist # rubocop:disable Style/Documentation
15
+ # Returns the set of package managers
16
+ # mapped to in LANGUAGE_TO_PACKAGE_MANAGER
17
+ def self.linguist_languages_to_package_managers(languages)
18
+ package_managers = []
19
+ languages.each do |language|
20
+ unless LANGUAGE_TO_PACKAGE_MANAGER[language].nil?
21
+ if LANGUAGE_TO_PACKAGE_MANAGER[language].is_a?(Array)
22
+ package_managers |= LANGUAGE_TO_PACKAGE_MANAGER[language]
23
+ else
24
+ package_managers |= [LANGUAGE_TO_PACKAGE_MANAGER[language]]
25
+ end
26
+ end
27
+ end
28
+ package_managers
29
+ end
30
+
31
+ # Returns the set of package ecosystems mapped
32
+ # to in PACKAGE_MANAGER_TO_PACKAGE_ECOSYSTEM
33
+ def self.package_managers_to_package_ecosystems(package_managers)
34
+ package_ecosystems = []
35
+ package_managers.each do |package_manager|
36
+ unless PACKAGE_MANAGER_TO_PACKAGE_ECOSYSTEM[package_manager].nil?
37
+ package_ecosystems |= [PACKAGE_MANAGER_TO_PACKAGE_ECOSYSTEM[package_manager]]
38
+ end
39
+ end
40
+ package_ecosystems
41
+ end
42
+
43
+ # Returns the set of file fetcher registry keys mapped
44
+ # to in PACKAGE_ECOSYSTEM_TO_FILE_FETCHERS_REGISTRY_KEY
45
+ def self.package_ecosystems_to_file_fetcher_registry_keys(package_ecosystems)
46
+ file_fetcher_registry_keys = []
47
+ package_ecosystems.each do |package_ecosystem|
48
+ unless PACKAGE_ECOSYSTEM_TO_FILE_FETCHERS_REGISTRY_KEY[package_ecosystem].nil?
49
+ file_fetcher_registry_keys |= [PACKAGE_ECOSYSTEM_TO_FILE_FETCHERS_REGISTRY_KEY[package_ecosystem]]
50
+ end
51
+ end
52
+ file_fetcher_registry_keys
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,154 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Provide the maps from names for "Package Managers" to "Package Ecosystems" and
4
+ # subsequently to the "file fetcher registry keys"
5
+
6
+ # For the list of package managers and which ecosystems they map to, see
7
+ # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
8
+
9
+ # For the file_fetchers' register function, whose keys we map to, see
10
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/common/lib/dependabot/file_fetchers.rb#L14-L16
11
+
12
+ module Dependabot
13
+ module Linguist
14
+ # PackageManagers is the "Package Manager" list on "#package-ecosystem"
15
+ module PackageManagers
16
+ # Bundler; the ruby package manager.
17
+ BUNDLER = "Bundler"
18
+ # Cargo; the rust package manager.
19
+ CARGO = "Cargo"
20
+ # Composer; the PHP package manager.
21
+ COMPOSER = "Composer"
22
+ # Docker; the Docker package manager.
23
+ DOCKER = "Docker"
24
+ # Hex; the Erlang (and Elixir) package manager
25
+ HEX = "Hex"
26
+ # elm-package; the elm package manager.
27
+ ELM_PACKAGE = "elm-package"
28
+ # git submodule versioning is GitHub internal
29
+ GIT_SUBMODULE = "git submodule"
30
+ # GitHub Action versioning is GitHub internal.
31
+ # GitHub Actions expects a directory input of "/",
32
+ # and can't be found by linguist outside of "yaml".
33
+ GITHUB_ACTIONS = "GitHub Actions"
34
+ # Go Modules; versioning is handled via go.mod
35
+ GO_MODULES = "Go modules"
36
+ # Gradle; typically a replacement for maven and any java ecosystem, and
37
+ # supports Java (as well as Kotlin, Groovy, Scala), C/C++, and JavaScript,
38
+ # although it provides plugin capacity to extend it to other languages.
39
+ # Notably the other common Java derivative, clojure, isn't 1st party.
40
+ GRADLE = "Gradle"
41
+ # Maven; typically for the java ecosystem, although has arbitrary
42
+ # extensability via the plugin exec-maven-plugin
43
+ MAVEN = "Maven"
44
+ # npm; the Node package manager. Relevant to any language that could
45
+ # be part of a Node package. Primarily JavaScript and TypeScript.
46
+ NPM = "npm"
47
+ # NuGet; the ".NET" (core, and framework) package manager. Also hosts
48
+ # Xamarain packages and some C++ packages. .NET languages include F#,
49
+ # C# (or, "MicroSoft Java") and Visual Basic. Also supports "ASP.NET".
50
+ NUGET = "NuGet"
51
+ # pip; the python package manager.
52
+ PIP = "pip"
53
+ # pipenv; a python package toolset.
54
+ PIPENV = "pipenv"
55
+ # pip-compile; a python package toolset.
56
+ PIP_COMPILE = "pip-compile"
57
+ # poetry; another python package manager.
58
+ POETRY = "poetry"
59
+ # pub; the package manager for dart and flutter
60
+ PUB = "pub"
61
+ # terraform version management is terraform internal
62
+ TERRAFORM = "Terraform"
63
+ # Yarn; Facebook's alternative to npm, and
64
+ # is similarly relevant to what Node supports.
65
+ YARN = "yarn"
66
+ end
67
+
68
+ # PackageEcosystems is all "YAML Value" listed on "#package-ecosystem",
69
+ # that are the keys to `package-ecosystem` in dependabot yaml.
70
+ module PackageEcosystems
71
+ BUNDLER = "bundler"
72
+ CARGO = "cargo"
73
+ COMPOSER = "composer"
74
+ DOCKER = "docker"
75
+ ELM = "elm"
76
+ GITHUB_ACTIONS = "github-actions"
77
+ GIT_SUBMODULE = "gitsubmodule"
78
+ GOMOD = "gomod"
79
+ GRADLE = "gradle"
80
+ MAVEN = "maven"
81
+ MIX = "mix"
82
+ NPM = "npm"
83
+ NUGET = "nuget"
84
+ PIP = "pip"
85
+ PUB = "pub"
86
+ TERRAFORM = "terraform"
87
+ end
88
+
89
+ # PACKAGE_ECOSYSTEM_TO_FILE_FETCHERS_REGISTRY_KEY maps PackageEcosystems
90
+ # to our end goal of the keys used to collect the respective file fetcher
91
+ # classes that are registered via the "file_fetchers register function"
92
+ # so each mapping |K,V| element should have a comment linking to the place
93
+ # that its value was registered!
94
+ PACKAGE_ECOSYSTEM_TO_FILE_FETCHERS_REGISTRY_KEY = {
95
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/bundler/lib/dependabot/bundler/file_fetcher.rb#L216
96
+ PackageEcosystems::BUNDLER => "bundler",
97
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/cargo/lib/dependabot/cargo/file_fetcher.rb#L295
98
+ PackageEcosystems::CARGO => "cargo",
99
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/composer/lib/dependabot/composer/file_fetcher.rb#L183
100
+ PackageEcosystems::COMPOSER => "composer",
101
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/docker/lib/dependabot/docker/file_fetcher.rb#L103
102
+ PackageEcosystems::DOCKER => "docker",
103
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/elm/lib/dependabot/elm/file_fetcher.rb#L46
104
+ PackageEcosystems::ELM => "elm",
105
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/github_actions/lib/dependabot/github_actions/file_fetcher.rb#L72-L73
106
+ PackageEcosystems::GITHUB_ACTIONS => "github_actions",
107
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/git_submodules/lib/dependabot/git_submodules/file_fetcher.rb#L84-L85
108
+ PackageEcosystems::GIT_SUBMODULE => "submodules",
109
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/go_modules/lib/dependabot/go_modules/file_fetcher.rb#L54-L55
110
+ PackageEcosystems::GOMOD => "go_modules",
111
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/gradle/lib/dependabot/gradle/file_fetcher.rb#L131
112
+ PackageEcosystems::GRADLE => "gradle",
113
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/maven/lib/dependabot/maven/file_fetcher.rb#L142
114
+ PackageEcosystems::MAVEN => "maven",
115
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/hex/lib/dependabot/hex/file_fetcher.rb#L98
116
+ PackageEcosystems::MIX => "hex",
117
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb#L419-L420
118
+ PackageEcosystems::NPM => "npm_and_yarn",
119
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/nuget/lib/dependabot/nuget/file_fetcher.rb#L271
120
+ PackageEcosystems::NUGET => "nuget",
121
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/python/lib/dependabot/python/file_fetcher.rb#L409
122
+ PackageEcosystems::PIP => "pip",
123
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/pub/lib/dependabot/pub/file_fetcher.rb#L46
124
+ PackageEcosystems::PUB => "pub",
125
+ # https://github.com/dependabot/dependabot-core/blob/v0.212.0/terraform/lib/dependabot/terraform/file_fetcher.rb#L90-L91
126
+ PackageEcosystems::TERRAFORM => "terraform"
127
+ }.freeze
128
+
129
+ # PACKAGE_MANAGER_TO_PACKAGE_ECOSYSTEM maps PackageManagers
130
+ # to the PackageEcosystems, according to "#package-ecosystem"
131
+ PACKAGE_MANAGER_TO_PACKAGE_ECOSYSTEM = {
132
+ PackageManagers::BUNDLER => PackageEcosystems::BUNDLER,
133
+ PackageManagers::CARGO => PackageEcosystems::CARGO,
134
+ PackageManagers::COMPOSER => PackageEcosystems::COMPOSER,
135
+ PackageManagers::DOCKER => PackageEcosystems::DOCKER,
136
+ PackageManagers::HEX => PackageEcosystems::MIX,
137
+ PackageManagers::ELM_PACKAGE => PackageEcosystems::ELM,
138
+ PackageManagers::GIT_SUBMODULE => PackageEcosystems::GIT_SUBMODULE,
139
+ PackageManagers::GITHUB_ACTIONS => PackageEcosystems::GITHUB_ACTIONS,
140
+ PackageManagers::GO_MODULES => PackageEcosystems::GOMOD,
141
+ PackageManagers::GRADLE => PackageEcosystems::GRADLE,
142
+ PackageManagers::MAVEN => PackageEcosystems::MAVEN,
143
+ PackageManagers::NPM => PackageEcosystems::NPM,
144
+ PackageManagers::NUGET => PackageEcosystems::NUGET,
145
+ PackageManagers::PIP => PackageEcosystems::PIP,
146
+ PackageManagers::PIPENV => PackageEcosystems::PIP,
147
+ PackageManagers::PIP_COMPILE => PackageEcosystems::PIP,
148
+ PackageManagers::POETRY => PackageEcosystems::PIP,
149
+ PackageManagers::PUB => PackageEcosystems::PUB,
150
+ PackageManagers::TERRAFORM => PackageEcosystems::TERRAFORM,
151
+ PackageManagers::YARN => PackageEcosystems::NPM
152
+ }.freeze
153
+ end
154
+ end
@@ -0,0 +1,37 @@
1
+ Gemfile.lock
2
+ Git Config
3
+ Go Checksums
4
+ Go Module
5
+ Gradle
6
+ JSON
7
+ Maven POM
8
+ NPM Config
9
+ Text
10
+ TOML
11
+ XML
12
+ YAML
13
+ ASP.NET
14
+ C#
15
+ C++
16
+ Clojure
17
+ CoffeeScript
18
+ Dart
19
+ Dockerfile
20
+ Elixir
21
+ Elm
22
+ Erlang
23
+ F#
24
+ Go
25
+ Groovy
26
+ HCL
27
+ Java
28
+ JavaScript
29
+ Kotlin
30
+ Objective-C++
31
+ PHP
32
+ Python
33
+ Ruby
34
+ Rust
35
+ Scala
36
+ TypeScript
37
+ Visual Basic .NET
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Direct the requiring of the files that patch linguist via this.
4
+ # https://github.com/github/linguist/tree/v7.23.0
5
+
6
+ require_relative "language"
@@ -0,0 +1,232 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rugged"
4
+ require_relative "linguist_patch"
5
+ require_relative "languages_to_ecosystems/main"
6
+ require "dependabot/source"
7
+ require "dependabot/errors"
8
+ require "dependabot/omnibus"
9
+ require_relative "dependabot_patch"
10
+
11
+ module Dependabot
12
+ module Linguist
13
+ # Repository wraps a Linguist::Repository, to discover "linguist languages"
14
+ # present in a repository, then maps them to Dependabot Ecosystems, finally
15
+ # verifying that those ecosystems are valid for the places linguist found
16
+ # the languages it thought was relevant to each dependabot ecosystem.
17
+ class Repository
18
+ def initialize(repo_path, repo_name, ignore_linguist: 0, verbose: false)
19
+ @repo_path = repo_path.chomp.delete_suffix("/")
20
+ @repo_name = repo_name
21
+ begin
22
+ @repo = Rugged::Repository.new(@repo_path)
23
+ rescue Rugged::RepositoryError, Rugged::OSError
24
+ # Either the folder doesn't exist, or it does and doesn't have a `.git/`
25
+ # Try to clone into it, if it's public
26
+ puts "Repository #{@repo_name} not found at #{@repo_path}; falling back to cloning public url"
27
+ @repo = Rugged::Repository.clone_at("https://github.com/#{@repo_name}.git", @repo_path)
28
+ end
29
+ @ignore_linguist = [[0, ignore_linguist].max, 2].min
30
+ @verbose = verbose
31
+ @linguist = ::Linguist::Repository.new(@repo, @repo.head.target_id)
32
+ end
33
+
34
+ # Wraps Linguist::Repository.new(~).languages
35
+ def linguist_languages
36
+ @linguist_languages ||= @linguist.languages
37
+ end
38
+
39
+ # linguist_cache, linguist.cache, is a map of
40
+ # "<file_path>" => ["<Language>", <loc>] for
41
+ # any files found for any language looked for.
42
+ def linguist_cache
43
+ @linguist_cache ||= @linguist.cache
44
+ end
45
+
46
+ # rubocop:disable Style/HashTransformValues, Style/BlockDelimiters, Style/MultilineBlockChain
47
+ # Disable these checks to demonstrate this style -- and the first `.to_h {...}` shouldn't be
48
+ # a `.transform_values {...}`` as the Style/HashTransformValues cop requests it to be.
49
+
50
+ # files_per_linguist_language inverts the linguist_cache map to
51
+ # "<Language>" => ["<file_path>", ...], a list of files per language!
52
+ # Note that they are not cleaned in the same way the folder paths in
53
+ # each of the "directories per *" are prepended with a '/'.
54
+ def files_per_linguist_language
55
+ @files_per_linguist_language ||= linguist_cache.keys.group_by { |source_file_path|
56
+ # create the map "<Language>" => ["<file_path>", ...]
57
+ linguist_cache[source_file_path][0]
58
+ }
59
+ end
60
+
61
+ # directories_per_linguist_language inverts the linguist_cache map to
62
+ # "<Language>" => ["<folder_path>", ...], a list of folders per language!
63
+ def directories_per_linguist_language
64
+ @directories_per_linguist_language ||= linguist_cache.keys.to_h { |source_file_path|
65
+ # create the map "<file_path>" => "<folder_path>"
66
+ [source_file_path, "/#{source_file_path.slice(0, source_file_path.rindex("/") || 0)}"]
67
+ }.group_by { |source_file_path, _source_folder_path|
68
+ # create the map "<Language>" => [["<file_path>", "<folder_path>"], ...]
69
+ linguist_cache[source_file_path][0]
70
+ }.to_h { |linguist_language, file_then_folder_arr|
71
+ # create the map "<Language>" => ["<folder_path>", ...] by taking the
72
+ # (&:last) out of each ["<file_path>", "<folder_path>"] pair, uniquely
73
+ [linguist_language, file_then_folder_arr.map(&:last).uniq]
74
+ }
75
+ end
76
+
77
+ # rubocop:enable Style/HashTransformValues, Style/BlockDelimiters, Style/MultilineBlockChain
78
+
79
+ # directories_per_package_manager splits and merges the results of
80
+ # directories_per_linguist_language; split across each package manager that
81
+ # is relevant to the language, and then merges the list of file paths for
82
+ # that language into the list of file paths for each package manager!
83
+ def directories_per_package_manager
84
+ @directories_per_package_manager ||= {}.tap do |this|
85
+ directories_per_linguist_language.each do |linguist_language, source_directories|
86
+ Dependabot::Linguist.linguist_languages_to_package_managers([linguist_language]).each do |dependabot_package_manager|
87
+ this[dependabot_package_manager] = (this[dependabot_package_manager] || []) | source_directories
88
+ end
89
+ end
90
+ # GitHub Actions must be added seperately..
91
+ # if any yaml exist in the workflows folder, it needs to be added at "/"
92
+ if (directories_per_linguist_language["YAML"] || []).any? "/.github/workflows"
93
+ this[PackageManagers::GITHUB_ACTIONS] = ["/"]
94
+ end
95
+ # Because actions are handled like this we also need to regexp for /\/action\.ya?ml$/
96
+ (files_per_linguist_language["YAML"] || []).each do |source_file_path|
97
+ # File paths aren't cleaned from linguist, so prepend the '/' here.
98
+ # This lets it match the \/ before action.ya?ml if it's in the root dir.
99
+ # /(?<dir>\S*)\/(?<file>action\.ya?ml)$/
100
+ action_match = "/#{source_file_path}".match %r{(?<dir>\S*)/(?<file>action\.ya?ml)$}
101
+ if action_match
102
+ # But that also means we then need to check if dir is empty, if it's the root dir
103
+ if action_match[:dir].empty?
104
+ this[PackageManagers::GITHUB_ACTIONS] = (this[PackageManagers::GITHUB_ACTIONS] || []) | ["/"]
105
+ else
106
+ this[PackageManagers::GITHUB_ACTIONS] = (this[PackageManagers::GITHUB_ACTIONS] || []) | [action_match[:dir]]
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
112
+
113
+ # directories_per_package_ecosystem squashes the map of
114
+ # directories_per_package_manager according to the map of managers
115
+ # to ecosystems, as some managers share a common ecosystem name.
116
+ def directories_per_package_ecosystem
117
+ @directories_per_package_ecosystem ||= nil
118
+ if @directories_per_package_ecosystem.nil?
119
+ @directories_per_package_ecosystem = {}
120
+ directories_per_package_manager.each do |dependabot_package_manager, source_directories|
121
+ Dependabot::Linguist.package_managers_to_package_ecosystems([dependabot_package_manager]).each do |dependabot_package_ecosystem|
122
+ if @directories_per_package_ecosystem[dependabot_package_ecosystem].nil?
123
+ @directories_per_package_ecosystem[dependabot_package_ecosystem] = []
124
+ end
125
+ @directories_per_package_ecosystem[dependabot_package_ecosystem] |= source_directories
126
+ end
127
+ end
128
+ end
129
+ @directories_per_package_ecosystem
130
+ end
131
+
132
+ # file_fetcher_class_per_package_ecosystem maps ecosystem names to the
133
+ # class objects for each dependabot file fetcher class that's relevant
134
+ # based on the list of ecosystems found by linguist languages.
135
+ def file_fetcher_class_per_package_ecosystem
136
+ @file_fetcher_class_per_package_ecosystem ||= nil
137
+ if @file_fetcher_class_per_package_ecosystem.nil?
138
+ @file_fetcher_class_per_package_ecosystem = {}
139
+ directories_per_package_ecosystem.each_key do |possible_ecosystem|
140
+ @file_fetcher_class_per_package_ecosystem[possible_ecosystem] =
141
+ Dependabot::FileFetchers.for_package_manager(
142
+ Dependabot::Linguist::PACKAGE_ECOSYSTEM_TO_FILE_FETCHERS_REGISTRY_KEY[possible_ecosystem]
143
+ )
144
+ end
145
+ end
146
+ @file_fetcher_class_per_package_ecosystem
147
+ end
148
+
149
+ # Print out the lists of languages, managers, and ecosystems found here.
150
+ def put_discovery_info
151
+ puts "List of languages: #{directories_per_linguist_language.keys}"
152
+ puts "List of package managers: #{directories_per_package_manager.keys}"
153
+ puts "List of package ecosystems: #{directories_per_package_ecosystem.keys}"
154
+ end
155
+
156
+ # Get ALL directories for the repo path.
157
+ def all_directories
158
+ # /**/*/ rather than /**/ would remove the base path, but delete_prefix
159
+ # will also remove it, so it needs to be specially added.
160
+ @all_directories ||= (["/"] | Dir.glob("#{@repo_path}/**/*/").map { |subpath| subpath.delete_prefix(@repo_path).delete_suffix("/") })
161
+ end
162
+
163
+ # Get ALL sources from ALL directories for the repo path.
164
+ def all_sources
165
+ @all_sources ||= all_directories.collect { |directory| Dependabot::Source.new(provider: "github", repo: @repo_name, directory: directory) }
166
+ end
167
+
168
+ # Get the list of all directories identified by linguist, that
169
+ # had their language mapped to a relevant dependabot ecosystem.
170
+ def linguist_directories
171
+ @linguist_directories ||= directories_per_package_ecosystem.values.flatten.uniq
172
+ end
173
+
174
+ # Get the list of all sources from all directories identified by linguist,
175
+ # that had their language mapped to a relevant dependabot ecosystem.
176
+ def linguist_sources
177
+ @linguist_sources ||= linguist_directories.to_h { |directory| [directory, Dependabot::Source.new(provider: "github", repo: @repo_name, directory: directory)] }
178
+ end
179
+
180
+ def all_ecosystem_classes
181
+ @all_ecosystem_classes ||= PACKAGE_ECOSYSTEM_TO_FILE_FETCHERS_REGISTRY_KEY.transform_values { |k, v| [k, Dependabot::FileFetchers.for_package_manager(v)] }
182
+ end
183
+
184
+ # directories_per_ecosystem_validated_by_dependabot maps each identified
185
+ # present ecosystem to a list of the directories that linguist found files
186
+ # for, that were then validated by running the file_fetcher files on them.
187
+ def directories_per_ecosystem_validated_by_dependabot
188
+ @directories_per_ecosystem_validated_by_dependabot ||= nil
189
+ if @directories_per_ecosystem_validated_by_dependabot.nil?
190
+ enable_options = { kubernetes_updates: true }
191
+ @directories_per_ecosystem_validated_by_dependabot = {}
192
+ case @ignore_linguist
193
+ when 1
194
+ # If ignore linguist is 1, we rely on it to block "vendored"
195
+ # files from the sources, but we run all dependabot classes
196
+ sources = linguist_sources.values
197
+ ecosystem_classes = all_ecosystem_classes
198
+ when 2
199
+ # If ignore linguist is 2, we just don't use it at all.
200
+ sources = all_sources
201
+ ecosystem_classes = all_ecosystem_classes
202
+ else # when 0 is part of this.
203
+ # If ignore linguist is 0, we don't ignore it and rely
204
+ # on it to find sources and pick dependabot classes
205
+ sources = nil
206
+ ecosystem_classes = file_fetcher_class_per_package_ecosystem
207
+ end
208
+ ecosystem_classes.each do |package_ecosystem, file_fetcher_class|
209
+ @directories_per_ecosystem_validated_by_dependabot[package_ecosystem] = []
210
+ puts "Spawning class instances for #{package_ecosystem}, in repo #{@repo_path}, class #{file_fetcher_class}" if @verbose
211
+ sources = directories_per_package_ecosystem[package_ecosystem].collect { |directories| linguist_sources[directories] } unless [1, 2].any? @ignore_linguist
212
+ sources.each do |source|
213
+ fetcher = file_fetcher_class.new(source: source, credentials: [], repo_contents_path: @repo_path, options: enable_options)
214
+ begin
215
+ unless fetcher.files.map(&:name).empty?
216
+ @directories_per_ecosystem_validated_by_dependabot[package_ecosystem] |= [source.directory]
217
+ puts "-- Dependency files FOUND for package-ecosystem #{package_ecosystem} at #{source.directory}; #{fetcher.files.map(&:name)}" if @verbose
218
+ end
219
+ rescue Dependabot::DependabotError => e
220
+ # Most of these will be Dependabot::DependencyFileNotFound
221
+ # or Dependabot::PathDependenciesNotReachable
222
+ puts "-- Caught a DependabotError, #{e.class}, for package-ecosystem #{package_ecosystem} at #{source.directory}: #{e.message}" if @verbose
223
+ end
224
+ end
225
+ end
226
+ @directories_per_ecosystem_validated_by_dependabot = @directories_per_ecosystem_validated_by_dependabot.delete_if { |_, v| v.empty? }.sort.to_h
227
+ end
228
+ @directories_per_ecosystem_validated_by_dependabot
229
+ end
230
+ end
231
+ end
232
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dependabot
4
4
  module Linguist
5
- VERSION = "0.0.1"
5
+ VERSION = "0.212.0"
6
6
  end
7
7
  end
@@ -1,10 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "linguist/version"
4
+ # ::Dependabot::Linguist::Repository, not ::Linguist::Repository,
5
+ # although it does wrap ::Linguist::Repository
6
+ require_relative "linguist/repository"
7
+ require_relative "linguist/dependabot_file_validator"
4
8
 
5
9
  module Dependabot
10
+ # Provides a patched linguist to use to target dependabot relevant ecosystem blobs.
6
11
  module Linguist
7
- class Error < StandardError; end
8
- # Your code goes here...
9
12
  end
10
13
  end
@@ -0,0 +1,58 @@
1
+ # Dependabot smoke testing files
2
+ This `<repo>/smoke-test` directory is essentially equivalent to a clone of the [`dependabot/smoke-tests`](https://github.com/dependabot/smoke-tests) repository. Disclaimer that the `dependabot/smoke-tests` does **not** appear to have any license permitting this to be copied here, yet even if there were, many of the [tests](https://github.com/dependabot/smoke-tests/tree/0e13b71e2d17c7e570448f0696390c6239c1c089/tests) whose files need to be duplicated to replicate the same test, are using old commits, that wouldn't retroactively receive any license if one was added subsequently. I'm relying on the good faith that it absorbs the licensing of the repositories it tests, notably [`dependabot/cli`'s MIT license](https://github.com/dependabot/cli/blob/main/LICENSE) (which comes with `Copyright 2022 GitHub, Inc.`) and [`dependabot/dependabot-core`'s Properity license](https://github.com/dependabot/dependabot-core/blob/main/LICENSE) (which comes with `Contributor: GitHub Inc.`, and has other components duplicated in the gem of this repository, under [this repository's GPLv3 license](https://github.com/Skenvy/dependabot-linguist/blob/main/LICENSE) with a copy of [`dependabot/dependabot-core`'s Properity license](https://github.com/Skenvy/dependabot-linguist/blob/main/LICENSE.dependabot-core)). The most direct assertion of the right to utilise the [`dependabot/smoke-tests`](https://github.com/dependabot/smoke-tests) is exclusively the sentence "You're welcome to use this repo to test Dependabot functionality." from [the README](https://github.com/dependabot/smoke-tests/blob/006edd50f2d8789fea79e7413d15a9ed0348b17d/README.md). I'm hoping this exhaustive attribution is enough while I wait for a result to [asking them to add a license](https://github.com/dependabot/smoke-tests/issues/17).
3
+
4
+ The previous commits that [the current set of smoke tests](https://github.com/dependabot/smoke-tests/tree/0e13b71e2d17c7e570448f0696390c6239c1c089/tests) use, are:
5
+ * [8b2c0d821028c531826db20ca22cffdd2cc05abf](https://github.com/dependabot/smoke-tests/tree/8b2c0d821028c531826db20ca22cffdd2cc05abf)
6
+ * [github_actions](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-actions.yaml#L14)
7
+ * [/actions]()
8
+ * [pub](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-pub.yaml#L26)
9
+ * [/pub]()
10
+ * [terraform](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-terraform.yaml#L23)
11
+ * [/terraform]()
12
+ * [832e37c1a7a4ef89feb9dc7cfa06f62205191994](https://github.com/dependabot/smoke-tests/tree/832e37c1a7a4ef89feb9dc7cfa06f62205191994)
13
+ * [bundler](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-bundler.yaml#L18)
14
+ * [/]()
15
+ * [cargo](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-cargo.yaml#L23)
16
+ * [/]()
17
+ * [docker](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-docker.yaml#L14)
18
+ * [/]()
19
+ * [elm](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-elm.yaml#L26)
20
+ * [/]()
21
+ * [hex](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-hex.yaml#L17)
22
+ * [/]()
23
+ * [maven](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-maven.yaml#L14)
24
+ * [/]()
25
+ * [npm_and_yarn](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-npm.yaml#L14)
26
+ * [/]()
27
+ * [nuget](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-nuget.yaml#L14)
28
+ * [/nuget]()
29
+ * [pip](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-pip-compile.yaml#L13)
30
+ * [/pip-compile]()
31
+ * [pip](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-pip.yaml#L15)
32
+ * [/pip]()
33
+ * [pip](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-pipenv.yaml#L13)
34
+ * [/pipenv]()
35
+ * [pip](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-poetry.yaml#L14)
36
+ * [/poetry]()
37
+ * [bb98f0c3489713c240ccc1f1800008d4f0844dfd](https://github.com/dependabot/smoke-tests/tree/bb98f0c3489713c240ccc1f1800008d4f0844dfd)
38
+ * [composer](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-composer.yaml#L14)
39
+ * [/composer]()
40
+ * [941c9223edd97d233737435a404d038a4bc846c4](https://github.com/dependabot/smoke-tests/tree/941c9223edd97d233737435a404d038a4bc846c4)
41
+ * [go_modules](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-go.yaml#L17)
42
+ * [/go]()
43
+ * [9d77bc7063ed8328a7dbc4fc3b30605530322877](https://github.com/dependabot/smoke-tests/tree/9d77bc7063ed8328a7dbc4fc3b30605530322877)
44
+ * [gradle](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-gradle.yaml#L23)
45
+ * [/gradle]()
46
+ * [4e5e081d77a06dd5092a65e161c1142fbec372bd](https://github.com/dependabot/smoke-tests/tree/4e5e081d77a06dd5092a65e161c1142fbec372bd)
47
+ * [npm_and_yarn](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-npm-remove-transitive.yaml#L25)
48
+ * [/npm/removed]()
49
+ * [d55092e0297999bf4d29725606cfa082b378959a](https://github.com/dependabot/smoke-tests/tree/d55092e0297999bf4d29725606cfa082b378959a)
50
+ * [submodules](https://github.com/dependabot/smoke-tests/blob/0e13b71e2d17c7e570448f0696390c6239c1c089/tests/smoke-submodules.yaml#L10)
51
+ * [/]()
52
+
53
+ The contents are used to test the functionality of **_both_** `linguist` _and_ `dependabot`. The contents don't necessarily need to use the same structure as the earlier commits that the smoke-test repository actually runs it's tests on as our tests are;
54
+ 1. For linguist, that it is able to discover the contents of the folders.
55
+ 1. That the code here is able to map what linguists discovers to the appropriate dependabot class to attempt to fetch the files with
56
+ 1. That the result of running the dependabot classes we've chosen for the folders that linguist found to contain relevant code does result in a list of those ecosystems and the relevant folders in these smoke-test data files.
57
+
58
+ The only adjustment that was notable was having to change the contents of the bundler folder to contain a gemspec.
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem "rubocop", "0.76.0"
8
+ gem "toml-rb", "2.2.0"
9
+ gem 'rack', git: 'git@github.com:rack/rack.git', tag: '2.1.4'
@@ -0,0 +1,47 @@
1
+ GIT
2
+ remote: git@github.com:rack/rack.git
3
+ revision: f3cf79d6460dc592767941806d1b2b7008f73e01
4
+ tag: 2.1.4
5
+ specs:
6
+ rack (2.1.4)
7
+
8
+ PATH
9
+ remote: .
10
+ specs:
11
+ dependabot-all-updates-test-staging (0.0.0)
12
+ netaddr (= 2.0.1)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ ast (2.4.2)
18
+ citrus (3.0.2)
19
+ jaro_winkler (1.5.4)
20
+ netaddr (2.0.1)
21
+ parallel (1.22.1)
22
+ parser (3.1.2.0)
23
+ ast (~> 2.4.1)
24
+ rainbow (3.1.1)
25
+ rubocop (0.76.0)
26
+ jaro_winkler (~> 1.5.1)
27
+ parallel (~> 1.10)
28
+ parser (>= 2.6)
29
+ rainbow (>= 2.2.2, < 4.0)
30
+ ruby-progressbar (~> 1.7)
31
+ unicode-display_width (>= 1.4.0, < 1.7)
32
+ ruby-progressbar (1.11.0)
33
+ toml-rb (2.2.0)
34
+ citrus (~> 3.0, > 3.0)
35
+ unicode-display_width (1.6.1)
36
+
37
+ PLATFORMS
38
+ ruby
39
+
40
+ DEPENDENCIES
41
+ dependabot-all-updates-test-staging!
42
+ rack!
43
+ rubocop (= 0.76.0)
44
+ toml-rb (= 2.2.0)
45
+
46
+ BUNDLED WITH
47
+ 2.1.4
@@ -0,0 +1,10 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'dependabot-all-updates-test-staging'
3
+ s.version = '0.0.0'
4
+ s.description = "Dependabot test ruby"
5
+ s.summary = "dependabot test"
6
+ s.authors = ["No Reply"]
7
+ s.email = 'noreply@github.com'
8
+ s.license = 'MIT'
9
+ s.add_runtime_dependency 'netaddr', '= 2.0.1'
10
+ end