Skip to content

Umaaz/flake8-copyright-validator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flake8-copyright-validator

Flake8 plugin for validating copyright text in python files.


Installation

pip install flake8-copyright-validator

How to use

In your config file like setup.cfg under flake8 specify copyright-text wrapping every string with '.

[flake8]
copyright-text = 'Example copyright text'

Available flags

  • --update If difference or lack of copyright was found in file writes copyright text at the beginning of python file.
    If specified, value of bytes-to-read is ignored. Careful with this option if your header is incorrect it will add one more on top of wrong header.
  • --bytes-to-read If your copyright takes more than 2048 bytes or you want to load less text specify this value
  • --detailed-output Provides detailed output with flake8 error
  • --lines-to-exclude Files with first line containing value from lines to exclude will not be checked for copyright.
    Lines to exclude is not a comma separated list. It's a text that is split by end of line (\n).
  • --symbols-to-replace You can wrap your copyright text with symbols, by default it is ', it is used for specifying
    copyright text that starts with #. You can change it if you don't need it with this flag. It is comma separated list.

How it works

Plugin splits copyright text by end of line (\n), and reads 2048 bytes of file by default.
If differences were found it yields NCF100 No copyright found.
Plugin does not use comma separated lists for text

Complete example of setup.cfg

[flake8]
lines-to-exclude =
    '# Generated by Django'
    '#!'

copyright-text = 
    '# Example - Example'
    '# Copyright (C) Example'
    '#'
    '# This program is free software: you can redistribute it and/or modify'
    '# it under the terms of the GNU Affero General Public License as published'

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%