Giter Club home page Giter Club logo

Comments (3)

commonlawfeature avatar commonlawfeature commented on July 21, 2024 1

I solved this by adding the flag pass_filenames: false

- repo: https://github.com/dhatim/python-license-check
  rev: '0.6.2'
  hooks:
  - id: liccheck
    pass_filenames: false

from python-license-check.

barisx avatar barisx commented on July 21, 2024

I solved this by adding the flag pass_filenames: false

- repo: https://github.com/dhatim/python-license-check
  rev: '0.6.2'
  hooks:
  - id: liccheck
    pass_filenames: false

I have strategy file as name strategy.ini and liccheck.ini so it need to see them. Unfortunately liccheck can't. I also tried configure pyproject.toml :

[tool.liccheck]
authorized_licenses = [
    "BSD",
    "new bsd",
    "bsd license",
    "new bsd license",
    "simplified bsd",
    "apache",
    "apache 2.0",
    "apache software license",
    "gnu lgpl",
    "lgpl with exceptions or zpl",
    "isc license",
    "isc license (iscl)",
    "mit",
    "mit license",
    "python software foundation license",
    "zpl 2.1",
    "Apache Software",
    "GNU Library or Lesser General Public License (LGPL)",
    "Mozilla Public License 2.0 (MPL 2.0)",
    "Historical Permission Notice and Disclaimer (HPND)",
    "Python Software Foundation",
    "3-Clause BSD",
    "Apache-2.0",
]
unauthorized_licenses = [
    "gpl v3"
]
[tool.liccheck.authorized_packages]
test = "1.0.0"

both give us error.

$ pre-commit run --all-files liccheck
Run Python License Checker...............................................Failed
- hook id: liccheck
- exit code: 1

Need to either configure pyproject.toml or provide an existing strategy file

from python-license-check.

bagerard avatar bagerard commented on July 21, 2024

As @commonlawfeature pointed out, it's also working for me with the pass_filenames: false

Another tweak I had to do was use language: system, since this hook requires to be running in the virtual env that contains all the libraries

  - repo: https://github.com/dhatim/python-license-check
    rev: master
    hooks:
    - id: liccheck
      pass_filenames: false
      language: system

pass_filenames: false should be set in the .pre-commit-hooks.yaml file contained in this repo

If we don't set that flag, pre-commit will provide the liccheck entry point with any of the files filtered by files: ^(.*requirements.*\.txt|setup\.cfg|setup\.py|pyproject\.toml|liccheck\.ini)$

Thus, it will try to call liccheck requirements.txt setup.py if you have these 2 files in the repository but liccheck isn't setup to work with positional argument like that so that's why it fails with liccheck: error: unrecognized arguments: pyproject.toml requirements.txt setup.cfg

I'll open a PR shortly with that fix

from python-license-check.

Related Issues (20)

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.