Giter VIP home page Giter VIP logo

pre-commit-maven's Introduction

pre-commit-maven

Build Status Code Coverage

Some out-of-the-box hooks for pre-commit.

See also: https://github.com/pre-commit/pre-commit

Using pre-commit-maven with pre-commit

Add this to your .pre-commit-config.yaml

repos:
-   repo: https://github.com/ejba/pre-commit-maven
    rev: v0.3.3
    hooks:
    -   id: maven
        args: ['clean compile']
    -   id: maven-spotless-apply
    # -   id: ...

Hooks available

maven

Runs arbitrary maven commands. args: ['clean compile verify'].

maven-compile

Runs compile build lifecycle.

maven-test

Runs test build lifecycle.

maven-checkstyle

Runs checkstyle:check.

maven-spotless-check

Runs spotless:check.

maven-spotless-apply

Runs spotless:apply.

pre-commit-maven's People

Contributors

ejba avatar stea-uw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pre-commit-maven's Issues

maven-checkstyle hook missing

Since we updated to v0.3.1, precommit complains that the maven-checkstyle hook is missing.
Was it accidentally removed or was this a conscious decision?

maven hook fails

Hi,

Maven hook is failing. Can you please help me resolve this?

Traceback (most recent call last):
File "/Users/****/.cache/pre-commit/repomy5pvoj0/py_env-python3.9/bin/maven", line 8, in
sys.exit(main())
TypeError: main() missing 1 required positional argument: 'argv'

Here is my pre-commit-config:

Installation fails (tried python 3.9 / 3.10)

Hello,
The installation of the plugin fails on MacOS using python3.9 or 3.10.

The log indicates that :

configuration error: project must contain ['name'] properties
DESCRIPTION:
Data structure for the project table inside pyproject.toml (as
initially defined in :pep:621)
...
ValueError: invalid pyproject.toml config: project

Have you already faced this kind of issue ?
Please let me know if you need further logs.

Regards,
Djow

Can't run on Python 3.11 with latest setuptools

See PR #10

Setuptools complains that it cannot install this package due to the "description" and "requires-python" being set dynamically.

Do we need to add description and requires-python to the "dynamic" field?

[INFO] Installing environment for https://github.com/ejba/pre-commit-maven.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/Users/sweiss/.cache/pre-commit/repo50_ef5lu/py_env-python3.12/bin/python', '-mpip', 'install', '.')
return code: 1
stdout:
    Processing /Users/sweiss/.cache/pre-commit/repo50_ef5lu
      Installing build dependencies: started
      Installing build dependencies: finished with status 'done'
      Getting requirements to build wheel: started
      Getting requirements to build wheel: finished with status 'error'
