Hello, Adding a new module, but I'm getting pre-co...
# linting
a
Hello, Adding a new module, but I'm getting pre-commit errors:
Copy code
git commit -m "add module bamixchecker"
[WARNING] The 'rev' field of repo '<https://github.com/nf-core/tools>' appears to be a mutable reference (moving tag / branch).  Mutable references are never updated after first install and are not supported.  See <https://pre-commit.com/#using-the-latest-version-for-a-repository> for more details.  Hint: `pre-commit autoupdate` often fixes this.
Sort dependencies in conda environment files...............................................Passed
prettier...................................................................................Passed
Match meta.ymls in one of the subdirectories of modules/nf-core............................Failed
- hook id: check-jsonschema
- exit code: 1

Error: schemafile could not be parsed as JSON
SchemaParseError: /home/abenjak/Projects/nf-core/BAMixChecker/modules/modules/yaml-schema.json
  in "/home/abenjak/.cache/pre-commit/repoo3ir6trd/py_env-python3.13/lib/python3.13/site-packages/check_jsonschema/checker.py", line 56
  >>> return self._schema_loader.get_validator(

  caused by

  FailedFileLoadError: Failed to parse /home/abenjak/Projects/nf-core/BAMixChecker/modules/modules/yaml-schema.json
    in "/home/abenjak/.cache/pre-commit/repoo3ir6trd/py_env-python3.13/lib/python3.13/site-packages/check_jsonschema/schema_loader/readers.py", line 27
    >>> schema = callback()

    caused by

    JSONDecodeError: Expecting value: line 1 column 1 (char 0)
      in "/home/abenjak/.cache/pre-commit/repoo3ir6trd/py_env-python3.13/lib/python3.13/site-packages/check_jsonschema/parsers/__init__.py", line 92
      >>> return loadfunc(data)

      caused by

      StopIteration: 0
        in "/home/abenjak/miniconda3/envs/nfcore/lib/python3.13/json/decoder.py", line 361
        >>> obj, end = self.scan_once(s, idx)

Validate environment.ymls against schema...................................................Passed
Match meta.ymls in one of the subdirectories of subworkflows/nf-core...(no files to check)Skipped
Validate GitHub Workflows..............................................(no files to check)Skipped
ruff...................................................................(no files to check)Skipped
ruff-format............................................................(no files to check)Skipped
Check .editorconfig rules..................................................................Failed
- hook id: editorconfig-checker
- exit code: 1

modules/nf-core/bamixchecker/tests/main.nf.test:
	No final newline expected

1 errors found

Lint Dockerfiles.......................................................(no files to check)Skipped
Lint nf-core subworkflows..............................................(no files to check)Skipped
Tried from scratch with all nf-core versions from
2.14.1
to
3.2.0
, with or without
pre-commit autoupdate
. The first error regarding
yaml-schema.json
was already reported in a comment above. The second error
No final newline expected
is wrong because everything is fine with my
main.nf.test
(to make sure, I also tried using
main.nf.test
from another recent module, and it fails the same way).
j
regarding the first fail, can you try linking the file
yaml-schema.json
to
meta-schema.json
? as suggested before
to fix the editorconfig fail, you can delete the final new line
let me know if this fixed it 👀
a
it doesn't work. softlink
yaml-schema.json
to meta-schema.json:
Copy code
ln -sf meta-schema.json modules/yaml-schema.json
ll modules/yaml-schema.json
lrwxrwxrwx 1 abenjak 16 2025-03-17 09:54 modules/yaml-schema.json -> meta-schema.json
but the same error occurs. There are no final new lines in the
main.nf.test
. And I get the same newline error if I try with any other
main.nf.test
from another module. (also in case someone wonders, I'm on Linux, there are no CR LF in my files).
🤔 1
j
can you try committing with the option
--no-verify
and open a PR? that way the tests will run in our runners and you will be able to share the code so we can have a look
👍 1