Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions detect/research_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package detect

import (
"slices"
"testing"

"github.com/git-pkgs/brief"
)

func TestResearchToolDetectors(t *testing.T) {
dir := t.TempDir()
files := map[string]string{
"analysis/notebook.ipynb": "{}\n",
"report.qmd": "---\ntitle: Analysis\n---\n",
"workflow/Snakefile": "rule all:\n input: []\n",
"nextflow.config": "manifest { name = 'research-pipeline' }\n",
"main.nf": "workflow { }\n",
"pyproject.toml": "[project]\nname = \"research-tools\"\nversion = \"0.1.0\"\n",
"tox.ini": "[tox]\nenv_list = py312\n",
"benchmarks/asv.conf.json": `{"repo": "."}`,
"DESCRIPTION": `Package: researchtools
Version: 0.1.0
Suggests:
covr,
knitr,
pkgdown,
rmarkdown,
testthat
Config/roxygen2/version: 7.3.3
Config/testthat/edition: 3
VignetteBuilder: knitr
`,
"README.Rmd": "---\ntitle: Research tools\n---\n",
"_pkgdown.yml": "url: https://example.com\n",
"renv.lock": `{"R":{"Version":"4.5.0"}}`,
"Project.toml": "name = \"ResearchTools\"\nuuid = \"11111111-1111-1111-1111-111111111111\"\n",
"src/ResearchTools.jl": "module ResearchTools\nend\n",
"docs/Project.toml": "[deps]\nDocumenter = \"e30172f5-a6a5-5a46-863b-614d45cd2de4\"\n",
"docs/make.jl": "using Documenter\n",
".JuliaFormatter.toml": "margin = 92\n",
".github/workflows/format.yml": "name: format\non: push\njobs:\n format:\n runs-on: ubuntu-latest\n steps:\n - uses: fredrikekre/runic-action@v1\n",
"model.f90": "program model\nend program model\n",
"fortitude.toml": "line-length = 100\n",
}
for path, content := range files {
writeProjectFile(t, dir, path, content)
}

report := runOn(t, dir)
want := []struct {
category string
name string
}{
{category: "environment", name: "Jupyter"},
{category: "docs", name: "Quarto"},
{category: "build", name: "Snakemake"},
{category: "build", name: "Nextflow"},
{category: "test", name: "tox"},
{category: "test", name: "ASV"},
{category: "test", name: "testthat"},
{category: "coverage", name: "covr"},
{category: "docs", name: "pkgdown"},
{category: "docs", name: "roxygen2"},
{category: "docs", name: "knitr"},
{category: "docs", name: "R Markdown"},
{category: "docs", name: "Documenter.jl"},
{category: "format", name: "JuliaFormatter"},
{category: "format", name: "Runic"},
{category: "lint", name: "Fortitude"},
}
for _, item := range want {
assertToolDetected(t, report, item.category, item.name)
}
if !slices.ContainsFunc(report.PackageManagers, func(d brief.Detection) bool {
return d.Name == "renv"
}) {
t.Error("expected renv package manager")
}
}

func TestSnakemakeSmkConfigFile(t *testing.T) {
dir := t.TempDir()
const path = "workflow/rules/common.smk"
const configPattern = "**/*.smk"
writeProjectFile(t, dir, path, "rule all:\n input: []\n")

report := runOn(t, dir)
for _, tool := range report.Tools["build"] {
if tool.Name != "Snakemake" {
continue
}
if !slices.Contains(tool.ConfigFiles, configPattern) {
t.Errorf("Snakemake config files = %v, want %q", tool.ConfigFiles, configPattern)
}
return
}
t.Fatal("expected Snakemake in build category")
}
22 changes: 22 additions & 0 deletions knowledge/_shared/jupyter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool]
name = "Jupyter"
category = "environment"
homepage = "https://jupyter.org"
docs = "https://docs.jupyter.org/en/latest/"
repo = "https://github.com/jupyter/jupyter"
description = "Interactive computing environment for notebook documents"

[detect]
files = ["*.ipynb", "**/*.ipynb"]
dependencies = ["jupyter", "jupyterlab", "notebook"]
dev_dependencies = ["jupyter", "jupyterlab", "notebook"]

[commands]
run = "jupyter lab"
alternatives = ["jupyter notebook"]

[config]
files = ["jupyter_server_config.py", "jupyter_notebook_config.py", "jupyter_lab_config.py"]

