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.
- checksums.yaml +4 -4
- data/.rubocop.yml +25 -3
- data/Gemfile +0 -9
- data/Gemfile.lock +162 -5
- data/LICENSE +674 -1
- data/{LICENSE.Nonstandard → LICENSE.dependabot-core} +0 -0
- data/Makefile +8 -1
- data/README.md +39 -5
- data/demo_script.rb +50 -0
- data/dependabot-linguist.gemspec +16 -5
- data/devlog.md +186 -0
- data/exe/dependabot-linguist +145 -0
- data/lib/dependabot/linguist/dependabot_file_validator.rb +190 -0
- data/lib/dependabot/linguist/dependabot_patch.rb +8 -0
- data/lib/dependabot/linguist/file_fetchers/base.rb +48 -0
- data/lib/dependabot/linguist/file_fetchers/git_submodules.rb +63 -0
- data/lib/dependabot/linguist/file_fetchers/go_modules.rb +41 -0
- data/lib/dependabot/linguist/language.rb +62 -0
- data/lib/dependabot/linguist/languages_to_ecosystems/contexts.rb +234 -0
- data/lib/dependabot/linguist/languages_to_ecosystems/contexts_applied.rb +36 -0
- data/lib/dependabot/linguist/languages_to_ecosystems/languages.yaml +7950 -0
- data/lib/dependabot/linguist/languages_to_ecosystems/main.rb +55 -0
- data/lib/dependabot/linguist/languages_to_ecosystems/manager_ecosystem_maps.rb +154 -0
- data/lib/dependabot/linguist/languages_to_patch.txt +37 -0
- data/lib/dependabot/linguist/linguist_patch.rb +6 -0
- data/lib/dependabot/linguist/repository.rb +232 -0
- data/lib/dependabot/linguist/version.rb +1 -1
- data/lib/dependabot/linguist.rb +5 -2
- data/smoke-test/README.md +58 -0
- data/smoke-test/bundler/Gemfile +9 -0
- data/smoke-test/bundler/Gemfile.lock +47 -0
- data/smoke-test/bundler/dependabot-all-updates-test-staging.gemspec +10 -0
- data/smoke-test/cargo/Cargo.lock +90 -0
- data/smoke-test/cargo/Cargo.toml +8 -0
- data/smoke-test/composer/composer.json +5 -0
- data/smoke-test/composer/composer.lock +72 -0
- data/smoke-test/composer/vendor/autoload.php +7 -0
- data/smoke-test/composer/vendor/composer/ClassLoader.php +445 -0
- data/smoke-test/composer/vendor/composer/LICENSE +21 -0
- data/smoke-test/composer/vendor/composer/autoload_classmap.php +13 -0
- data/smoke-test/composer/vendor/composer/autoload_namespaces.php +9 -0
- data/smoke-test/composer/vendor/composer/autoload_psr4.php +9 -0
- data/smoke-test/composer/vendor/composer/autoload_real.php +55 -0
- data/smoke-test/composer/vendor/composer/autoload_static.php +23 -0
- data/smoke-test/composer/vendor/composer/installed.json +57 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/.gitignore +3 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/LICENSE +504 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/README.md +112 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/changelog.md +530 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/class.phpmailer.php +2758 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/class.pop3.php +417 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/class.smtp.php +1075 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/composer.json +32 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/Callback_function_notes.txt +17 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/DomainKeys_notes.txt +55 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/Note_for_SMTP_debugging.txt +23 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/extending.html +148 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/faq.html +67 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/generatedocs.sh +4 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/pop3_article.txt +39 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/docs/use_gmail.txt +44 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/contents.html +20 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/images/phpmailer.gif +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/images/phpmailer_mini.gif +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/index.html +50 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_db_smtp_basic.php +58 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_mail_advanced.php +30 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_mail_basic.php +41 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_pop_before_smtp_advanced.php +39 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_pop_before_smtp_basic.php +49 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_sendmail_advanced.php +33 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_sendmail_basic.php +43 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_advanced.php +42 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_advanced_no_auth.php +36 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_basic.php +58 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_basic_no_auth.php +53 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_gmail_advanced.php +42 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/examples/test_smtp_gmail_basic.php +59 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/extras/class.html2text.inc +489 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/extras/htmlfilter.php +861 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/extras/ntlm_sasl_client.php +185 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ar.php +26 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-br.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ca.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ch.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-cz.php +24 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-de.php +24 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-dk.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-et.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php +26 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fo.php +26 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php +24 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-hu.php +24 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-it.php +26 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-nl.php +24 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-no.php +24 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-pl.php +24 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php +26 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php +24 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-se.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-sk.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php +26 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php +25 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test/contents.html +10 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test/phpmailerTest.php +1084 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test/test.png +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test/test_callback.php +84 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test/testemail.php +48 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/LGPLv3.txt +165 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/contents.html +14 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/images/aikido.gif +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/images/bkgrnd.gif +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/images/phpmailer.gif +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/index.php +427 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/clipboard.swf +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushBash.js +59 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushCSharp.js +64 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushCpp.js +99 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushCss.js +93 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushDelphi.js +57 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushDiff.js +43 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushGroovy.js +69 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushJScript.js +51 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushJava.js +55 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushPerl.js +74 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushPhp.js +91 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushPlain.js +35 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushPython.js +56 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushRuby.js +57 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushScala.js +53 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushSql.js +68 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushVb.js +58 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shBrushXml.js +71 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shCore.js +30 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/scripts/shLegacy.js +30 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/src/shCore.js +1949 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/src/shLegacy.js +172 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/help.png +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/magnifier.png +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/page_white_code.png +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/page_white_copy.png +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/printer.png +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shCore.css +321 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeDefault.css +191 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeDjango.css +193 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeEmacs.css +192 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeFadeToGrey.css +193 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeMidnight.css +192 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/shThemeRDark.css +192 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/styles/wrapping.png +0 -0
- data/smoke-test/composer/vendor/phpmailer/phpmailer/test_script/test.html +46 -0
- data/smoke-test/dependabot-file/no-config/.github/TARGET.yaml +14 -0
- data/smoke-test/dependabot-file/no-config/bundler/Gemfile +9 -0
- data/smoke-test/dependabot-file/no-config/bundler/Gemfile.lock +47 -0
- data/smoke-test/dependabot-file/no-config/bundler/dependabot-all-updates-test-staging.gemspec +10 -0
- data/smoke-test/dependabot-file/no-config/cargo/Cargo.lock +90 -0
- data/smoke-test/dependabot-file/no-config/cargo/Cargo.toml +8 -0
- data/smoke-test/dependabot-file/no-config/composer/composer.json +5 -0
- data/smoke-test/dependabot-file/no-config/composer/composer.lock +72 -0
- data/smoke-test/dependabot-file/over-config/.github/TARGET.yaml +17 -0
- data/smoke-test/dependabot-file/over-config/.github/dependabot.yaml +12 -0
- data/smoke-test/dependabot-file/over-config/bundler/Gemfile +9 -0
- data/smoke-test/dependabot-file/over-config/bundler/Gemfile.lock +47 -0
- data/smoke-test/dependabot-file/over-config/bundler/dependabot-all-updates-test-staging.gemspec +10 -0
- data/smoke-test/dependabot-file/over-config/cargo/Cargo.lock +90 -0
- data/smoke-test/dependabot-file/over-config/cargo/Cargo.toml +8 -0
- data/smoke-test/dependabot-file/over-config/composer/composer.json +5 -0
- data/smoke-test/dependabot-file/over-config/composer/composer.lock +72 -0
- data/smoke-test/dependabot-file/overer-config/.github/TARGET.yaml +19 -0
- data/smoke-test/dependabot-file/overer-config/.github/dependabot.yaml +12 -0
- data/smoke-test/dependabot-file/overer-config/bundler/Gemfile +9 -0
- data/smoke-test/dependabot-file/overer-config/bundler/Gemfile.lock +47 -0
- data/smoke-test/dependabot-file/overer-config/bundler/dependabot-all-updates-test-staging.gemspec +10 -0
- data/smoke-test/dependabot-file/overer-config/cargo/Cargo.lock +90 -0
- data/smoke-test/dependabot-file/overer-config/cargo/Cargo.toml +8 -0
- data/smoke-test/dependabot-file/overer-config/composer/composer.json +5 -0
- data/smoke-test/dependabot-file/overer-config/composer/composer.lock +72 -0
- data/smoke-test/dependabot-file/partial-config/.github/TARGET.yaml +17 -0
- data/smoke-test/dependabot-file/partial-config/.github/dependabot.yaml +7 -0
- data/smoke-test/dependabot-file/partial-config/bundler/Gemfile +9 -0
- data/smoke-test/dependabot-file/partial-config/bundler/Gemfile.lock +47 -0
- data/smoke-test/dependabot-file/partial-config/bundler/dependabot-all-updates-test-staging.gemspec +10 -0
- data/smoke-test/dependabot-file/partial-config/cargo/Cargo.lock +90 -0
- data/smoke-test/dependabot-file/partial-config/cargo/Cargo.toml +8 -0
- data/smoke-test/dependabot-file/partial-config/composer/composer.json +5 -0
- data/smoke-test/dependabot-file/partial-config/composer/composer.lock +72 -0
- data/smoke-test/docker/Dockerfile +19 -0
- data/smoke-test/elm/elm-package.json +15 -0
- data/smoke-test/elm/elm.json +31 -0
- data/smoke-test/github-actions/both/.github/workflows/this.yaml +11 -0
- data/smoke-test/github-actions/both/yaml/action.yml +13 -0
- data/smoke-test/github-actions/invalid/invalid_file.yaml +0 -0
- data/smoke-test/github-actions/workflow/.github/workflows/this.yaml +11 -0
- data/smoke-test/github-actions/yaml/action.yml +13 -0
- data/smoke-test/gitsubmodule/.gitmodules +4 -0
- data/smoke-test/gomod/go.mod +16 -0
- data/smoke-test/gomod/go.sum +18 -0
- data/smoke-test/gomod/gomain.go +14 -0
- data/smoke-test/gradle/.gitignore +1 -0
- data/smoke-test/gradle/build.gradle +65 -0
- data/smoke-test/maven/pom.xml +65 -0
- data/smoke-test/mix/mix.exs +24 -0
- data/smoke-test/mix/mix.lock +5 -0
- data/smoke-test/npm/package-lock.json +166 -0
- data/smoke-test/npm/package.json +22 -0
- data/smoke-test/npm/removed/package-lock.json +44 -0
- data/smoke-test/npm/removed/package.json +15 -0
- data/smoke-test/nuget/project.csproj +14 -0
- data/smoke-test/pip/pip/requirements.txt +5 -0
- data/smoke-test/pip/pip-compile/requirements.in +2 -0
- data/smoke-test/pip/pip-compile/requirements.txt +16 -0
- data/smoke-test/pip/pipenv/Pipfile +13 -0
- data/smoke-test/pip/pipenv/Pipfile.lock +86 -0
- data/smoke-test/pip/poetry/poetry.lock +33 -0
- data/smoke-test/pip/poetry/pyproject.toml +18 -0
- data/smoke-test/pub/pubspec.lock +40 -0
- data/smoke-test/pub/pubspec.yaml +10 -0
- data/smoke-test/terraform/main.tf +143 -0
- metadata +314 -6
- data/LICENSE.GPL-3.0-only +0 -674
data/Makefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
.PHONY: setup setup_github clean docs test build install push_rubygems push_github
|
1
|
+
.PHONY: setup setup_github clean docs docs_view demo test build install push_rubygems push_github
|
2
2
|
SHELL:=/bin/bash
|
3
3
|
|
4
4
|
# Assumes `gem install bundler`
|
@@ -17,6 +17,13 @@ clean:
|
|
17
17
|
docs: clean
|
18
18
|
bundle exec rake rdoc
|
19
19
|
|
20
|
+
# http://localhost:8080/
|
21
|
+
docs_view: docs
|
22
|
+
ruby -run -e httpd doc
|
23
|
+
|
24
|
+
demo:
|
25
|
+
bundle exec ruby demo_script.rb
|
26
|
+
|
20
27
|
# default (just `rake`) is spec + rubocop, but be pedantic in case this changes.
|
21
28
|
test: clean
|
22
29
|
bundle exec rake spec
|
data/README.md
CHANGED
@@ -1,15 +1,21 @@
|
|
1
1
|
# [dependabot-linguist](https://github.com/Skenvy/dependabot-linguist)
|
2
|
-
Use [linguist](https://github.com/github/linguist) to check the contents of a repository, and then scan for [dependabot-core](https://github.com/dependabot/dependabot-core) ecosystems relevant to those languages!
|
2
|
+
Use [linguist](https://github.com/github/linguist) to check the contents of a **local** repository, and then scan for [dependabot-core](https://github.com/dependabot/dependabot-core) ecosystems relevant to those languages! With the list of [ecosystems](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem) present in a repository, add a [dependabot.y[a]ml](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates) ([configuration file](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file)).
|
3
3
|
## Getting Started
|
4
|
+
### [Linguist dependencies](https://github.com/github/linguist#dependencies);
|
5
|
+
Before installing this gem, which will install the [github-linguist gem](https://rubygems.org/gems/github-linguist), linguists dependencies should be installed. A number of these are enabling [rugged](https://rubygems.org/gems/rugged), so they can't be "ignored" like [dependabot's setup](https://github.com/dependabot/dependabot-core#setup), which _can_ be ignored for the purpose of **this** gem, which only intends to use the [file fetchers](https://github.com/dependabot/dependabot-core/blob/v0.212.0/common/lib/dependabot/file_fetchers/README.md).
|
6
|
+
```bash
|
7
|
+
sudo apt-get install build-essential cmake pkg-config libicu-dev zlib1g-dev libcurl4-openssl-dev libssl-dev ruby-dev
|
8
|
+
```
|
9
|
+
### Install _this_
|
4
10
|
[To install the latest from RubyGems](https://rubygems.org/gems/dependabot-linguist);
|
5
11
|
```sh
|
6
12
|
gem install dependabot-linguist
|
7
13
|
```
|
8
|
-
[Or to install from GitHub's hosted gems](https://github.com/Skenvy/dependabot-linguist/packages/
|
14
|
+
[Or to install from GitHub's hosted gems](https://github.com/Skenvy/dependabot-linguist/packages/1704407);
|
9
15
|
```sh
|
10
16
|
gem install dependabot-linguist --source "https://rubygems.pkg.github.com/skenvy"
|
11
17
|
```
|
12
|
-
###
|
18
|
+
### Or add to the Gemfile
|
13
19
|
[Add the RubyGems hosted gem](https://rubygems.org/gems/dependabot-linguist) with bundler;
|
14
20
|
```sh
|
15
21
|
bundle add dependabot-linguist
|
@@ -18,14 +24,42 @@ Or add the following line to your `Gemfile` manually
|
|
18
24
|
```ruby
|
19
25
|
gem "dependabot-linguist", ">= 0.212.0
|
20
26
|
```
|
21
|
-
[Add the GitHub hosted gem](https://github.com/Skenvy/dependabot-linguist/packages/
|
27
|
+
[Add the GitHub hosted gem](https://github.com/Skenvy/dependabot-linguist/packages/1704407);
|
22
28
|
```ruby
|
23
29
|
source "https://rubygems.pkg.github.com/skenvy" do
|
24
30
|
gem "dependabot-linguist", ">= 0.212.0"
|
25
31
|
end
|
26
32
|
```
|
27
33
|
## Usage
|
28
|
-
TODO
|
34
|
+
The two main classes this provides, `::Dependabot::Linguist::Repository` and `::Dependabot::Linguist::DependabotFileValidator`, can be utilised independently, although the intention is that they be utilised together; to discover the contents of a repository that should be watched with a dependabot file by `Repository`, and subsequently using `DependabotFileValidator` to edit an existing, or add a new, dependabot file to watch the directories that were validated earlier. There is also a CLI tool, `dependabot-linguist`, that wraps these classes and surfaces all the available options to them, although adding automated tests for the executable is still a `#TODO`.
|
35
|
+
### Use the classes in a ruby script, with defaults
|
36
|
+
```ruby
|
37
|
+
require "dependabot/linguist"
|
38
|
+
# Get the list of directories validated for each ecosystem.
|
39
|
+
@repo_path = "." # "here"
|
40
|
+
@repo_name = "Skenvy/dependabot-linguist" # If it were evaluating this repo!
|
41
|
+
@this_repo = ::Dependabot::Linguist::Repository.new(@repo_path, @repo_name)
|
42
|
+
@this_repo.directories_per_ecosystem_validated_by_dependabot
|
43
|
+
# Use this list to see what the recommended update to the existing (or add new) config is.
|
44
|
+
@validator = ::Dependabot::Linguist::DependabotFileValidator.new(repo_path)
|
45
|
+
@validator.load_ecosystem_directories(incoming: @this_repo.directories_per_ecosystem_validated_by_dependabot)
|
46
|
+
@validator.new_config
|
47
|
+
# If you trust it to write the new config;
|
48
|
+
@validator.write_new_config
|
49
|
+
# If you have git, and the gh cli tool installed and configured, and trust this
|
50
|
+
# tool to handle branching, commiting, pushing, and raising a pull request;
|
51
|
+
@validator.commit_new_config
|
52
|
+
```
|
53
|
+
### Use the CLI
|
54
|
+
```bash
|
55
|
+
# With no flags, it'll run "here", and print out the recommended new config.
|
56
|
+
dependabot-linguist
|
57
|
+
# With -w, it'll write the file. You can also specify a path.
|
58
|
+
dependabot-linguist ../../some/other/repo -w
|
59
|
+
# With -x, you'll be trusting it to raise a pull request of the recommended config.
|
60
|
+
# You can also specify a name, which will be required if there isn't a "origin" remote.
|
61
|
+
dependabot-linguist ../../some/other/repo Username/Reponame -x
|
62
|
+
```
|
29
63
|
## [RDoc generated docs](https://skenvy.github.io/dependabot-linguist/)
|
30
64
|
## Developing
|
31
65
|
### The first time setup
|
data/demo_script.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This demonstrates the typical utility of ::Dependabot::Linguist::Repository
|
4
|
+
# and ::Dependabot::Linguist::DependabotFileValidator, by running them both on
|
5
|
+
# this repository's root dir. The <repo>/smoke-test/ dir should contain samples
|
6
|
+
# that will provide at least one valid entry for each ecosystem. Because this
|
7
|
+
# demo is being run on the root of this repository, it will also validate the
|
8
|
+
# presence of the .github/workflows/*.y[a]ml files for github-actions.
|
9
|
+
|
10
|
+
# Notably, it must run on a repo root, as the repo path is used to initialise an
|
11
|
+
# instance of ::Rugged::Repository, both for creating a ::Linguist::Repository
|
12
|
+
# instance, and to load files with ::Rugged::Repository#blob_at. The smoke-test
|
13
|
+
# RSpec tests get around this by frobbing temp repos in each test directory.
|
14
|
+
|
15
|
+
require "dependabot/linguist"
|
16
|
+
require "yaml"
|
17
|
+
|
18
|
+
repo_path = "." # input for both ::Dependabot::Linguist::(Repository, DependabotFileValidator)
|
19
|
+
# The repository name only matters for cloning a public repo, besides ::Dependabot::Source
|
20
|
+
|
21
|
+
this_repo = ::Dependabot::Linguist::Repository.new(repo_path, "Skenvy/dependabot-linguist")
|
22
|
+
|
23
|
+
puts "*"*80
|
24
|
+
# puts "\nThe set of files, per linguist language\n"
|
25
|
+
# puts this_repo.files_per_linguist_language.to_yaml
|
26
|
+
# puts "\nThe set of directories per linguist language\n"
|
27
|
+
# puts this_repo.directories_per_linguist_language.to_yaml
|
28
|
+
# puts "\nThe package managers\n"
|
29
|
+
# puts this_repo.directories_per_package_manager.to_yaml
|
30
|
+
# puts "\nThe package ecosystems\n"
|
31
|
+
# puts this_repo.directories_per_package_ecosystem.to_yaml
|
32
|
+
puts "\nPaydirt; which ecosystem's directory guesses were validated by dependabot!\n"
|
33
|
+
puts this_repo.directories_per_ecosystem_validated_by_dependabot.to_yaml
|
34
|
+
puts "\n"
|
35
|
+
|
36
|
+
validator = ::Dependabot::Linguist::DependabotFileValidator.new(repo_path, max_open_pull_requests_limit: 3)
|
37
|
+
|
38
|
+
puts "*"*80
|
39
|
+
# puts "\nThe dependabot config file path in this repo\n"
|
40
|
+
# puts validator.dependabot_file_path
|
41
|
+
# puts "\nThe existing dependabot configuration state\n"
|
42
|
+
# puts validator.existing_config.to_yaml
|
43
|
+
# puts "\nLoad in the results of the ::Dependabot::Linguist::Repository.directories_per_ecosystem_validated_by_dependabot\n"
|
44
|
+
validator.load_ecosystem_directories(incoming: this_repo.directories_per_ecosystem_validated_by_dependabot) # .to_yaml
|
45
|
+
puts "\nDetermine the drift in configuration -- what already exists, and what should be added (or removed?)\n"
|
46
|
+
puts validator.config_drift.to_yaml
|
47
|
+
puts "\nOutput the recommended 'new' config for the dependabot file.\n"
|
48
|
+
puts validator.new_config.to_yaml
|
49
|
+
# puts "\nWrite the new config to the dependabot file\n"
|
50
|
+
# puts validator.write_new_config
|
data/dependabot-linguist.gemspec
CHANGED
@@ -15,8 +15,8 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.required_ruby_version = ">= 2.7.0"
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = "https://github.com/Skenvy/dependabot-linguist/tree/main/"
|
18
|
-
|
19
|
-
|
18
|
+
|
19
|
+
spec.require_paths = ["lib"]
|
20
20
|
spec.files = Dir.chdir(__dir__) do
|
21
21
|
`git ls-files -z`.split("\x0").reject do |f|
|
22
22
|
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
@@ -24,7 +24,18 @@ Gem::Specification.new do |spec|
|
|
24
24
|
end
|
25
25
|
spec.bindir = "exe"
|
26
26
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
|
28
|
+
spec.add_dependency "rugged", "~> 1.5.0"
|
29
|
+
spec.add_dependency "github-linguist", "7.23.0"
|
30
|
+
# All ecosystem gems from https://rubygems.org/profiles/dependabot can be
|
31
|
+
# required via https://rubygems.org/gems/dependabot-omnibus/versions/0.212.0
|
32
|
+
# which will include all dependencies of omnibus (16 ecosystems and common).
|
33
|
+
# https://github.com/dependabot/dependabot-core/blob/v0.212.0/omnibus/dependabot-omnibus.gemspec#L24-L40
|
34
|
+
spec.add_dependency "dependabot-omnibus", "0.212.0"
|
35
|
+
|
36
|
+
# spec.add_development_dependency "aruba", "~> 2.1" # TODO
|
37
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
38
|
+
spec.add_development_dependency "rdoc", "~> 6.0"
|
39
|
+
spec.add_development_dependency "rspec", "~> 3.12"
|
40
|
+
spec.add_development_dependency "rubocop", "~> 1.37"
|
30
41
|
end
|
data/devlog.md
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
# Devlog
|
2
|
+
## Patching Linguist
|
3
|
+
### Surfacing _all **relevant** languages_
|
4
|
+
A decision on how to patch linguist to surface "all _relevant_ languages" could either be greedy, by making it such that **every** language was surfaced, or minimal so that only a supplied list of languages that would not otherwise, are surfaced. For the greedy approach to patching version `7.23.0`, we would two patches. A good example for why this is necessary is that both gradle and maven are `type: data`, and maven is also `group: XML`. Normally, this would prevent either of these from being reported by linguist unless globs to them were referenced with `linguist-detectable` in a `.gitattributes` file; as explained in [Overrides](https://github.com/github/linguist/blob/v7.23.0/docs/overrides.md). Rather that interact with these, as a repo might include its own `.gitattributes` file, and there is some (?) discussion around adding a "build configuration"-esque type, at a **minimum** a patch is needed to "ungroup" something like maven, that even if set to be detectable, would report itself as "XML" in the output.
|
5
|
+
|
6
|
+
Firstly, we'd need to patch the [`Linguist::BlobHelper::include_in_language_stats`](https://github.com/github/linguist/blob/v7.23.0/lib/linguist/blob_helper.rb) to no longer rely on [`DETECTABLE_TYPES`](https://github.com/github/linguist/blob/v7.23.0/lib/linguist/blob_helper.rb#L376) to avoid surfacing `:type`'s that aren't `:programming` or `:markup`. Something along the lines of;
|
7
|
+
```ruby
|
8
|
+
require 'linguist'
|
9
|
+
|
10
|
+
module Linguist
|
11
|
+
module BlobHelper
|
12
|
+
# Patch out the possibly falsey "detectable"; 'detect' everything!
|
13
|
+
def include_in_language_stats?
|
14
|
+
!vendored? &&
|
15
|
+
!documentation? &&
|
16
|
+
!generated? &&
|
17
|
+
language # && ( defined?(detectable?) && !detectable?.nil? ?
|
18
|
+
# detectable? :
|
19
|
+
# DETECTABLE_TYPES.include?(language.type)
|
20
|
+
# )
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
The other change we'd need to make would be in how the `group` of a language is determined. The [language yaml file](https://github.com/github/linguist/blob/v7.23.0/lib/linguist/languages.yml) is [read in](https://github.com/github/linguist/blob/v7.23.0/lib/linguist/language.rb#L495) and [loaded as yaml](https://github.com/github/linguist/blob/v7.23.0/lib/linguist/language.rb#L502). A ["group" option](https://github.com/github/linguist/blob/v7.23.0/lib/linguist/language.rb#L540) will become the `:group_name` and then [used in initialisation to set the `@group_name`](https://github.com/github/linguist/blob/v7.23.0/lib/linguist/language.rb#L293-L299), which is then used to determine the `@group`. We could do away with groups by patching `Linguist::Language::group` to return the `self.name` that would be assigned to the `group_name` if there was no `group` option input. Something like;
|
27
|
+
```ruby
|
28
|
+
module Linguist
|
29
|
+
class Language
|
30
|
+
def group
|
31
|
+
@group ||= Language.find_by_name(self.name)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
```
|
36
|
+
The alternatively to both of these that is more minimal, is to selectively set the `@type` to `:programming` and `@group_name` to `self.name`.
|
37
|
+
## Debugging Linguist
|
38
|
+
To debug (**printf debugging** tbf tho) certain parts of Linguist's behaviour, these patches, which add `puts` lines to module or class functions, are significant duplications of Linguist's code, so their addition would be under [Linguist's MIT License @v7.23.0](https://github.com/github/linguist/blob/v7.23.0/LICENSE).
|
39
|
+
|
40
|
+
They are all includded under `Copyright (c) 2017 GitHub, Inc.`.
|
41
|
+
### Linguist.detect
|
42
|
+
```ruby
|
43
|
+
# https://github.com/github/linguist/blob/v7.23.0/lib/linguist.rb#L20-L49
|
44
|
+
class << Linguist
|
45
|
+
# Public: Detects the Language of the blob.
|
46
|
+
#
|
47
|
+
# blob - an object that includes the Linguist `BlobHelper` interface;
|
48
|
+
# see Linguist::LazyBlob and Linguist::FileBlob for examples
|
49
|
+
#
|
50
|
+
# Returns Language or nil.
|
51
|
+
def detect(blob, allow_empty: false)
|
52
|
+
# Bail early if the blob is binary or empty.
|
53
|
+
puts "Linguist::detect -- Detecting language on file #{blob.name}"
|
54
|
+
return nil if blob.likely_binary? || blob.binary? || (!allow_empty && blob.empty?)
|
55
|
+
Linguist.instrument("linguist.detection", :blob => blob) do
|
56
|
+
# Call each strategy until one candidate is returned.
|
57
|
+
languages = []
|
58
|
+
returning_strategy = nil
|
59
|
+
STRATEGIES.each do |strategy|
|
60
|
+
returning_strategy = strategy
|
61
|
+
candidates = Linguist.instrument("linguist.strategy", :blob => blob, :strategy => strategy, :candidates => languages) do
|
62
|
+
strategy.call(blob, languages)
|
63
|
+
end
|
64
|
+
if candidates.size == 1
|
65
|
+
languages = candidates
|
66
|
+
break
|
67
|
+
elsif candidates.size > 1
|
68
|
+
# More than one candidate was found, pass them to the next strategy.
|
69
|
+
languages = candidates
|
70
|
+
else
|
71
|
+
# No candidates, try the next strategy
|
72
|
+
end
|
73
|
+
end
|
74
|
+
Linguist.instrument("linguist.detected", :blob => blob, :strategy => returning_strategy, :language => languages.first)
|
75
|
+
languages.first
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
```
|
80
|
+
### Linguist::Repository.compute_stats
|
81
|
+
```ruby
|
82
|
+
# https://github.com/github/linguist/blob/v7.23.0/lib/linguist/repository.rb#L134-L171
|
83
|
+
module Linguist
|
84
|
+
class Repository
|
85
|
+
def compute_stats(old_commit_oid, cache = nil)
|
86
|
+
return {} if current_tree.count_recursive(MAX_TREE_SIZE) >= MAX_TREE_SIZE
|
87
|
+
old_tree = old_commit_oid && Rugged::Commit.lookup(repository, old_commit_oid).tree
|
88
|
+
read_index
|
89
|
+
diff = Rugged::Tree.diff(repository, old_tree, current_tree)
|
90
|
+
# Clear file map and fetch full diff if any .gitattributes files are changed
|
91
|
+
if cache && diff.each_delta.any? { |delta| File.basename(delta.new_file[:path]) == ".gitattributes" }
|
92
|
+
diff = Rugged::Tree.diff(repository, old_tree = nil, current_tree)
|
93
|
+
file_map = {}
|
94
|
+
else
|
95
|
+
file_map = cache ? cache.dup : {}
|
96
|
+
end
|
97
|
+
diff.each_delta do |delta|
|
98
|
+
old = delta.old_file[:path]
|
99
|
+
new = delta.new_file[:path]
|
100
|
+
file_map.delete(old)
|
101
|
+
# next if delta.binary
|
102
|
+
if delta.binary
|
103
|
+
puts "Linguist::Repository::compute_stats -- IGNORE binary file -- #{delta.new_file}"
|
104
|
+
next
|
105
|
+
end
|
106
|
+
if [:added, :modified].include? delta.status
|
107
|
+
# Skip submodules and symlinks
|
108
|
+
mode = delta.new_file[:mode]
|
109
|
+
mode_format = (mode & 0170000)
|
110
|
+
# next if mode_format == 0120000 || mode_format == 040000 || mode_format == 0160000
|
111
|
+
if mode_format == 0120000 || mode_format == 040000 || mode_format == 0160000
|
112
|
+
puts "Linguist::Repository::compute_stats -- IGNORE invalid mode file -- #{delta.new_file}"
|
113
|
+
next
|
114
|
+
else
|
115
|
+
puts "Linguist::Repository::compute_stats -- Process well behaved file -- #{delta.new_file}"
|
116
|
+
end
|
117
|
+
blob = Linguist::LazyBlob.new(repository, delta.new_file[:oid], new, mode.to_s(8))
|
118
|
+
update_file_map(blob, file_map, new)
|
119
|
+
blob.cleanup!
|
120
|
+
end
|
121
|
+
end
|
122
|
+
file_map
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
```
|
127
|
+
### Linguist::Repository.update_file_map
|
128
|
+
```ruby
|
129
|
+
# https://github.com/github/linguist/blob/v7.23.0/lib/linguist/repository.rb#L173-L177
|
130
|
+
module Linguist
|
131
|
+
class Repository
|
132
|
+
def update_file_map(blob, file_map, key)
|
133
|
+
if blob.include_in_language_stats?
|
134
|
+
puts "Linguist::Repository::update_file_map -- Including in language stats; #{blob.name}"
|
135
|
+
file_map[key] = [blob.language.group.name, blob.size]
|
136
|
+
else
|
137
|
+
puts "Linguist::Repository::update_file_map -- NOT including in language stats; #{blob.name}"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
```
|
143
|
+
### Linguist::BlobHelper.include_in_language_stats?
|
144
|
+
```ruby
|
145
|
+
# https://github.com/github/linguist/blob/v7.23.0/lib/linguist/blob_helper.rb#L378-L387
|
146
|
+
module Linguist
|
147
|
+
module BlobHelper
|
148
|
+
def include_in_language_stats?
|
149
|
+
if vendored?
|
150
|
+
# https://github.com/github/linguist/blob/v7.23.0/lib/linguist/blob_helper.rb#L219-L232
|
151
|
+
# VendoredRegexp from https://github.com/github/linguist/blob/v7.23.0/lib/linguist/vendor.yml
|
152
|
+
# Wrapped by https://github.com/github/linguist/blob/v7.23.0/lib/linguist/lazy_blob.rb#L56-L62
|
153
|
+
puts "Linguist::BlobHelper::include_in_language_stats? -- Ignore #{self.name} for being vendored"
|
154
|
+
false
|
155
|
+
elsif documentation?
|
156
|
+
# https://github.com/github/linguist/blob/v7.23.0/lib/linguist/blob_helper.rb#L234-L247
|
157
|
+
# DocumentationRegexp from https://github.com/github/linguist/blob/v7.23.0/lib/linguist/documentation.yml
|
158
|
+
# Wrapped by https://github.com/github/linguist/blob/v7.23.0/lib/linguist/lazy_blob.rb#L40-L46
|
159
|
+
puts "Linguist::BlobHelper::include_in_language_stats? -- Ignore #{self.name} for being documentation"
|
160
|
+
false
|
161
|
+
elsif generated?
|
162
|
+
# https://github.com/github/linguist/blob/v7.23.0/lib/linguist/blob_helper.rb#L350-L360
|
163
|
+
# Wrapped by https://github.com/github/linguist/blob/v7.23.0/lib/linguist/lazy_blob.rb#L48-L54
|
164
|
+
puts "Linguist::BlobHelper::include_in_language_stats? -- Ignore #{self.name} for being generated"
|
165
|
+
false
|
166
|
+
else
|
167
|
+
language && ( defined?(detectable?) && !detectable?.nil? ?
|
168
|
+
detectable? :
|
169
|
+
DETECTABLE_TYPES.include?(language.type)
|
170
|
+
)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
```
|
176
|
+
## Patching Dependabot
|
177
|
+
|
178
|
+
# Other comments to edit into here
|
179
|
+
`bin/console`
|
180
|
+
```rb
|
181
|
+
# https://github.com/github/linguist/issues/1205
|
182
|
+
# https://github.com/github/linguist/issues/3229
|
183
|
+
# Linguists dev's wont implement an option to include submodules in a scan, so
|
184
|
+
# the best option without adding that functionality in a patch is to keep the
|
185
|
+
# smoke-test repo parallel to this one, and run the following to test that.
|
186
|
+
```
|
@@ -0,0 +1,145 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# For this to run without the context of the gem being on the path.
|
5
|
+
$LOAD_PATH[0, 0] = File.join(File.dirname(__FILE__), "..", "lib")
|
6
|
+
|
7
|
+
previous_verbose = $VERBOSE
|
8
|
+
$VERBOSE = nil
|
9
|
+
require "dependabot/linguist"
|
10
|
+
require "optparse"
|
11
|
+
require "yaml"
|
12
|
+
$VERBOSE = previous_verbose
|
13
|
+
|
14
|
+
VERSION = ::Dependabot::Linguist::VERSION
|
15
|
+
BANNER = <<~BANNER
|
16
|
+
Dependabot Linguist v#{VERSION}
|
17
|
+
Detect dependabot ecosystems present for a given git repository, based off using
|
18
|
+
linguist to determine the files present, that could be relevant to an ecosystem,
|
19
|
+
and then verifying that the ecosystem's FileFetcher class is valid on the files.
|
20
|
+
Usage: dependabot-linguist
|
21
|
+
dependabot-linguist <path> <name>
|
22
|
+
dependabot-linguist <path> <name> <options>
|
23
|
+
BANNER
|
24
|
+
|
25
|
+
def dependabot_linguist(args)
|
26
|
+
# Specify defaults
|
27
|
+
# If path is automatic, then remove the test environment path.
|
28
|
+
repo_path = Dir.pwd.delete_suffix("/tmp/aruba")
|
29
|
+
repo_name = nil
|
30
|
+
ignore_linguist = 0
|
31
|
+
|
32
|
+
remove_undiscovered = false
|
33
|
+
update_existing = true
|
34
|
+
minimum_interval = "weekly"
|
35
|
+
max_open_pull_requests_limit = 5
|
36
|
+
|
37
|
+
ecosystem_directories = false
|
38
|
+
print_yaml = true
|
39
|
+
write_file = false
|
40
|
+
submit_pull_request = false
|
41
|
+
|
42
|
+
verbose = false
|
43
|
+
|
44
|
+
# Parse opts
|
45
|
+
OptionParser.new do |opts| # rubocop:disable Metrics/BlockLength
|
46
|
+
opts.banner = BANNER
|
47
|
+
opts.version = VERSION
|
48
|
+
|
49
|
+
opts.on "-i", "--ignore-linguist LEVEL", Integer, "A number, [0, 1, 2] for \"how much to ignore linguist's suggestions\"." do |level|
|
50
|
+
ignore_linguist = level
|
51
|
+
end
|
52
|
+
|
53
|
+
opts.on "-r", "--remove-undiscovered", "Remove entries in an existing dependabot config that weren't found by this." do
|
54
|
+
remove_undiscovered = true
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.on "-u", "--no-update-existing", "By default, existing entries are updated. Use this to toggle that off." do
|
58
|
+
update_existing = false
|
59
|
+
end
|
60
|
+
|
61
|
+
opts.on "-m", "--minimum-interval INTERVAL", String, "The minimum schedule interval; [\"monthly\", \"weekly\", \"daily\"]." do |interval|
|
62
|
+
minimum_interval = interval
|
63
|
+
end
|
64
|
+
|
65
|
+
opts.on "-l", "--max-open-pull-requests-limit LIMIT", Integer, "Limit dependabot's open PR #. Default 5. 0 to disallow non-security updates." do |limit|
|
66
|
+
max_open_pull_requests_limit = limit
|
67
|
+
end
|
68
|
+
|
69
|
+
opts.on "-v", "--verbose", "Output more information." do
|
70
|
+
verbose = true
|
71
|
+
end
|
72
|
+
|
73
|
+
opts.on "-e", "--ecosystem-directories", "Print out the list of directories found for each ecosystem." do
|
74
|
+
ecosystem_directories = true
|
75
|
+
end
|
76
|
+
|
77
|
+
opts.on "-y", "--no-yaml", "Turn off the default output -- the updated dependabot yaml." do
|
78
|
+
print_yaml = false
|
79
|
+
end
|
80
|
+
|
81
|
+
opts.on "-w", "--write-file", "Write the new dependabot config to the file." do
|
82
|
+
write_file = true
|
83
|
+
end
|
84
|
+
|
85
|
+
opts.on "-x", "--pull-request", "Use the external subshell's git/gh cli to commit, push, and PR changes." do
|
86
|
+
submit_pull_request = true
|
87
|
+
end
|
88
|
+
|
89
|
+
opts.on "-h", "--help", "Show help banner." do
|
90
|
+
puts opts
|
91
|
+
exit
|
92
|
+
end
|
93
|
+
end.parse!(args)
|
94
|
+
|
95
|
+
# If all output is turned off, then what's the point in running...
|
96
|
+
if [ecosystem_directories, print_yaml, write_file, submit_pull_request].none? true
|
97
|
+
abort BANNER
|
98
|
+
end
|
99
|
+
|
100
|
+
# Parse optional unopts
|
101
|
+
path_in = args.shift
|
102
|
+
repo_path = path_in if path_in
|
103
|
+
|
104
|
+
name_in = args.shift
|
105
|
+
repo_name = name_in if name_in
|
106
|
+
|
107
|
+
# If no name in, then seek the name in the path'd repo.
|
108
|
+
if repo_name.nil?
|
109
|
+
repo = ::Rugged::Repository.new(repo_path)
|
110
|
+
# Assume there is a remote "origin", and the user/host and path are : sep'd
|
111
|
+
repo_name = repo.remotes["origin"].url.delete_suffix(".git").partition(":").last
|
112
|
+
# Specifying the name in the call is a small sacrifice for this assumption.
|
113
|
+
repo.close
|
114
|
+
end
|
115
|
+
|
116
|
+
this_repo = ::Dependabot::Linguist::Repository.new(
|
117
|
+
repo_path,
|
118
|
+
repo_name,
|
119
|
+
ignore_linguist: ignore_linguist,
|
120
|
+
verbose: verbose
|
121
|
+
)
|
122
|
+
|
123
|
+
puts this_repo.directories_per_ecosystem_validated_by_dependabot.to_yaml if ecosystem_directories
|
124
|
+
|
125
|
+
validator = ::Dependabot::Linguist::DependabotFileValidator.new(
|
126
|
+
repo_path,
|
127
|
+
remove_undiscovered: remove_undiscovered,
|
128
|
+
update_existing: update_existing,
|
129
|
+
minimum_interval: minimum_interval,
|
130
|
+
max_open_pull_requests_limit: max_open_pull_requests_limit,
|
131
|
+
verbose: verbose
|
132
|
+
)
|
133
|
+
|
134
|
+
if [print_yaml, write_file, submit_pull_request].any? true
|
135
|
+
validator.load_ecosystem_directories(incoming: this_repo.directories_per_ecosystem_validated_by_dependabot)
|
136
|
+
end
|
137
|
+
|
138
|
+
puts validator.new_config.to_yaml if print_yaml
|
139
|
+
|
140
|
+
validator.write_new_config if write_file || submit_pull_request
|
141
|
+
|
142
|
+
validator.commit_new_config if submit_pull_request
|
143
|
+
end
|
144
|
+
|
145
|
+
dependabot_linguist(ARGV)
|