Do not check copyright pattern for older years.
[style_checker.git] / src / checks.ads
blobda90e6b36e27b6ff2970f2e9488f92ce801d32e5
1 ------------------------------------------------------------------------------
2 -- Style Checker --
3 -- --
4 -- Copyright (C) 2006-2011, 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 Tabulation : Mode := Rejected;
55 -- Reject any line with tabulations
57 Header_Size : Natural := 20;
58 -- Minimum header size
60 Copyright_Present : Boolean := False;
61 -- Copyright notice must be present
63 Copyright_Year : Boolean := True;
64 -- Copyright year must include current year
66 Copyright_Pattern : Unbounded_String;
67 -- Copyright line must match the given regexp pattern
69 Check_Syntax : Boolean := True;
70 -- Syntax must be checked
72 Space_Comment : Natural := 2;
73 -- Number of spaces after a comment tag
75 Checker_Params : GNAT.OS_Lib.Argument_List (1 .. Max_Parameters);
76 -- Style checker parameters
78 Comment_Dot_EOL : Boolean := True;
79 -- Single line comment can terminate with a dot
81 Index : Natural := 0;
83 Operator_EOL : Mode := Accepted;
84 -- Check for operators at end of line
86 Then_Layout : Mode := Accepted;
87 -- Check for Then layout (Ada), should be on the line with the if or the
88 -- first word on its line.
89 end record;
91 end Checks;