[taxonomy]
role = ["application"]
21 changes: 21 additions & 0 deletions knowledge/_shared/nextflow.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool]
name = "Nextflow"
category = "build"
homepage = "https://www.nextflow.io"
docs = "https://www.nextflow.io/docs/latest/"
repo = "https://github.com/nextflow-io/nextflow"
description = "Workflow system for portable data pipelines"

[detect]
files = ["nextflow.config", "main.nf", "*.nf", "**/*.nf"]

[commands]
run = "nextflow run main.nf"

[config]
files = ["nextflow.config"]

[taxonomy]
role = ["orchestrator"]
function = ["automation"]
domain = ["scientific-computing"]
22 changes: 22 additions & 0 deletions knowledge/_shared/quarto.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool]
name = "Quarto"
category = "docs"
homepage = "https://quarto.org"
docs = "https://quarto.org/docs/get-started/"
repo = "https://github.com/quarto-dev/quarto-cli"
description = "Scientific and technical publishing system"

[detect]
files = ["_quarto.yml", "_quarto.yaml", "*.qmd", "**/*.qmd"]
dependencies = ["quarto", "quarto-dev/quarto-actions/setup"]
dev_dependencies = ["quarto"]

[commands]
run = "quarto render"
alternatives = ["quarto preview"]

[config]
files = ["_quarto.yml", "_quarto.yaml"]

[taxonomy]
function = ["documentation", "site-generation"]
23 changes: 23 additions & 0 deletions knowledge/_shared/snakemake.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tool]
name = "Snakemake"
category = "build"
homepage = "https://snakemake.github.io"
docs = "https://snakemake.readthedocs.io/en/stable/"
repo = "https://github.com/snakemake/snakemake"
description = "Workflow system for reproducible data analysis"

[detect]
files = ["Snakefile", "**/Snakefile", "*.smk", "**/*.smk"]
dependencies = ["snakemake"]
dev_dependencies = ["snakemake"]

[commands]
run = "snakemake"

[config]
files = ["Snakefile", "**/Snakefile", "*.smk", "**/*.smk"]

[taxonomy]
role = ["orchestrator"]
function = ["automation"]
domain = ["scientific-computing"]
26 changes: 26 additions & 0 deletions knowledge/fortran/fortitude.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[tool]
name = "Fortitude"
category = "lint"
homepage = "https://fortitude.readthedocs.io/"
docs = "https://fortitude.readthedocs.io/"
repo = "https://github.com/PlasmaFAIR/fortitude"
description = "Linter for Fortran"

[detect]
files = ["fortitude.toml", ".fortitude.toml"]
dependencies = ["fortitude", "fortitude-lint"]
dev_dependencies = ["fortitude", "fortitude-lint"]
ecosystems = ["fortran"]
[detect.key_exists]
"fpm.toml" = ["extra.fortitude"]
"pyproject.toml" = ["tool.fortitude"]

[commands]
run = "fortitude check"
alternatives = ["fortitude check --fix"]

[config]
files = ["fortitude.toml", ".fortitude.toml", "fpm.toml", "pyproject.toml"]

[taxonomy]
role = ["linter"]
24 changes: 24 additions & 0 deletions knowledge/julia/documenter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[tool]
name = "Documenter.jl"
category = "docs"
homepage = "https://documenter.juliadocs.org/stable/"
docs = "https://documenter.juliadocs.org/stable/"
repo = "https://github.com/JuliaDocs/Documenter.jl"
description = "Documentation generator for Julia packages"

[detect]
dependencies = ["Documenter"]
dev_dependencies = ["Documenter"]
ecosystems = ["julia"]
[detect.file_contains]
"docs/Project.toml" = ["Documenter"]
"docs/make.jl" = ["Documenter"]

[commands]
run = "julia --project=docs docs/make.jl"

[config]
files = ["docs/Project.toml", "docs/make.jl"]

[taxonomy]
function = ["documentation", "site-generation"]
22 changes: 22 additions & 0 deletions knowledge/julia/juliaformatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool]
name = "JuliaFormatter"
category = "format"
homepage = "https://juliaeditorsupport.github.io/JuliaFormatter.jl/stable/"
docs = "https://juliaeditorsupport.github.io/JuliaFormatter.jl/stable/"
repo = "https://github.com/JuliaEditorSupport/JuliaFormatter.jl"
description = "Code formatter for Julia"

