Add support for checking copyright line against a regular expression.
[style_checker.git] / src / checks.ads
blob62daf3c9acc3e4ea3ca8bdf25de699b15aeaafd5
1 ------------------------------------------------------------------------------
2 -- Style Checker --
3 -- --
4 -- Copyright (C) 2006, Pascal Obry --
5 -- --
6 -- This library is free software; you can redistribute it and/or modify --
7 -- it under the terms of the GNU General Public License as published by --
8 -- the Free Software Foundation; either version 2 of the License, or (at --
9 -- your option) any later version. --
10 -- --
11 -- This library is distributed in the hope that it will be useful, but --
12 -- WITHOUT ANY WARRANTY; without even the implied warranty of --
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
14 -- General Public License for more details. --
15 -- --
16 -- You should have received a copy of the GNU General Public License --
17 -- along with this library; if not, write to the Free Software Foundation, --
18 -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
19 -- --
20 ------------------------------------------------------------------------------
22 with Ada.Strings.Unbounded;
23 with GNAT.OS_Lib;
25 package Checks is
27 use Ada.Strings.Unbounded;
29 Syntax_Error : exception;
30 -- Raised when a syntax error is found
32 Max_Parameters : constant := 30;
33 -- Maximum number of parameters that can be specified for a style checker
34 -- for a single language.
36 type Mode is (Rejected, Accepted);
37 type Line_Ending_Style is (DOS, UNIX, MAC, No, Any);
38 -- No means that the line is the last of the file and does not have a line
39 -- terminator.
41 type Data is record
42 Line_Ending : Line_Ending_Style := UNIX;
43 -- The line ending style accepted
45 Line_Length_Max : Positive := 79;
46 -- The maximum line length
48 Duplicate_Blank_Line : Mode := Rejected;
49 -- If double blank line are accepted or not
51 Trailing_Spaces : Mode := Rejected;
52 -- Reject any line with trailing blanks (space or HT)
54 Header_Size : Natural := 20;
55 -- Minimum header size
57 Copyright_Present : Boolean := False;
58 -- Copyright notice must be present
60 Copyright_Year : Boolean := True;
61 -- Copyright year must include current year
63 Copyright_Pattern : Unbounded_String;
64 -- Copyright line must match the given regexp pattern
66 Check_Syntax : Boolean := True;
67 -- Syntax must be checked
69 Space_Comment : Natural := 2;
70 -- Number of spaces after a comment tag
72 Checker_Params : GNAT.OS_Lib.Argument_List (1 .. Max_Parameters);
73 -- Style checker parameters
75 Index : Natural := 0;
76 end record;
78 end Checks;