Download Latest Version header-checker.jar (36.6 kB)
Email in envelope

Get an email when there's a new version of FindBugs plugin development

Name Modified Size InfoDownloads / Week
Parent folder
readme.txt 2010-08-19 2.8 kB
header-checker.src.zip 2010-08-19 3.6 MB
header-checker.jar 2010-08-19 32.5 kB
Totals: 3 Items   3.6 MB 0
        === Description ===

FindBugs plugin with detector for checking class header format and content by comparing sources with etalon.
Sources must be attached to FB project (<sourcePath>)
Etalon class header may contain placeholdes marked with `$` symbols (e.g. "Owner: $USER$"). In this case comparator will
extract value from header (on placeholder place) and check is it contains in set of accepted values for this placeholder.  
Restrictions for placeholders: Only one in line, no any symbols after placeholder: "* (c) Copyright $COMPANY$"

Etalon header and placeholder values should be specified in one of following ways:
   a) In external files (etalon.txt and values.txt).
      In this case path to directory with etalon and placeholders files should be defined in environment variable PATH_TO_HEADER_ETALON
   b) In detector classpath in files "resources/etalon.txt" and "resources/values.txt"
   c) In archive file which contains files etalon.txt and values.txt. (Not implemented yet)
      In this case path archive with etalon and placeholders files should be defined in environment variable PATH_TO_HEADER_ETALON

In case of any differences in class header between sources and etalon results report should contain items:
Class header -> Wrong class header format or content -> Incorrect class header

        === How to launch ===

1) Copy plugin jar (header-checker.jar) into plugin folder of findbugs installation
2) Define path to header etalon resources via system property if necessary
  Java: -DPATH_TO_HEADER_ETALON=path_to_resource_dir
  Ant:  <findbugs jvmargs="-Xmx750M -DPATH_TO_HEADER_ETALON=path_to_resource_dir"/>

        === How to change etalon ===

By default header-checker plugin searches etalon in class path resources (com\adev\fbplugin\detect\resources\etalon.txt).
For modifying header etalon in this default location you have to change source file and recreate plugin jar (ant release).
As well header etalon can be defined in extra file. In this case header-checker just ignore default etalon in class resources.

        === How to define placeholder ===

Placeholder is string marked with `$` symbols (e.g. "Owner: $USER$") and used for checking variable values in header.
For example file owner may be one of person from know set of system users (e.g. SVN accounts). In this case header may looks following:
/*
 * Copyright(c): My company
 *
 * Owner: $USER$
 */

List of acceptable values for placeholder should be defined in file "values.txt" placed in the same place as header etalon.
This file has java properties format:
NAME=value1,value2,value3

In our sample this file should contain line: "USER=user1,user2"

In this case class header with string "* Owner: user1" will be accepted by checker.
Source: readme.txt, updated 2010-08-19