Skip to content
Snippets Groups Projects

#134: Introduce insert-license hook and fixup license headers

Merged Moul requested to merge 134_insert-license_hook_license_headers into dev
  • Change license header's comments from docstring to #
  • Introduce insert-license pre-commit-hook
  • Get rid of update_copyright_year.sh which becomes useless
  • Document how to update the copyright year

Close #134 (closed).

Edited by Moul

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Moul changed milestone to %1.0.0

    changed milestone to %1.0.0

  • Moul changed the description

    changed the description

  • Moul added 1 commit

    added 1 commit

    Compare with previous version

  • Author Owner

    @vtexier, can you review this one?

  • Vincent Texier approved this merge request

    approved this merge request

  • merged

  • It seems that examples/__init__.py has been forgotten.

    When I checkout on the dev branch, commit 0719b34c, I get this when running pre-commit run -a:

    black....................................................................Passed
    isort....................................................................Passed
    mypy.....................................................................Passed
    pylint...................................................................Passed
    Insert license in comments...............................................Failed
    - hook id: insert-license
    - exit code: 1
    - files were modified by this hook
    
    Some sources were modified by the hook ['examples/__init__.py'] 
    Now aborting the commit.
    You should check the changes made. Then simply "git add --update ." and re-commit
    
    .gitlab-ci.yml linter....................................................Passed
    (.venv) vit@K72Jr:~/Documents/dev/python/duniter-python-api$ pre-commit run -a
    black....................................................................Passed
    isort....................................................................Passed
    mypy.....................................................................Passed
    pylint...................................................................Passed
    Insert license in comments...............................................Failed
    - hook id: insert-license
    - exit code: 1
    - files were modified by this hook
    
    Some sources were modified by the hook ['examples/__init__.py', 'docs/conf.py'] 
    Now aborting the commit.
    You should check the changes made. Then simply "git add --update ." and re-commit
    
    .gitlab-ci.yml linter....................................................Passed

    Very cool output by the way!

    The file is modified with the licence properly added, but the old licence in a docstring should be removed to fix it.

    [EDIT] Very strange, this is not happening when doing a real commit with git! I let you investigate...

    Edited by Vincent Texier
  • The licence hook add a licence in the docs/conf.py file.

    I am not sure that it is relevant for a configuration file originally created by Sphinx.

  • Author Owner

    Thanks. Solved with !143 (merged).

    docs folder is ignored by insert-license hook.

    pre-commit run -a is checking the whole code, where pre-commit run on a commit is only applying the hooks to the changed code in the stage.

Please register or sign in to reply
Loading