[detect]
files = [".JuliaFormatter.toml"]
dependencies = ["JuliaFormatter"]
dev_dependencies = ["JuliaFormatter"]
ecosystems = ["julia"]

[commands]
run = "julia -e 'using JuliaFormatter; format(\".\")'"

[config]
files = [".JuliaFormatter.toml"]

[taxonomy]
role = ["formatter"]
15 changes: 15 additions & 0 deletions knowledge/julia/runic.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tool]
name = "Runic"
category = "format"
homepage = "https://github.com/fredrikekre/Runic.jl"
docs = "https://github.com/fredrikekre/Runic.jl"
repo = "https://github.com/fredrikekre/Runic.jl"
description = "Code formatter for Julia"

[detect]
dependencies = ["Runic", "fredrikekre/runic-action"]
dev_dependencies = ["Runic"]
ecosystems = ["julia"]

[taxonomy]
role = ["formatter"]
23 changes: 23 additions & 0 deletions knowledge/python/asv.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tool]
name = "ASV"
category = "test"
homepage = "https://asv.readthedocs.io/en/stable/"
docs = "https://asv.readthedocs.io/en/stable/"
repo = "https://github.com/airspeed-velocity/asv"
description = "Python benchmarking tool for tracking performance across revisions"

[detect]
files = ["asv.conf.json", "**/asv.conf.json"]
dependencies = ["asv"]
dev_dependencies = ["asv"]
ecosystems = ["python"]

[commands]
run = "asv run"
alternatives = ["asv publish", "asv preview"]

[config]
files = ["asv.conf.json", "**/asv.conf.json"]

[taxonomy]
function = ["benchmarking"]
25 changes: 25 additions & 0 deletions knowledge/python/tox.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[tool]
name = "tox"
category = "test"
homepage = "https://tox.wiki/en/stable/"
docs = "https://tox.wiki/en/stable/"
repo = "https://github.com/tox-dev/tox"
description = "Python test environment orchestrator"

[detect]
files = ["tox.ini"]
dependencies = ["tox"]
dev_dependencies = ["tox"]
ecosystems = ["python"]
[detect.key_exists]
"pyproject.toml" = ["tool.tox"]

[commands]
run = "tox"

[config]
files = ["tox.ini", "pyproject.toml"]

[taxonomy]
role = ["orchestrator"]
function = ["testing"]
23 changes: 23 additions & 0 deletions knowledge/r/covr.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tool]
name = "covr"
category = "coverage"
homepage = "https://covr.r-lib.org"
docs = "https://covr.r-lib.org"
repo = "https://github.com/r-lib/covr"
description = "Test coverage reporting for R packages"

[detect]
files = [".covrignore"]
dependencies = ["covr"]
dev_dependencies = ["covr"]
ecosystems = ["r"]

[commands]
run = "Rscript -e 'covr::package_coverage()'"
alternatives = ["Rscript -e 'covr::report()'"]

[config]
files = [".covrignore"]

[taxonomy]
function = ["coverage"]
17 changes: 17 additions & 0 deletions knowledge/r/knitr.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tool]
name = "knitr"
category = "docs"
homepage = "https://yihui.org/knitr/"
docs = "https://yihui.org/knitr/"
repo = "https://github.com/yihui/knitr"
description = "Literate programming engine for R documents"

[detect]
dependencies = ["knitr"]
dev_dependencies = ["knitr"]
ecosystems = ["r"]
[detect.file_contains]
"DESCRIPTION" = ["VignetteBuilder: knitr"]

[taxonomy]
function = ["documentation"]
22 changes: 22 additions & 0 deletions knowledge/r/pkgdown.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool]
name = "pkgdown"
category = "docs"
homepage = "https://pkgdown.r-lib.org"
docs = "https://pkgdown.r-lib.org"
repo = "https://github.com/r-lib/pkgdown"
description = "Static documentation sites for R packages"

[detect]
files = ["_pkgdown.yml", "_pkgdown.yaml"]
dependencies = ["pkgdown"]
dev_dependencies = ["pkgdown"]
ecosystems = ["r"]

[commands]
run = "Rscript -e 'pkgdown::build_site()'"

[config]
files = ["_pkgdown.yml", "_pkgdown.yaml"]

[taxonomy]
function = ["documentation", "site-generation"]
Loading