I ought to pass my own lint style checks, ne?

This commit is contained in:
Elf M. Sternberg 2016-10-03 12:31:01 -07:00
parent 13b0378b67
commit f2ae3371e7
6 changed files with 28 additions and 19 deletions

View File

@ -14,12 +14,19 @@
Scan the workspace [default] Scan the workspace [default]
**-s, --staging** **-s, --staging**
Scan the staging area (useful for pre-commit). Scan the staging area (useful for pre-commit).
**-c <path>, --config**=<path> Path to config file **-c <path>, --config=<path>**
Path to config file
**-t, --bylinter**
Group reports by linter first as they appear in the config file [default]
**-f, --byfile**
Group reports by file first, linter second
**-d, --dryrun** **-d, --dryrun**
Report what git-lint would do, but don't actually do anything. Report what git-lint would do, but don't actually do anything.
**-q, --quiet** **-q, --quiet**
Produce a short report of files that failed to pass. Produce a short report of file that failed to pass.
**-h, --help** **-h, --help**
Print a short help message Print a short help message
**-V, --verbose**
Print a slightly more verbose long report
**-v, --version** **-v, --version**
Print version information Print version information

View File

@ -12,7 +12,7 @@ To install Git Lint, run this command in your terminal:
.. code-block:: console .. code-block:: console
$ pip install git_lint $ pip install git_linter
If you don't have `pip`_ installed, this `Python installation guide`_ can guide If you don't have `pip`_ installed, this `Python installation guide`_ can guide
you through the process. you through the process.
@ -30,13 +30,13 @@ You can either clone the public repository:
.. code-block:: console .. code-block:: console
$ git clone git://github.com/elfsternberg/git_lint $ git clone git://github.com/elfsternberg/git_linter
Or download the `tarball`_: Or download the `tarball`_:
.. code-block:: console .. code-block:: console
$ curl -OL https://github.com/elfsternberg/git_lint/tarball/master $ curl -OL https://github.com/elfsternberg/git_linter/tarball/master
Once you have a copy of the source, you can install it with: Once you have a copy of the source, you can install it with:
@ -44,10 +44,9 @@ Once you have a copy of the source, you can install it with:
$ python setup.py install $ python setup.py install
.. _Github repo: https://github.com/elfsternberg/git_lint .. _Github repo: https://github.com/elfsternberg/git_linter
.. _tarball: https://github.com/elfsternberg/git_lint/tarball/master .. _tarball: https://github.com/elfsternberg/git_linter/tarball/master
Once installed, you may run the 'git lint --make-config' command, which Once installed, please copy the '.git-lint' example file. You may install this either in
will generate a simple configuration file. You may install this either your home directory as ``.git-lint`` or in your project's git directory as
in your home directory as ``.git-lint.conf`` or in your project's git ``.git/lint/git-lint``
directory as ``.git/lint/git-lint.conf``

View File

@ -32,4 +32,5 @@ the file's executable flag to ``true``:
Please see the :ref:`api` for more details on options taken by the Please see the :ref:`api` for more details on options taken by the
``run_precommit()`` and ``run_gitlint`` commands. ``run_precommit()`` and ``run_gitlint`` commands.
There is an example ``pre-commit`` script shipped with ``git lint``.

View File

@ -18,10 +18,10 @@ OPTIONS = [
_('Scan the workspace'), ['staging']), _('Scan the workspace'), ['staging']),
('s', 'staging', False, ('s', 'staging', False,
_('Scan the staging area (useful for pre-commit).'), []), _('Scan the staging area (useful for pre-commit).'), []),
('g', 'changes', False, # ('g', 'changes', False,
_("Report lint failures only for diff'd sections"), ['complete']), # _("Report lint failures only for diff'd sections"), ['complete']),
('p', 'complete', False, # ('p', 'complete', False,
_('Report lint failures for all files'), []), # _('Report lint failures for all files'), []),
('t', 'bylinter', False, ('t', 'bylinter', False,
_('Group the reports by linter first as they appear in the config file [default]'), []), _('Group the reports by linter first as they appear in the config file [default]'), []),
('f', 'byfile', False, ('f', 'byfile', False,

View File

@ -46,17 +46,17 @@ def print_report(results, unlintable_filenames, cant_lint_filenames,
if len(broken_linter_names) and (len(cant_lint_filenames) or ('verbose' in options)): if len(broken_linter_names) and (len(cant_lint_filenames) or ('verbose' in options)):
print(_('These linters could not be run:'), ','.join(broken_linter_names)) print(_('These linters could not be run:'), ','.join(broken_linter_names))
if len(cant_lint_filenames): if len(cant_lint_filenames):
print(_('As a result, these files were not linted:')) print(_('Files not linted:'))
print('\n'.join([' {}'.format(f) for f in cant_lint_filenames])) print('\n'.join([' {}'.format(f) for f in cant_lint_filenames]))
print('') print('')
if len(unlintable_filenames) and ('verbose' in options): if len(unlintable_filenames) and ('verbose' in options):
print(_('The following files had no recognizeable linters:')) print(_('No recognizeable linters for:'))
print('\n'.join([' {}'.format(f) for f in unlintable_filenames])) print('\n'.join([' {}'.format(f) for f in unlintable_filenames]))
print('') print('')
if len(unfindable_filenames): if len(unfindable_filenames):
print(_('The following files could not be found:')) print(_('Files not be found:'))
print('\n'.join([' {}'.format(f) for f in unfindable_filenames])) print('\n'.join([' {}'.format(f) for f in unfindable_filenames]))
print('') print('')

View File

@ -6,6 +6,8 @@ import os.path
def get_data_files(prefix): def get_data_files(prefix):
if prefix.startswith('/System/Library/Frameworks'):
return []
return [(os.path.join(prefix, 'share/man/man1'), ['docs/_build/man/git-lint.1'])] return [(os.path.join(prefix, 'share/man/man1'), ['docs/_build/man/git-lint.1'])]