stderr:
      error: subprocess-exited-with-error
      
      × Getting requirements to build wheel did not run successfully.
      │ exit code: 1
      ╰─> [121 lines of output]
          /private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: `description` defined outside of `pyproject.toml` is ignored.
          !!
          
                  ********************************************************************************
                  The following seems to be defined outside of `pyproject.toml`:
          
                  `description = 'pre-commit hook that wraps maven'`
          
                  According to the spec (see the link below), however, setuptools CANNOT
                  consider this value unless `description` is listed as `dynamic`.
          
                  https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
          
                  To prevent this problem, you can list `description` under `dynamic` or alternatively
                  remove the `[project]` table from your file and rely entirely on other means of
                  configuration.
                  ********************************************************************************
          
          !!
            _handle_missing_dynamic(dist, project_table)
          /private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: `requires-python` defined outside of `pyproject.toml` is ignored.
          !!
          
                  ********************************************************************************
                  The following seems to be defined outside of `pyproject.toml`:
          
                  `requires-python = <SpecifierSet('>=3.7')>`
          
                  According to the spec (see the link below), however, setuptools CANNOT
                  consider this value unless `requires-python` is listed as `dynamic`.
          
                  https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
          
                  To prevent this problem, you can list `requires-python` under `dynamic` or alternatively
                  remove the `[project]` table from your file and rely entirely on other means of
                  configuration.
                  ********************************************************************************
          
          !!
            _handle_missing_dynamic(dist, project_table)
          /private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: `scripts` defined outside of `pyproject.toml` is ignored.
          !!
          
                  ********************************************************************************
                  The following seems to be defined outside of `pyproject.toml`:
          
                  `scripts = ['maven = pre_commit_maven.maven:main', 'maven-compile = pre_commit_maven.maven_compile:main', 'maven-test = pre_commit_maven.maven_test:main', 'maven-checkstyle = pre_commit_maven.maven_checkstyle:main', 'maven-spotless-check = pre_commit_maven.maven_spotless_check:main', 'maven-spotless-apply = pre_commit_maven.maven_spotless_apply:main']`
          
                  According to the spec (see the link below), however, setuptools CANNOT
                  consider this value unless `scripts` is listed as `dynamic`.
          
                  https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
          
                  To prevent this problem, you can list `scripts` under `dynamic` or alternatively
                  remove the `[project]` table from your file and rely entirely on other means of
                  configuration.
                  ********************************************************************************
          
          !!
            _handle_missing_dynamic(dist, project_table)
          /private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:75: _MissingDynamic: `dependencies` defined outside of `pyproject.toml` is ignored.
          !!
          
                  ********************************************************************************
                  The following seems to be defined outside of `pyproject.toml`:
          
                  `dependencies = ['ruamel.yaml>=0.15', 'toml']`
          
                  According to the spec (see the link below), however, setuptools CANNOT
                  consider this value unless `dependencies` is listed as `dynamic`.
          
                  https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
          
                  To prevent this problem, you can list `dependencies` under `dynamic` or alternatively
                  remove the `[project]` table from your file and rely entirely on other means of
                  configuration.
                  ********************************************************************************
          
          !!
            _handle_missing_dynamic(dist, project_table)
          Traceback (most recent call last):
            File "/Users/sweiss/.cache/pre-commit/repo50_ef5lu/py_env-python3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
              main()
            File "/Users/sweiss/.cache/pre-commit/repo50_ef5lu/py_env-python3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
              json_out['return_val'] = hook(**hook_input['kwargs'])
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "/Users/sweiss/.cache/pre-commit/repo50_ef5lu/py_env-python3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
              return hook(config_settings)
                     ^^^^^^^^^^^^^^^^^^^^^
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
              return self._get_build_requires(config_settings, requirements=['wheel'])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
              self.run_setup()
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
              exec(code, locals())
            File "<string>", line 6, in <module>
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
              return distutils.core.setup(**attrs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 159, in setup
              dist.parse_config_files()
            File "/Users/sweiss/.cache/pre-commit/repo50_ef5lu/py_env-python3.12/lib/python3.12/site-packages/_virtualenv.py", line 23, in parse_config_files
              result = old_parse_config_files(self, *args, **kwargs)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 627, in parse_config_files
              pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py", line 67, in apply_configuration
              return _apply(dist, config, filepath)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 56, in apply
              _apply_project_table(dist, config, root_dir)
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 82, in _apply_project_table
              corresp(dist, value, root_dir)
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 211, in _python_requires
              _set_config(dist, "python_requires", SpecifierSet(val))
                                                   ^^^^^^^^^^^^^^^^^
            File "/private/var/folders/kb/0msf3btd5yz7_rc4k580k9k40000gn/T/pip-build-env-b1xie0gm/overlay/lib/python3.12/site-packages/setuptools/_vendor/packaging/specifiers.py", line 708, in __init__
              split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]
                                                     ^^^^^^^^^^^^^^^^
          AttributeError: 'NoneType' object has no attribute 'split'
          [end of output]
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-error
    
    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> See above for output.
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
Check the log at /Users/sweiss/.cache/pre-commit/pre-commit.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.