pax_global_header00006660000000000000000000000064132110354530014507gustar00rootroot0000000000000052 comment=36672902a860f7063c8039f675d665e2ab92eaae gitlint-0.9.0/000077500000000000000000000000001321103545300131675ustar00rootroot00000000000000gitlint-0.9.0/.coveragerc000066400000000000000000000001171321103545300153070ustar00rootroot00000000000000[run] omit=*dist-packages*,*site-packages*,gitlint/tests/*,.venv/*,*virtualenv*gitlint-0.9.0/.gitignore000066400000000000000000000013661321103545300151650ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] # C extensions *.so # Distribution / packaging .Python env/ build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *,cover # Translations *.mo *.pot # Django stuff: *.log # Sphinx documentation docs/_build/ # PyBuilder target/ .venv* virtualenv # Vagrant .vagrant # mkdocs site/ gitlint-0.9.0/.pylintrc000066400000000000000000000027331321103545300150410ustar00rootroot00000000000000# The format of this file isn't really documented; just use --generate-rcfile [MASTER] [Messages Control] # C0111: Don't require docstrings on every method # W0511: TODOs in code comments are fine. # W0142: *args and **kwargs are fine. # W0223: abstract methods don't need to be overwritten (i.e. when overwriting a Django REST serializer) # W0622: Redefining id is fine. # R0901: Too many ancestors (i.e. when subclassing test classes) # R0801: Similar lines in files # I0011: Informational: locally disabled pylint # I0013: Informational: Ignoring entire file disable=C0111,W0511,W0142,W0622,W0223,W0212,R0901,R0801,I0011,I0013,anomalous-backslash-in-string [Format] max-line-length=120 [Basic] # Variable names can be 1 to 31 characters long, with lowercase and underscores variable-rgx=[a-z_][a-z0-9_]{0,30}$ # Argument names can be 2 to 31 characters long, with lowercase and underscores argument-rgx=[a-z_][a-z0-9_]{1,30}$ # Method names should be at least 3 characters long # and be lowecased with underscores method-rgx=([a-z_][a-z0-9_]{2,50}|setUp|tearDown)$ # Allow 'id' as variable name everywhere good-names=id,c,_ bad-names=__author__ # Ignore all variables that start with an underscore (e.g. unused _request variable in a view) dummy-variables-rgx=_ [Design] max-public-methods=100 min-public-methods=0 # Maximum number of attributes of a class max-attributes=15 max-args=10 max-locals=20 [Typecheck] # Allow the use of the Django 'objects' members generated-members=sh.git gitlint-0.9.0/.travis.yml000066400000000000000000000035501321103545300153030ustar00rootroot00000000000000language: python matrix: allow_failures: - os: osx include: - python: "2.6" os: linux - python: "2.7" os: linux - python: "3.3" os: linux script: # Skip integration tests in Travis for Python 3.3, need to look into this # Error example: https://travis-ci.org/jorisroovers/gitlint/jobs/310861373 - "./run_tests.sh" - "./run_tests.sh --build" - "./run_tests.sh --pep8" - "./run_tests.sh --lint" - "./run_tests.sh --git" - python: "3.4" os: linux script: # Skip integration tests in Travis for Python 3.4, need to look into this # Error example: https://travis-ci.org/jorisroovers/gitlint/jobs/310861374 - "./run_tests.sh" - "./run_tests.sh --build" - "./run_tests.sh --pep8" - "./run_tests.sh --lint" - "./run_tests.sh --git" - python: "3.5" os: linux script: # Skip integration tests in Travis for Python 3.5, need to look into this # Error example: https://travis-ci.org/jorisroovers/gitlint/jobs/310861375 - "./run_tests.sh" - "./run_tests.sh --build" - "./run_tests.sh --pep8" - "./run_tests.sh --lint" - "./run_tests.sh --git" - python: "3.6" os: linux script: # Skip lint tests for python 3.6 (see https://github.com/PyCQA/pylint/issues/1072) - "./run_tests.sh" - "./run_tests.sh --integration" - "./run_tests.sh --build" - "./run_tests.sh --pep8" - "./run_tests.sh --git" - python: "pypy" os: linux install: - "pip install -r requirements.txt" - "pip install -r test-requirements.txt" script: - "./run_tests.sh" - "./run_tests.sh --integration" - "./run_tests.sh --build" - "./run_tests.sh --pep8" - "./run_tests.sh --lint" - "./run_tests.sh --git" after_success: - coverallsgitlint-0.9.0/CHANGELOG.md000066400000000000000000000271531321103545300150100ustar00rootroot00000000000000# Changelog # ## v0.9.0 (2017-12-03) ## The 0.9.0 release adds a new default ```author-valid-email``` rule, important bugfixes and special case handling. Special thanks to [joshholl](https://github.com/joshholl), [ron8mcr](https://github.com/ron8mcr), [omarkohl](https://github.com/omarkohl), [domo141](https://github.com/domo141), [nud](https://github.com/nud) and [AlexMooney](https://github.com/AlexMooney) for their contributions. - New Rule: ```author-valid-email``` enforces a valid author email address. Details can be found in the [Rules section of the documentation](http://jorisroovers.github.io/gitlint/rules/#m1-author-valid-email). - **Breaking change**: The ```--commits``` commandline flag now strictly follows the refspec format as interpreted by the [```git rev-list ```](https://git-scm.com/docs/git-rev-list) command. This means that linting a single commit using ```gitlint --commits ``` won't work anymore. Instead, for single commits, users now need to specificy ```gitlint --commits ^...```. On the upside, this change also means that gitlint will now understand all refspec formatters, including ```gitlint --commits HEAD``` to lint all commits in the repository. This fixes [#23](https://github.com/jorisroovers/gitlint/issues/40). - **Breaking change**: Gitlint now always falls back on trying to read a git message from a local git repository, only reading a commit message from STDIN if one is passed. Before, gitlint only read from the local git repository when a TTY was present. This is likely the expected and desired behavior for anyone running gitlint in a CI environment. This fixes [#40](https://github.com/jorisroovers/gitlint/issues/40) and [#42](https://github.com/jorisroovers/gitlint/issues/42). - **Behavior Change**: Gitlint will now by default [ignore squash and fixup commits](http://jorisroovers.github.io/gitlint/#merge-fixup-and-squash-commits) (fix for [#33: fixup messages should not trigger a gitlint violation](https://github.com/jorisroovers/gitlint/issues/33)) - Support for custom comment characters ([#34](https://github.com/jorisroovers/gitlint/issues/34)) - Support for [```git commit --cleanup=scissors```](https://git-scm.com/docs/git-commit#git-commit---cleanupltmodegt) ([#34](https://github.com/jorisroovers/gitlint/issues/34)) - Bugfix: [#37: Prevent Commas in text fields from breaking git log printing](https://github.com/jorisroovers/gitlint/issues/37) - Debug output improvements ## v0.8.2 (2017-04-25) ## The 0.8.2 release brings minor improvements, bugfixes and some under-the-hood changes. Special thanks to [tommyip](https://github.com/tommyip) for his contributions. - ```--extra-path``` now also accepts a file path (in the past only directory paths where accepted). Thanks to [tommyip](https://github.com/tommyip) for implementing this! - gitlint will now show more information when using the ```--debug``` flag. This is initial work and will continue to be improved upon in later releases. - Bugfixes: - [#24: --commits doesn't take commit specific config into account](https://github.com/jorisroovers/gitlint/issues/24) - [#27: --commits returns the wrong exit code](https://github.com/jorisroovers/gitlint/issues/27) - Development: better unit and integration test coverage for ```--commits``` ## v0.8.1 (2017-03-16) ## The 0.8.1 release brings minor tweaks and some experimental features. Special thanks to [tommyip](https://github.com/tommyip) for his contributions. - Experimental: Linting a range of commits. [Documentation](http://jorisroovers.github.io/gitlint/#linting-a-range-of-commits). Known Caveats: [#23](https://github.com/jorisroovers/gitlint/issues/23), [#24](https://github.com/jorisroovers/gitlint/issues/24). Closes [#14](https://github.com/jorisroovers/gitlint/issues/14). Thanks to [tommyip](https://github.com/tommyip) for implementing this! - Experimental: Python 3.6 support - Improved Windows error messaging: gitlint will now show a more descriptive error message when ran on windows. See [#20](https://github.com/jorisroovers/gitlint/issues/20) for details on the lack of Windows support. ## v0.8.0 (2016-12-30) ## The 0.8.0 release is a significant release that has been in the works for a long time. Special thanks to [Claymore](https://github.com/Claymore), [gernd](https://github.com/gernd) and [ZhangYaxu](https://github.com/ZhangYaxu) for submitting bug reports and pull requests. - Full unicode support: you can now lint messages in any language! This fixes [#16](https://github.com/jorisroovers/gitlint/issues/16) and [#18](https://github.com/jorisroovers/gitlint/pull/18). - User-defined rules: you can now [define your own custom rules](http://jorisroovers.github.io/gitlint/user_defined_rules/) if you want to extend gitlint's functionality. - Pypy2 support! - Debug output improvements: Gitlint will now print your active configuration when using ```--debug``` - The ```general.target``` option can now also be set via ```-c``` flags or a ```.gitlint``` file - Bugfixes: - Various important fixes related to configuration precedence - [#17: Body MinLength is not working properly](https://github.com/jorisroovers/gitlint/issues/17). **Behavior Change**: Gitlint now always applies this rule, even if the body has just a single line of content. Also, gitlint now counts the body-length for the entire body, not just the length of the first line. - Various documentation improvements - Development: - Pylint compliance for all supported python versions - Updated dependencies to latest versions - Various ```run_tests.sh``` improvements for developer convenience ## v0.7.1 (2016-06-18) ## Bugfixes: - **Behavior Change**: gitlint no longer prints the file path by default when using a ```.gitlint``` file. The path will still be printed when using the new ```--debug``` flag. Special thanks to [Slipcon](https://github.com/slipcon) for submitting this. - Gitlint now prints a correct violation message for the ```title-match-regex``` rule. Special thanks to [Slipcon](https://github.com/slipcon) for submitting this. - Gitlint is now better at parsing commit messages cross-platform by taking platform specific line endings into account - Minor documentation improvements ## v0.7.0 (2016-04-20) ## This release contains mostly bugfix and internal code improvements. Special thanks to [William Turell](https://github.com/wturrell) and [Joe Grund](https://github.com/jgrund) for bug reports and pull requests. - commit-msg hooks improvements: The new commit-msg hook now allows you to edit your message if it contains violations, prints the commit message on aborting and is more compatible with GUI-based git clients such as SourceTree. *You will need to uninstall and reinstall the commit-msg hook for these latest features*. - Python 2.6 support - **Behavior change**: merge commits are now ignored by default. The rationale is that the original commits should already be linted and that many merge commits don't pass gitlint checks by default (e.g. exceeding title length or empty body is very common). This behavior can be overwritten by setting the general option ```ignore-merge-commit=false```. - Bugfixes and enhancements: - [#7: Hook compatibility with SourceTree](https://github.com/jorisroovers/gitlint/issues/7) - [#8: Illegal option -e](https://github.com/jorisroovers/gitlint/issues/8) - [#9: print full commit msg to stdout if aborted](https://github.com/jorisroovers/gitlint/issues/9) - [#11 merge commit titles exceeding the max title length by default](https://github.com/jorisroovers/gitlint/issues/11) - Better error handling of invalid general options - Development: internal refactoring to extract more info from git. This will allow for more complex rules in the future. - Development: initial set of integration tests. Test gitlint end-to-end after it is installed. - Development: pylint compliance for python 2.7 ## v0.6.1 (2015-11-22) ## - Fix: ```install-hook``` and ```generate-config``` commands not working when gitlint is installed from pypi. ## v0.6.0 (2015-11-22) ## - Python 3 (3.3+) support! - All documentation is now hosted on [http://jorisroovers.github.io/gitlint/]() - New ```generate-config``` command generates a sample gitlint config file - New ```--target``` flag allows users to lint different directories than the current working directory - **Breaking change**: exit code behavior has changed. More details in the [Exit codes section of the documentation](http://jorisroovers.github.io/gitlint/#exit-codes). - **Breaking change**: ```--install-hook``` and ```--uninstall-hook``` have been renamed to ```install-hook``` and ```uninstall-hook``` respectively to better express that they are commands instead of options. - Better error handling when gitlint is executed in a directory that is not a git repository or when git is not installed. - The git commit message hook now uses pretty colored output - Fix: ```--config``` option no longer accepts directories as value - Development: unit tests are now ran using py.test ## v0.5.0 (2015-10-04) ## - New Rule: ```title-match-regex```. Details can be found in the [Rules section of the documentation](http://jorisroovers.github.io/gitlint/rules/). - Uninstall previously installed gitlint git commit hooks using: ```gitlint --uninstall-hook``` - Ignore rules on a per commit basis by adding e.g.: ```gitlint-ignore: T1, body-hard-tab``` to your git commit message. Use ```gitlint-ignore: all``` to disable gitlint all together for a specific commit. - ```body-is-missing``` will now automatically be disabled for merge commits (use the ```ignore-merge-commit: false``` option to disable this behavior) - Violations are now sorted by line number first and then by rule id (previously the order of violations on the same line was arbitrary). ## v0.4.1 (2015-09-19) ## - Internal fix: added missing comma to setup.py which prevented pypi upload ## v0.4.0 (2015-09-19) ## - New rules: ```body-is-missing```, ```body-min-length```, ```title-leading-whitespace```, ```body-changed-file-mention```. Details can be found in the [Rules section of the documentation](http://jorisroovers.github.io/gitlint/rules/). - The git ```commit-msg``` hook now allows you to keep or discard the commit when it fails gitlint validation - gitlint is now also released as a [python wheel](http://pythonwheels.com/) on pypi. - Internal: rule classes now have access to a gitcontext containing body the commit message and the files changed in the last commit. ## v0.3.0 (2015-09-11) ## - ```title-must-not-contain-word``` now has a ```words``` option that can be used to specify which words should not occur in the title - gitlint violations are now printed to the stderr instead of stdout - Various minor bugfixes - gitlint now ignores commented out lines (i.e. starting with #) in your commit messages - Experimental: git commit-msg hook support - Under-the-hood: better test coverage :-) ## v0.2.0 (2015-09-10) ## - Rules can now have their behavior configured through options. For example, the ```title-max-length``` rule now has a ```line-length``` option. - Under-the-hood: The codebase now has a basic level of unit test coverage, increasing overall quality assurance ## v0.1.1 (2015-09-08) ## - Bugfix: added missing ```sh``` dependency ## v0.1.0 (2015-09-08) ## - Initial gitlint release - Initial set of rules: title-max-length, title-trailing-whitespace, title-trailing-punctuation , title-hard-tab, title-must-not-contain-word, body-max-line-length, body-trailing-whitespace, body-hard-tab - General gitlint configuration through a ```gitlint``` file - Silent and verbose mode - Vagrantfile for easy development - gitlint is available on [pypi](https://pypi.python.org/pypi/gitlint) gitlint-0.9.0/CONTRIBUTING.md000066400000000000000000000003451321103545300154220ustar00rootroot00000000000000# Contributing Thanks for your interest in contributing to gitlint! Instructions on how to get started can be found on [http://jorisroovers.github.io/gitlint/contributing](http://jorisroovers.github.io/gitlint/contributing/). gitlint-0.9.0/LICENSE000066400000000000000000000020711321103545300141740ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015 Joris Roovers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. gitlint-0.9.0/MANIFEST.in000066400000000000000000000002441321103545300147250ustar00rootroot00000000000000include README.md include LICENSE exclude Vagrantfile exclude *.yml *.sh *.txt recursive-exclude examples * recursive-exclude gitlint/tests * recursive-exclude qa *gitlint-0.9.0/README.md000066400000000000000000000022721321103545300144510ustar00rootroot00000000000000# gitlint: [jorisroovers.github.io/gitlint](http://jorisroovers.github.io/gitlint/) # [![Build Status](https://travis-ci.org/jorisroovers/gitlint.svg?branch=master)](https://travis-ci.org/jorisroovers/gitlint) [![Coverage Status](https://coveralls.io/repos/jorisroovers/gitlint/badge.svg?branch=master&service=github)](https://coveralls.io/github/jorisroovers/gitlint?branch=master) [![PyPi Package](https://img.shields.io/pypi/v/gitlint.png)](https://pypi.python.org/pypi/gitlint) ![Supported Python Versions](https://img.shields.io/pypi/pyversions/gitlint.svg) Git commit message linter written in python, checks your commit messages for style. **See [jorisroovers.github.io/gitlint](http://jorisroovers.github.io/gitlint/) for full documentation.** ## Contributing ## All contributions are welcome and very much appreciated! See [jorisroovers.github.io/gitlint/contributing](http://jorisroovers.github.io/gitlint/contributing) for details on how to get started - it's easy! FYI, we maintain a [wishlist on our wiki](https://github.com/jorisroovers/gitlint/wiki/Wishlist). gitlint-0.9.0/Vagrantfile000066400000000000000000000017201321103545300153540ustar00rootroot00000000000000# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" INSTALL_DEPS=<> /home/vagrant/.bashrc grep 'source .venv27/bin/activate' /home/vagrant/.bashrc || echo 'source .venv27/bin/activate' >> /home/vagrant/.bashrc EOF Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "ubuntu/trusty64" config.vm.define "dev" do |dev| dev.vm.provision "shell", inline: "#{INSTALL_DEPS}" end if Vagrant.has_plugin?("vagrant-cachier") config.cache.scope = :box end end gitlint-0.9.0/doc-requirements.txt000066400000000000000000000000161321103545300172130ustar00rootroot00000000000000mkdocs==0.16.0gitlint-0.9.0/docs/000077500000000000000000000000001321103545300141175ustar00rootroot00000000000000gitlint-0.9.0/docs/configuration.md000066400000000000000000000140441321103545300173130ustar00rootroot00000000000000# Config files # You can modify gitlint's behavior by adding a ```.gitlint``` file to your git repository. Generate a default ```.gitlint``` config file by running: ```bash gitlint generate-config ``` You can also use a different config file like so: ```bash gitlint --config myconfigfile.ini ``` The block below shows a sample ```.gitlint``` file. Details about rule config options can be found on the [Rules](rules.md) page, details about the ```[general]``` section can be found in the [General Configuration](configuration.md#general-configuration) section of this page. ```ini # All these sections are optional, edit this file as you like. # [general] # Ignore certain rules, you can reference them by their id or by their full name # ignore=title-trailing-punctuation, T3 # verbosity should be a value between 1 and 3, the commandline -v flags take precedence over this # verbosity = 2 # By default gitlint will ignore merge commits. Set to 'false' to disable. # ignore-merge-commits=true # By default gitlint will ignore fixup commits. Set to 'false' to disable. # ignore-fixup-commits=true # By default gitlint will ignore squash commits. Set to 'false' to disable. # ignore-squash-commits=true # Enable debug mode (prints more output). Disabled by default. # debug=true # Set the extra-path where gitlint will search for user defined rules # See http://jorisroovers.github.io/gitlint/user_defined_rules for details # extra-path=examples/ # [title-max-length] # line-length=80 # [title-must-not-contain-word] # Comma-separated list of words that should not occur in the title. Matching is case # insensitive. It's fine if the keyword occurs as part of a larger word (so "WIPING" # will not cause a violation, but "WIP: my title" will. # words=wip # [title-match-regex] # python like regex (https://docs.python.org/2/library/re.html) that the # commit-msg title must be matched to. # Note that the regex can contradict with other rules if not used correctly # (e.g. title-must-not-contain-word). # regex=^US[0-9]* # [B1] # B1 = body-max-line-length # line-length=120 # [body-min-length] # min-length=5 # [body-is-missing] # Whether to ignore this rule on merge commits (which typically only have a title) # default = True # ignore-merge-commits=false # [body-changed-file-mention] # List of files that need to be explicitly mentioned in the body when they are changed # This is useful for when developers often erroneously edit certain files or git submodules. # By specifying this rule, developers can only change the file when they explicitly reference # it in the commit message. # files=gitlint/rules.py,README.md # [author-valid-email] # python like regex (https://docs.python.org/2/library/re.html) that the # commit author email address should be matched to # For example, use the following regex if you only want to allow email addresses from foo.com # regex = "[^@]+@foo.com" ``` # Commandline config # You can also use one or more ```-c``` flags like so: ``` $ gitlint -c general.verbosity=2 -c title-max-length.line-length=80 -c B1.line-length=100 ``` The generic config flag format is ```-c .