Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Nextflow support #546

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ ipython_config.py

# pyenv
.python-version
.data

# workdir for judge
/workdir/
Expand All @@ -82,3 +83,9 @@ venv-*/
.venv/
node_modules/
result/

# Nextflow
.nextflow*

# .NET
obj/
4 changes: 2 additions & 2 deletions dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ $ cabal v1-install aeson

| Name | Versions | Installation |
|-------------------------|----------|--------------|
| `eslint` | 8.57 | npm package |
| `eslint` | 9.10 | npm package |
| `abstract-syntax-tree` | 2.22 | npm package |

Install npm packages as follows:

```shell
$ npm install eslint@8.57 [email protected]
$ npm install eslint@9.10 [email protected]
```

## Kotlin
Expand Down
66 changes: 16 additions & 50 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 45 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
inputs.nixpkgs.follows = "nixpkgs";
};
poetry2nix = {
url = "github:nix-community/poetry2nix?ref=refs/tags/2024.5.939250";
url = "github:nix-community/poetry2nix?ref=refs/tags/2024.10.1637698";
inputs.nixpkgs.follows = "nixpkgs";
};
};
Expand Down Expand Up @@ -70,20 +70,45 @@
};
};

nextflow-linter = let
codenarc = pkgs.fetchurl {
url = "https://repo1.maven.org/maven2/org/codenarc/CodeNarc/3.5.0/CodeNarc-3.5.0-all.jar";
hash = "sha256-wTGPxP5sjMPPake3WM6Fcz551WIe8C+c6AtCtjBa3jI=";
};
linter-rules = pkgs.fetchurl {
url = "https://github.com/awslabs/linter-rules-for-nextflow/releases/download/v0.1.0/linter-rules-0.1.jar";
hash = "sha256-IHl2jAtZyloZLXybLNBELnTyld+ZA9q5Srta7LeUeHs=";
};
slf4j-api = pkgs.fetchurl {
url = "https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar";
hash = "sha256-0+9XXj5JeWeNwBvx3M5RAhSTtNEft/G+itmCh3wWocA=";
};
slf4j-simple = pkgs.fetchurl {
url = "https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/1.7.36/slf4j-simple-1.7.36.jar";
hash = "sha256-Lzm+2UPWJN+o9BAtBXEoOhCHC2qjbxl6ilBvFHAQwQ8=";
};
in pkgs.writeScriptBin "nextflow-linter" ''
${pkgs.jre_minimal}/bin/java \
-Dorg.slf4j.simpleLogger.defaultLogLevel=error \
-classpath "${linter-rules}/linter-rules-0.1.jar:${codenarc}/CodeNarc-3.5.0-all.jar:${slf4j-api}/slf4j-api-1.7.36.jar:${slf4j-simple}/slf4j-simple-1.7.36.jar" \
"org.codenarc.CodeNarc"
'';

# General dependencies for other languages
haskell-deps = [
(pkgs.haskell.packages.ghc96.ghcWithPackages (p: [ p.aeson ]))
pkgs.hlint
];
node-deps = [ nodejs_base pkgs.nodePackages.eslint ast ];
node-deps = [ nodejs_base pkgs.eslint ast ];
bash-deps = [ pkgs.shellcheck ];
c-deps = [ pkgs.cppcheck pkgs.gcc13 ];
java-deps = [ pkgs.openjdk21 pkgs.checkstyle ];
kotlin-deps = [ pkgs.kotlin pkgs.ktlint ];
csharp-deps = [ pkgs.dotnetCorePackages.sdk_8_0 ];
nextflow-deps = [ pkgs.nextflow pkgs.groovy nextflow-linter ];

all-other-dependencies = haskell-deps ++ node-deps ++ bash-deps
++ c-deps ++ java-deps ++ kotlin-deps ++ csharp-deps
++ c-deps ++ java-deps ++ kotlin-deps ++ csharp-deps ++ nextflow-deps
++ [ pkgs.coreutils ];

python-base-env = {
Expand Down Expand Up @@ -124,6 +149,8 @@
export DOTNET_CLI_HOME
NODE_PATH=${ast}/lib/node_modules
export NODE_PATH
ESLINT_USE_FLAT_CONFIG=false
export ESLINT_USE_FLAT_CONFIG
poetry run pytest -n auto --cov=tested --cov-report=xml tests/
'';
installPhase = ''
Expand All @@ -138,7 +165,7 @@
tested = pkgs.devshell.mkShell {
name = "TESTed";

packages = [ python-dev-env pkgs.nodePackages.pyright poetry-package ]
packages = [ python-dev-env pkgs.pyright poetry-package ]
++ all-other-dependencies;

devshell.startup.link.text = ''
Expand All @@ -155,6 +182,19 @@
name = "NODE_PATH";
prefix = "${ast}/lib/node_modules";
}

{
name = "ESLINT_USE_FLAT_CONFIG";
eval = "false";
}
{
name = "NXF_DISABLE_CHECK_LATEST";
eval = "true";
}
{
name = "NXF_OFFLINE";
eval = "true";
}
];
commands = [
{
Expand All @@ -172,7 +212,7 @@
];
};
types = pkgs.mkShell {
packages = [ python-dev-env pkgs.nodePackages.pyright ];
packages = [ python-dev-env pkgs.pyright ];
};
format = pkgs.mkShell { packages = [ python-dev-env poetry-package ]; };
};
Expand Down
5 changes: 5 additions & 0 deletions tested/internationalization/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ en:
timeout: "HLint exceeded time limit"
memory: "HLint exceeded memory limit"
output: "HLint produced bad output."
nextflow:
linter:
timeout: "CodeNarc exceeded time limit"
memory: "CodeNarc exceeded memory limit"
output: "CodeNarc produced bad output."
kotlin:
linter:
timeout: "KTLint exceeded time limit"
Expand Down
2 changes: 2 additions & 0 deletions tested/languages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from tested.languages.javascript.config import JavaScript
from tested.languages.kotlin.config import Kotlin
from tested.languages.language import Language
from tested.languages.nextflow.config import Nextflow
from tested.languages.python.config import Python
from tested.languages.runhaskell.config import RunHaskell

Expand All @@ -31,6 +32,7 @@
"java": Java,
"javascript": JavaScript,
"kotlin": Kotlin,
"nextflow": Nextflow,
"python": Python,
"runhaskell": RunHaskell,
"csharp": CSharp,
Expand Down
2 changes: 1 addition & 1 deletion tested/languages/haskell/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def run_hlint(
config: DodonaConfig, remaining: float
) -> tuple[list[Message], list[AnnotateCode]]:
"""
Calls eslint to annotate submitted source code and adds resulting score and
Calls hlint to annotate submitted source code and adds resulting score and
annotations to tab.
"""
submission = config.source
Expand Down
Loading
Loading