text-checker - Avoid committing undesired text like trailing white space

Version 0.3.0dev1
Branch lp:bzr-text-checker
Home page https://launchpad.net/bzr-text-checker
Owner amanica
GNU/Linux Yes
Windows Yes
Mac OS X Yes

Plugin to avoid committing trailing white space and other undesired text.

Features:

  • Currently we can check for new trailing whitespace, tabs, files not ending with a newline and long lines.

  • You can specify which files to check by adding rules (see bzr help rules):

    [name <file glob pattern> <file glob pattern> ... ]
    trailing_whitespace={ignore|warn|fail}
    tabs={ignore|warn|fail}
    newline_at_eof={ignore|warn|fail}
    long_line_length=<number of characters>
    long_lines={ignore|warn|fail}

    for example:

    [name *.py *.java NEWS README]
    trailing_whitespace=fail
    tabs=warn
    newline_at_eof=warn
    long_line_length=80
    long_lines=warn
  • the different actions are defined as follows:

    Specification

    Action

    ignore

    Do nothing.

    warn

    Print a warning message when committing.

    fail

    Prevent the commit from succeeding.

  • You can force a commit with violating text using the –text-check-warn-only commit option. When this plugin is configured to ‘fail’, this option would temporarily override the action with ‘warn’. This is handy if you have a special case and need to commit violating text, but don’t want to go and change the configs for accepting a rare violation. bzr commit --text-check-warn-only

  • View the current configuration for a branch, you can do the following: bzr text-check-info [FILE...]

  • Recursively remove trailing whitespace for files matching a pattern: remove-trailing-whitespace "*.py"

Planned features, more or less in the order of priority:

  • Automatically remove new trailing whitespace when committing. Will probably use the new content filters of Ian Clatworthy when that lands in bazaar. text_check_action=auto-fix

commit

Purpose

Commit with added –text-check-warn-only option.

Usage

bzr commit [SELECTED...]

Options

-v, --verbose Display more information.
--author=ARG Set the author’s name, if it’s different from the committer.
--unchanged Commit even if nothing has changed.
--fixes=ARG Mark a bug as being fixed by this revision (see “bzr help bugs”).
-q, --quiet Only display errors and warnings.
--show-diff When no message is supplied, show the diff along with the status summary in the message editor.
--strict Refuse to commit if there are unknown files in the working tree.
-F MSGFILE, --file=MSGFILE
 Take commit message from this file.
--usage Show usage message and options.
-x ARG, --exclude=ARG
 Do not consider changes made to a given path.
-m ARG, --message=ARG
 Description of the new revision.
--local Perform a local commit in a bound branch. Local commits are not pushed to the master branch until a normal commit is performed.
--text-check-warn-only
 Commit even if some text checks fail.
-h, --help Show help message.

Aliases

ci, checkin

See also

add, bugs, hooks, uncommit