home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / style / check.tst < prev    next >
Encoding:
Text File  |  1988-05-03  |  114.9 KB  |  3,037 lines

  1. ::::::::::
  2. style_tst.dis
  3. ::::::::::
  4. -- This is the distribution list for the Style Checker testing files
  5. test1.ada
  6. test1.flw
  7. test1.sty
  8. test1a.ada
  9. test1a.flw
  10. test1a.sty
  11. test1b.ada
  12. test1b.flw
  13. test1b.sty
  14. test2.ada
  15. test2.flw
  16. test2.sty
  17. test3a.ada
  18. test3a.flw
  19. test3a.sty
  20. test4.ada
  21. test4.flw
  22. test4.sty
  23. test5.ada
  24. test5.flw
  25. test5.sty
  26. test6.ada
  27. test6.flw
  28. test6.sty
  29. test7.ada
  30. test7.flw
  31. test7.sty
  32. -- The acceptance testing procedures document is on the VAX at location:
  33. -- user1:[jmellby.nosc.style.doc]test_procedures.mem
  34. testplan.doc
  35. ::::::::::
  36. test1.ada
  37. ::::::::::
  38. --
  39. --  T E S T   1
  40. --
  41. -- This module is used to test the Coding Standards Checker for ADA -  The
  42. -- tests that are to be applied to the module are Test A1 indices 1 thru 7
  43. -- and 14.  Various additions have been added to a module originally named
  44. -- Menu.ada authored by Jerry Baskette.  Changes were made January 30, 1985
  45. -- by James Rea.
  46. --
  47. -- Additions and changes have been commented throughout the module.  These
  48. -- comments relate the tests to the code.
  49.  
  50. with CURRENT_EXCEPTION;
  51. separate (HELP_UTILITY)
  52.  
  53. -------------------------------------------------------------------------
  54. -- The reserved word 'procedure' is in upper case
  55. -- This should be flagged as improper case - Test A1 index 1
  56. -------------------------------------------------------------------------
  57.  
  58. PROCEDURE PRINT_TOPIC_MENU (NODE: in HELP_LINK) is
  59.  
  60.     LINE_COUNT:               TEXT_RANGE := 0;  -- number of lines to be output
  61.     TOTAL_NUMBER_OF_TOPICS:   NATURAL := 0;
  62.  
  63.     -- The name NUM_TOPICS_IN_COLUMN_ONE in the wrong case
  64.  
  65.     -------------------------------------------------------------------------
  66.     -- This should be flagged as improper case - Test A1 index 2
  67.     -------------------------------------------------------------------------
  68.  
  69.     num_TOPICS_IN_COLUMN_ONE: POSITIVE := 1;
  70.     TOPICS_IN_COLUMN_TWO:     BOOLEAN := FALSE;
  71.     OUTPUT_LINE:              HELP_INFO_TEXT_LINE;
  72.     OUTPUT_BUFFER:            SAVED_TEXT; -- buffer of OUTPUT_LINES to be output
  73.     RIGHT_COLUMN_START:       INTEGER := (MAX_LINE_LENGTH/2) + 2;
  74.  
  75.     -------------------------------------------------------------------------
  76.     -- The name EVEN should flag the short word (length 4)
  77.     -------------------------------------------------------------------------
  78.  
  79.     EVEN:                     BOOLEAN := FALSE;
  80.  
  81.     -------------------------------------------------------------------------
  82.     -- The name 'EVENS' should not flag the short name defn. Test A1 index 6
  83.     -------------------------------------------------------------------------
  84.  
  85.     EVENS:                    POSITIVE := 1;
  86.  
  87.     -------------------------------------------------------------------------
  88.     --The names 'I,J,K' should not be flagged. Test A1 index 7
  89.     -------------------------------------------------------------------------
  90.  
  91.     I:                        POSITIVE;
  92.     J:                        POSITIVE;
  93.     K:                        POSITIVE;
  94.     TESTFLAG:                 BOOLEAN;
  95.     TEST_FLAG:                BOOLEAN;
  96.  
  97.     ------------------------------------------------------------------------
  98.     --The name 'TSTFLG' should be flagged as an abbreviation
  99.     --Test A1 index 14
  100.     ------------------------------------------------------------------------
  101.  
  102.     TSTFLG:                   BOOLEAN;
  103.     TEST_FLAG:                BOOLEAN;
  104.      TESTFLAGS:                BOOLEAN; --should be flagged for indentation
  105.        TEST_FLAGS:               BOOLEAN;  --should be flagged for indentation
  106.    CURRENT_NODE:             HELP_LINK := null;--flag for indentation
  107.     COL_ONE_NODE:             HELP_LINK := null;--flag for indentation
  108.     COL_TWO_NODE:             HELP_LINK := null;--flag for indentation
  109.  
  110. begin
  111.  
  112.     --------------------------------------------------------------
  113.     --Indentation should be checked per Test A2
  114.     --------------------------------------------------------------
  115.  
  116.  CURRENT_NODE := NODE.SUBTOPICS;
  117.  -- count the number of subtopics for this node
  118.  
  119.  while CURRENT_NODE /= null loop
  120.   TOTAL_NUMBER_OF_TOPICS := TOTAL_NUMBER_OF_TOPICS + 1;
  121.   CURRENT_NODE:= CURRENT_NODE.NEXT_TOPIC;
  122.  end loop;
  123.  
  124.     -- If there is more than one topic, then split the topics into two columns
  125.     -- Column one will have the first half and column two the second half.
  126.     -- If there are an odd number of topics, column one will have the odd number
  127.  
  128.     ---------------------------------------------------------------
  129.     --The following 'if statements should be flagged as two statements
  130.     --on one line.  Test A2 index 1
  131.     ---------------------------------------------------------------
  132.  
  133.  if TOTAL_NUMBER_OF_TOPICS /= 0 then if TOTAL_NUMBER_OF_TOPICS >= 2 then
  134.     TOPICS_IN_COLUMN_TWO := TRUE;
  135.     NUM_TOPICS_IN_COLUMN_ONE := TOTAL_NUMBER_OF_TOPICS / 2;
  136.  
  137.     -- More than one topic, split the number
  138.   --See if odd number. If so, increment the topic count so odd goes in 1st col.
  139.  
  140.     if TOTAL_NUMBER_OF_TOPICS /= (TOTAL_NUMBER_OF_TOPICS/2) * 2 then
  141.       NUM_TOPICS_IN_COLUMN_ONE := NUM_TOPICS_IN_COLUMN_ONE + 1;
  142.  
  143.     else
  144.  
  145.     -------------------------------------------------------------------
  146.     --A second test of multiple statements on one line.
  147.     -------------------------------------------------------------------
  148.  
  149.       EVEN := TRUE; end if; end if; --three statements on this line!
  150.  
  151.       -- set the beginning node for each column
  152.  
  153.   COL_ONE_NODE := NODE.SUBTOPICS;
  154.   CURRENT_NODE := NODE.SUBTOPICS;
  155.  
  156.   ------------------------------------------------------------------
  157.   --The following 'for' statement should flag improper indentation
  158.   --Test A2 index 3
  159.   ------------------------------------------------------------------
  160.  
  161.   for I in 1..NUM_TOPICS_IN_COLUMN_ONE loop
  162.   COL_TWO_NODE := CURRENT_NODE.NEXT_TOPIC;
  163.   CURRENT_NODE := CURRENT_NODE.NEXT_TOPIC;
  164.   end loop;
  165.   ----------------------------------------------------------------
  166.   --The following 'while' and 'if' statements should be flagged for
  167.   --improper indentation. Test A2 index 3
  168.   --Lack of blank line following the above 'for' loop should be flagged.
  169.   --This lack of blank line preceeding the 'if' below should also
  170.   --should also be flagged. Text A2 indices 8 & 9 respectively.
  171.   ----------------------------------------------------------------
  172.   if TOPICS_IN_COLUMN_TWO then
  173.   while COL_TWO_NODE /= null loop
  174.   OUTPUT_LINE := BLANK_LINE; -- blank the line buffer
  175.  
  176.   -- Put first topic in left half of output line
  177.  
  178.   OUTPUT_LINE(1..COL_ONE_NODE.NAME_LENGTH) :=
  179.     COL_ONE_NODE.NAME(1..COL_ONE_NODE.NAME_LENGTH);
  180.  
  181.   -- Put second topic in second half of output line
  182.  
  183.       OUTPUT_LINE(RIGHT_COLUMN_START..RIGHT_COLUMN_START +
  184.   COL_TWO_NODE.NAME_LENGTH - 1 ) :=
  185.                 COL_TWO_NODE.NAME(1..COL_TWO_NODE.NAME_LENGTH);
  186.  
  187.   -- Put the line in the output buffer. LINE_COUNT is incremented automatically
  188.  
  189.  
  190.   ----------------------------------------------------------------------
  191.     --This is a block of comments to check the proper indentation of
  192. --the block of comments.  This is done in accordance with Test A2
  193.         --index 6.  This should be flagged.
  194.   --------------------------------------------------------------------
  195.  
  196.       HELP_INFO_SUPPORT.APPEND_TO_DISPLAY(OUTPUT_LINE,OUTPUT_BUFFER,LINE_COUNT);
  197.       COL_ONE_NODE := COL_ONE_NODE.NEXT_TOPIC;
  198.       COL_TWO_NODE := COL_TWO_NODE.NEXT_TOPIC;
  199.     end loop;
  200.   end if;
  201.  
  202.   if not EVEN then
  203.  
  204.   -- Put the odd topic in the output buffer
  205.  
  206.     OUTPUT_LINE := BLANK_LINE;
  207.     OUTPUT_LINE(1..COL_ONE_NODE.NAME_LENGTH) :=
  208.        COL_ONE_NODE.NAME(1..COL_ONE_NODE.NAME_LENGTH);
  209.     HELP_INFO_SUPPORT.APPEND_TO_DISPLAY(OUTPUT_LINE,OUTPUT_BUFFER,LINE_COUNT);
  210.   end if;
  211.  
  212.  
  213.   -- Now print the output buffer
  214.  
  215.   HELP_INFO_SUPPORT.PRINT_TEXT(OUTPUT_BUFFER,LINE_COUNT);
  216.  end if;
  217.  ---------------------------------------------------------------------
  218.  --Lack of blank lines separating the major block (exception) should
  219.  --be flagged.  Test A2 index 7.
  220.  ---------------------------------------------------------------------
  221. exception
  222.     when others => text_io.put_line("Print Menu " & CURRENT_EXCEPTION.NAME);
  223.     raise;
  224. end PRINT_TOPIC_MENU;
  225. ::::::::::
  226. test1.flw
  227. ::::::::::
  228. with CURRENT_EXCEPTION;
  229. This package is on the list of packages to be warned against.
  230.  
  231. PROCEDURE PRINT_TOPIC_MENU (NODE: in HELP_LINK) is
  232. Reserve word PROCEDURE should be in lower case
  233.  
  234.     num_TOPICS_IN_COLUMN_ONE: POSITIVE := 1;
  235. Object name num_TOPICS_IN_COLUMN_ONE should be in upper case
  236.  
  237.      TESTFLAGS:                BOOLEAN; --should be flagged for indentation 
  238. This line should be indented to column:   5
  239.  
  240.        TEST_FLAGS:               BOOLEAN;  --should be flagged for indentation 
  241. This line should be indented to column:   5
  242.  
  243.  if TOTAL_NUMBER_OF_TOPICS /= 0 then if TOTAL_NUMBER_OF_TOPICS >= 2 then
  244. There are more than one statements on this line!
  245.  
  246.       EVEN := TRUE; end if; end if; --three statements on this line! 
  247. There are more than one statements on this line!
  248.  
  249.  if TOTAL_NUMBER_OF_TOPICS /= 0 then if TOTAL_NUMBER_OF_TOPICS >= 2 then
  250. This structure should have following blank lines to set it off.
  251.  
  252.   COL_ONE_NODE := NODE.SUBTOPICS;
  253. This line should be indented to column:   2
  254.  
  255.   CURRENT_NODE := NODE.SUBTOPICS;
  256. This line should be indented to column:   2
  257.  
  258.   for I in 1..NUM_TOPICS_IN_COLUMN_ONE loop
  259. This line should be indented to column:   2
  260.  
  261.   if TOPICS_IN_COLUMN_TWO then
  262. This line should be indented to column:   2
  263.  
  264.   OUTPUT_LINE := BLANK_LINE; -- blank the line buffer 
  265. Beginning of this block not indented properly. Line ignored for Indentation!
  266.  
  267.   OUTPUT_LINE(1..COL_ONE_NODE.NAME_LENGTH) :=
  268. Beginning of this block not indented properly. Line ignored for Indentation!
  269.  
  270.   COL_TWO_NODE.NAME_LENGTH - 1 ) :=
  271. The statement-continuation in this line should be indented!
  272.  
  273.   while COL_TWO_NODE /= null loop
  274. This structure should have preceeding blank lines to set it off.
  275.  
  276.   while COL_TWO_NODE /= null loop
  277. This structure should have following blank lines to set it off.
  278.  
  279.   while COL_TWO_NODE /= null loop
  280. This structure is large enough that it should have a loop-name!
  281.  
  282.   if TOPICS_IN_COLUMN_TWO then
  283. This structure should have following blank lines to set it off.
  284.  
  285.   if not EVEN then
  286. This line should be indented to column:   2
  287.  
  288.  if TOTAL_NUMBER_OF_TOPICS /= 0 then if TOTAL_NUMBER_OF_TOPICS >= 2 then
  289. This structure should have following blank lines to set it off.
  290.  
  291.     when others => text_io.put_line("Print Menu " & CURRENT_EXCEPTION.NAME);
  292. Object name text_io should be in upper case
  293.  
  294.     when others => text_io.put_line("Print Menu " & CURRENT_EXCEPTION.NAME);
  295. Object name put_line should be in upper case
  296.  
  297. -- 
  298. Finish checking started in above statement.  Total statements: 66
  299. ::::::::::
  300. test1.sty
  301. ::::::::::
  302. STYLE Report
  303. :USER1:POWERS:NOSC:TEST1.ADA
  304.  
  305.       Naming Conventions
  306. --------------------------------------------------------------------------
  307.   *   Invalid Case for an Object Identifier             3      Errors
  308.   *   Invalid Case for a Keyword                        1      Error
  309.       Name Segment Size (Separated         Desired     <5      Characters
  310.                   by Underscores)          Actual       4.8    Characters
  311.       Average Name Size                    Desired     >5      Characters
  312.                                            Actual      10.2    Characters
  313. --------------------------------------------------------------------------
  314.  
  315.       Physical Layout
  316. --------------------------------------------------------------------------
  317.   *   Occurrences of More Than One Statement/Line       2      Errors
  318.   *   Inconsistant Indentation                         13      Errors
  319.   *   Missing Blank Lines to Set Off a Block            4      Errors
  320.   *   Loops Without Names                               1      
  321. --------------------------------------------------------------------------
  322.  
  323.       Information Hiding, Abstraction, Data Use
  324. --------------------------------------------------------------------------
  325.       Percent of Literals In Body          Desired   < 30.0%
  326.   *                                        Actual      71.4%
  327.       Percent of Universal Types           Desired   < 40.0%
  328.                                            Actual      33.3%
  329.   !   Data Structuring Types NOT Used
  330.                                            Array Types
  331.                                            Enumeration Types
  332.                                            Record Types
  333.   !   No Attributes are Used
  334.   !   Ada-Specific Features NOT used
  335.                                            AND THEN
  336.                                            OR ELSE
  337.                                            EXITS
  338.                                            XOR
  339.                                            ELSIF
  340.                                            OUT parameters
  341.                                            IN OUT parameters
  342.                                            PRIVATEs
  343. --------------------------------------------------------------------------
  344.  
  345.       Modularity
  346. --------------------------------------------------------------------------
  347.       Average Number of Parameters         Range     0..4      Parameters
  348.         Instances of parameters below minimum           0      
  349.         Instances of parameters above maximum           0      
  350.       Average Subprogram Size              Range  10..200      Statements
  351.         Instances of size below minimum                 0      
  352.         Instances of size above maximum                 0      
  353.       Loops with too many exit statements               0      Instances
  354.       Control Structure Nesting            Maximum      8      
  355.                                            Exceeded     0      Instances
  356.       Package Nesting                      Maximum      2      
  357.                                            Exceeded     0      Instances
  358.       Subprogram Nesting                   Maximum      4      
  359.                                            Exceeded     0      Instances
  360. --------------------------------------------------------------------------
  361.  
  362.       Comment Usage
  363. --------------------------------------------------------------------------
  364.       Number of Comments                               83      Comments
  365.       Average Comment Size                 Desired    >15      Characters
  366.                                            Actual      53.0    Characters
  367. --------------------------------------------------------------------------
  368.  
  369.       Transportability
  370. --------------------------------------------------------------------------
  371.       Number of Lines Exceeding Line Length             0      
  372.       Address Clauses                                   0      
  373.       Representation Specifications                     0      
  374.       PRAGMA'S used:
  375.       Non-Standard PRAGMA's Used
  376.       Packages/Procedures WITHed
  377.                                            CURRENT_EXCEPTION
  378. --------------------------------------------------------------------------
  379.  
  380.       * => Style Flaw        ! => Note: Potential for improvement
  381.  
  382. Keyword Usage
  383.  Used Keyword    Allowed         Restriction     Occurrences     Percentage
  384. --------------------------------------------------------------------------
  385.       IF        yes             0.0%           10              19.6%
  386.       IN        yes             0.0%            2               3.9%
  387.       IS        yes             0.0%            1               2.0%
  388.       END       yes             0.0%            9              17.6%
  389.       FOR       yes             0.0%            1               2.0%
  390.       NOT       yes             0.0%            1               2.0%
  391.       ELSE      yes             0.0%            1               2.0%
  392.       LOOP      yes             0.0%            6              11.8%
  393.       NULL      yes             0.0%            5               9.8%
  394.       THEN      yes             0.0%            5               9.8%
  395.       WHEN      yes             0.0%            1               2.0%
  396.       WITH      yes             0.0%            1               2.0%
  397.       BEGIN     yes             0.0%            1               2.0%
  398.       RAISE     yes             0.0%            1               2.0%
  399.       WHILE     yes             0.0%            2               3.9%
  400.       OTHERS    yes             0.0%            1               2.0%
  401.       SEPARATE  yes             0.0%            1               2.0%
  402.       EXCEPTION yes             0.0%            1               2.0%
  403.       PROCEDURE yes             0.0%            1               2.0%
  404. --------------------------------------------------------------------------
  405. ::::::::::
  406. test1a.ada
  407. ::::::::::
  408. --
  409. --   T E S T 1 A
  410. --
  411. -------------------------------------------------
  412. -- Test for Short names
  413. -------------------------------------------------
  414. procedure XYZ ( Z : in INTEGER; Y : OUT FLOAT ) is
  415. begin
  416.     return;
  417. end XYZ;
  418. ::::::::::
  419. test1a.flw
  420. ::::::::::
  421. procedure XYZ ( Z : in INTEGER; Y : OUT FLOAT ) is
  422. Reserve word OUT should be in lower case
  423.  
  424. procedure XYZ ( Z : in INTEGER; Y : OUT FLOAT ) is
  425. This subprogram is smaller than the defined limits!
  426.  
  427. -- 
  428. Finish checking started in above statement.  Total statements: 4
  429. ::::::::::
  430. test1a.sty
  431. ::::::::::
  432. STYLE Report
  433. :USER1:POWERS:NOSC:TEST1A.ADA
  434.  
  435.       Naming Conventions
  436. --------------------------------------------------------------------------
  437.       Invalid Case for an Object Identifier             0      Errors
  438.   *   Invalid Case for a Keyword                        1      Error
  439.       Name Segment Size (Separated         Desired     <5      Characters
  440.   *               by Underscores)          Actual       7.0    Characters
  441.       Average Name Size                    Desired     >5      Characters
  442.   *                                        Actual       3.4    Characters
  443. --------------------------------------------------------------------------
  444.  
  445.       Physical Layout
  446. --------------------------------------------------------------------------
  447.       Occurrences of More Than One Statement/Line       0      Errors
  448.       Inconsistant Indentation                          0      Errors
  449.       Missing Blank Lines to Set Off a Block            0      Errors
  450.       Loops Without Names                               0      
  451. --------------------------------------------------------------------------
  452.  
  453.       Information Hiding, Abstraction, Data Use
  454. --------------------------------------------------------------------------
  455.       Percent of Literals In Body          Desired   < 30.0%
  456.                                            Actual       0.0%
  457.       Percent of Universal Types           Desired   < 40.0%
  458.                                            Actual       0.0%
  459.   !   Data Structuring Types NOT Used
  460.                                            Array Types
  461.                                            Enumeration Types
  462.                                            Record Types
  463.   !   No Attributes are Used
  464.   !   Ada-Specific Features NOT used
  465.                                            AND THEN
  466.                                            OR ELSE
  467.                                            EXITS
  468.                                            XOR
  469.                                            ELSIF
  470.                                            EXCEPTION
  471.                                            IN OUT parameters
  472.                                            PRIVATEs
  473. --------------------------------------------------------------------------
  474.  
  475.       Modularity
  476. --------------------------------------------------------------------------
  477.       Average Number of Parameters         Range     0..4      Parameters
  478.         Instances of parameters below minimum           0      
  479.         Instances of parameters above maximum           0      
  480.       Average Subprogram Size              Range  10..200      Statements
  481.   *     Instances of size below minimum                 1      
  482.         Instances of size above maximum                 0      
  483.       Loops with too many exit statements               0      Instances
  484.       Control Structure Nesting            Maximum      8      
  485.                                            Exceeded     0      Instances
  486.       Package Nesting                      Maximum      2      
  487.                                            Exceeded     0      Instances
  488.       Subprogram Nesting                   Maximum      4      
  489.                                            Exceeded     0      Instances
  490. --------------------------------------------------------------------------
  491.  
  492.       Comment Usage
  493. --------------------------------------------------------------------------
  494.       Number of Comments                                6      Comments
  495.       Average Comment Size                 Desired    >15      Characters
  496.                                            Actual      22.5    Characters
  497. --------------------------------------------------------------------------
  498.  
  499.       Transportability
  500. --------------------------------------------------------------------------
  501.       Number of Lines Exceeding Line Length             0      
  502.       Address Clauses                                   0      
  503.       Representation Specifications                     0      
  504.       PRAGMA'S used:
  505.       Non-Standard PRAGMA's Used
  506.       Packages/Procedures WITHed
  507. --------------------------------------------------------------------------
  508.  
  509.       * => Style Flaw        ! => Note: Potential for improvement
  510.  
  511. Keyword Usage
  512.  Used Keyword    Allowed         Restriction     Occurrences     Percentage
  513. --------------------------------------------------------------------------
  514.       IN        yes             0.0%            1              14.3%
  515.       IS        yes             0.0%            1              14.3%
  516.       END       yes             0.0%            1              14.3%
  517.       OUT       yes             0.0%            1              14.3%
  518.       BEGIN     yes             0.0%            1              14.3%
  519.       RETURN    yes             0.0%            1              14.3%
  520.       PROCEDURE yes             0.0%            1              14.3%
  521. --------------------------------------------------------------------------
  522. ::::::::::
  523. test1b.ada
  524. ::::::::::
  525. --
  526. --   T E S T 1 B
  527. --
  528. -------------------------------------------------
  529. -- Test for UNDERSCORES -- the result should flag
  530. -- this program as having not enough underscores,
  531. -- i.e. the name segment size too small!
  532. -------------------------------------------------
  533. procedure XYZANDPDQ_FOR_LONG_NAME (
  534.         ZYZENZUZEN_ZULULONG : in INTEGER;
  535.         YYILLERBYTE_YTHISIS_ALSOTOOLONG : OUT FLOAT ) is
  536. begin
  537.     return;
  538. end XYZANDPDQ_FOR_LONG_NAME;
  539. ::::::::::
  540. test1b.flw
  541. ::::::::::
  542.         YYILLERBYTE_YTHISIS_ALSOTOOLONG : OUT FLOAT ) is
  543. Reserve word OUT should be in lower case
  544.  
  545. procedure XYZANDPDQ_FOR_LONG_NAME (
  546. This subprogram is smaller than the defined limits!
  547.  
  548. -- 
  549. Finish checking started in above statement.  Total statements: 4
  550. ::::::::::
  551. test1b.sty
  552. ::::::::::
  553. STYLE Report
  554. :USER1:POWERS:NOSC:TEST1B.ADA
  555.  
  556.       Naming Conventions
  557. --------------------------------------------------------------------------
  558.       Invalid Case for an Object Identifier             0      Errors
  559.   *   Invalid Case for a Keyword                        1      Error
  560.       Name Segment Size (Separated         Desired     <5      Characters
  561.   *               by Underscores)          Actual       7.4    Characters
  562.       Average Name Size                    Desired     >5      Characters
  563.                                            Actual      17.0    Characters
  564. --------------------------------------------------------------------------
  565.  
  566.       Physical Layout
  567. --------------------------------------------------------------------------
  568.       Occurrences of More Than One Statement/Line       0      Errors
  569.       Inconsistant Indentation                          0      Errors
  570.       Missing Blank Lines to Set Off a Block            0      Errors
  571.       Loops Without Names                               0      
  572. --------------------------------------------------------------------------
  573.  
  574.       Information Hiding, Abstraction, Data Use
  575. --------------------------------------------------------------------------
  576.       Percent of Literals In Body          Desired   < 30.0%
  577.                                            Actual       0.0%
  578.       Percent of Universal Types           Desired   < 40.0%
  579.                                            Actual       0.0%
  580.   !   Data Structuring Types NOT Used
  581.                                            Array Types
  582.                                            Enumeration Types
  583.                                            Record Types
  584.   !   No Attributes are Used
  585.   !   Ada-Specific Features NOT used
  586.                                            AND THEN
  587.                                            OR ELSE
  588.                                            EXITS
  589.                                            XOR
  590.                                            ELSIF
  591.                                            EXCEPTION
  592.                                            IN OUT parameters
  593.                                            PRIVATEs
  594. --------------------------------------------------------------------------
  595.  
  596.       Modularity
  597. --------------------------------------------------------------------------
  598.       Average Number of Parameters         Range     0..4      Parameters
  599.         Instances of parameters below minimum           0      
  600.         Instances of parameters above maximum           0      
  601.       Average Subprogram Size              Range  10..200      Statements
  602.   *     Instances of size below minimum                 1      
  603.         Instances of size above maximum                 0      
  604.       Loops with too many exit statements               0      Instances
  605.       Control Structure Nesting            Maximum      8      
  606.                                            Exceeded     0      Instances
  607.       Package Nesting                      Maximum      2      
  608.                                            Exceeded     0      Instances
  609.       Subprogram Nesting                   Maximum      4      
  610.                                            Exceeded     0      Instances
  611. --------------------------------------------------------------------------
  612.  
  613.       Comment Usage
  614. --------------------------------------------------------------------------
  615.       Number of Comments                                8      Comments
  616.       Average Comment Size                 Desired    >15      Characters
  617.                                            Actual      31.0    Characters
  618. --------------------------------------------------------------------------
  619.  
  620.       Transportability
  621. --------------------------------------------------------------------------
  622.       Number of Lines Exceeding Line Length             0      
  623.       Address Clauses                                   0      
  624.       Representation Specifications                     0      
  625.       PRAGMA'S used:
  626.       Non-Standard PRAGMA's Used
  627.       Packages/Procedures WITHed
  628. --------------------------------------------------------------------------
  629.  
  630.       * => Style Flaw        ! => Note: Potential for improvement
  631.  
  632. Keyword Usage
  633.  Used Keyword    Allowed         Restriction     Occurrences     Percentage
  634. --------------------------------------------------------------------------
  635.       IN        yes             0.0%            1              14.3%
  636.       IS        yes             0.0%            1              14.3%
  637.       END       yes             0.0%            1              14.3%
  638.       OUT       yes             0.0%            1              14.3%
  639.       BEGIN     yes             0.0%            1              14.3%
  640.       RETURN    yes             0.0%            1              14.3%
  641.       PROCEDURE yes             0.0%            1              14.3%
  642. --------------------------------------------------------------------------
  643. ::::::::::
  644. test2.ada
  645. ::::::::::
  646. --
  647. --    T E S T   2
  648. --
  649.  
  650. package body INITIALIZE is
  651.  
  652. begin
  653.  
  654.   ----------------------------------------------------------------------------
  655.   --The following assignments should raise flags for Test A4
  656.   --The assignments that show 1 and 0 should not be flagged for Test A4
  657.   ----------------------------------------------------------------------------
  658.  
  659.   OPENED := FALSE;
  660.   CHECK := 5;
  661.   CHECKONE := 1;      --should not be flagged
  662.   CHECKONE := 0;      --should not be flagged
  663.   CHECK := 150;
  664.   CHECK := 32767;
  665.   CHECKTWO := "FIVE";
  666.   CHECKTWO := "FOUR";
  667.  
  668.   WHILE not OPENED loop
  669.     FILE_IO.OPEN_INPUT_FILE(INPUT_FILES(FILE_LEVEL).FILE,OPENED,DUMMY);
  670.   end loop;
  671.   if TEXT_IO.IS_OPEN(INPUT_FILES(FILE_LEVEL).FILE) then
  672.     OPENED := FALSE;
  673.     while not OPENED loop
  674.       FILE_IO.OPEN_OUTPUT_FILE(OUTPUT_FILE,
  675.                        TEXT_IO.NAME(INPUT_FILES(FILE_LEVEL).FILE),OPENED);
  676.     end loop;
  677.     HOST_LCD_IF.GET_TIME(TODAY,TIME_ERROR);
  678.     if TIME_ERROR = HOST_LCD_IF.NOT_AN_ERROR then
  679.       TIME_STAMP := "                    ";
  680.       TEXT_IO.INTEGER_IO.PUT(TIME_STAMP(11..12),TODAY.MONTH);
  681.       TIME_STAMP(13) := '/';
  682.       TEXT_IO.INTEGER_IO.PUT(TIME_STAMP(14..15),TODAY.DAY);
  683.       TIME_STAMP(16) := '/';
  684.       TEXT_IO.INTEGER_IO.PUT(TIME_STAMP(17..20),TODAY.YEAR);
  685.       SECONDS_SINCE_MIDNIGHT := TODAY.TICKS_SINCE_MIDNIGHT /
  686.                                 TODAY.TICKS_PER_SECOND;
  687.       HOURS := SECONDS_SINCE_MIDNIGHT / SECONDS_PER_HOUR;
  688.       MINUTES := ((SECONDS_SINCE_MIDNIGHT) - (SECONDS_PER_HOUR * HOURS)) /
  689.                    SECONDS_PER_MINUTE;
  690.       SECONDS := ((SECONDS_SINCE_MIDNIGHT) - (SECONDS_PER_HOUR * HOURS)) -
  691.              (SECONDS_PER_MINUTE * MINUTES);
  692.       TEXT_IO.LONG_INTEGER_IO.PUT(TIME_STAMP(1..2),HOURS);
  693.       TIME_STAMP(3) := ':';
  694.       TEXT_IO.LONG_INTEGER_IO.PUT(TIME_STAMP(4..5),MINUTES);
  695.       TIME_STAMP(6) := ':';
  696.       TEXT_IO.LONG_INTEGER_IO.PUT(TIME_STAMP(7..8),SECONDS);
  697.     else
  698.       TIME_STAMP := "                    ";
  699.     end if;
  700.   end if;
  701. end INITIALIZE;
  702. ::::::::::
  703. test2.flw
  704. ::::::::::
  705.   WHILE not OPENED loop
  706. Reserve word WHILE should be in lower case
  707.  
  708.     if TIME_ERROR = HOST_LCD_IF.NOT_AN_ERROR then
  709. This structure should have preceeding blank lines to set it off.
  710.  
  711.     if TIME_ERROR = HOST_LCD_IF.NOT_AN_ERROR then
  712. This structure should have following blank lines to set it off.
  713.  
  714.   if TEXT_IO.IS_OPEN(INPUT_FILES(FILE_LEVEL).FILE) then
  715. This structure should have preceeding blank lines to set it off.
  716.  
  717.   if TEXT_IO.IS_OPEN(INPUT_FILES(FILE_LEVEL).FILE) then
  718. This structure should have following blank lines to set it off.
  719.  
  720. -- 
  721. Finish checking started in above statement.  Total statements: 39
  722. ::::::::::
  723. test2.sty
  724. ::::::::::
  725. STYLE Report
  726. :USER1:POWERS:NOSC:TEST2.ADA
  727.  
  728.       Naming Conventions
  729. --------------------------------------------------------------------------
  730.       Invalid Case for an Object Identifier             0      Errors
  731.   *   Invalid Case for a Keyword                        1      Error
  732.       Name Segment Size (Separated         Desired     <5      Characters
  733.                   by Underscores)          Actual       4.8    Characters
  734.       Average Name Size                    Desired     >5      Characters
  735.                                            Actual       9.4    Characters
  736. --------------------------------------------------------------------------
  737.  
  738.       Physical Layout
  739. --------------------------------------------------------------------------
  740.       Occurrences of More Than One Statement/Line       0      Errors
  741.       Inconsistant Indentation                          0      Errors
  742.   *   Missing Blank Lines to Set Off a Block            2      Errors
  743.       Loops Without Names                               0      
  744. --------------------------------------------------------------------------
  745.  
  746.       Information Hiding, Abstraction, Data Use
  747. --------------------------------------------------------------------------
  748.       Percent of Literals In Body          Desired   < 30.0%
  749.   *                                        Actual     100.0%
  750.       Percent of Universal Types           Desired   < 40.0%
  751.                                            Actual       0.0%
  752.   !   Data Structuring Types NOT Used
  753.                                            Array Types
  754.                                            Enumeration Types
  755.                                            Record Types
  756.   !   No Attributes are Used
  757.   !   Ada-Specific Features NOT used
  758.                                            AND THEN
  759.                                            OR ELSE
  760.                                            EXITS
  761.                                            XOR
  762.                                            ELSIF
  763.                                            EXCEPTION
  764.                                            IN parameters
  765.                                            OUT parameters
  766.                                            IN OUT parameters
  767.                                            PRIVATEs
  768. --------------------------------------------------------------------------
  769.  
  770.       Modularity
  771. --------------------------------------------------------------------------
  772.       Average Number of Parameters         Range     0..4      Parameters
  773.         Instances of parameters below minimum           0      
  774.         Instances of parameters above maximum           0      
  775.       Average Subprogram Size              Range  10..200      Statements
  776.         Instances of size below minimum                 0      
  777.         Instances of size above maximum                 0      
  778.       Loops with too many exit statements               0      Instances
  779.       Control Structure Nesting            Maximum      8      
  780.                                            Exceeded     0      Instances
  781.       Package Nesting                      Maximum      2      
  782.                                            Exceeded     0      Instances
  783.       Subprogram Nesting                   Maximum      4      
  784.                                            Exceeded     0      Instances
  785. --------------------------------------------------------------------------
  786.  
  787.       Comment Usage
  788. --------------------------------------------------------------------------
  789.       Number of Comments                                9      Comments
  790.       Average Comment Size                 Desired    >15      Characters
  791.                                            Actual      37.4    Characters
  792. --------------------------------------------------------------------------
  793.  
  794.       Transportability
  795. --------------------------------------------------------------------------
  796.       Number of Lines Exceeding Line Length             0      
  797.       Address Clauses                                   0      
  798.       Representation Specifications                     0      
  799.       PRAGMA'S used:
  800.       Non-Standard PRAGMA's Used
  801.       Packages/Procedures WITHed
  802. --------------------------------------------------------------------------
  803.  
  804.       * => Style Flaw        ! => Note: Potential for improvement
  805.  
  806. Keyword Usage
  807.  Used Keyword    Allowed         Restriction     Occurrences     Percentage
  808. --------------------------------------------------------------------------
  809.       IF        yes             0.0%            4              16.7%
  810.       IS        yes             0.0%            1               4.2%
  811.       END       yes             0.0%            5              20.8%
  812.       NOT       yes             0.0%            2               8.3%
  813.       BODY      yes             0.0%            1               4.2%
  814.       ELSE      yes             0.0%            1               4.2%
  815.       LOOP      yes             0.0%            4              16.7%
  816.       THEN      yes             0.0%            2               8.3%
  817.       BEGIN     yes             0.0%            1               4.2%
  818.       WHILE     yes             0.0%            2               8.3%
  819.       PACKAGE   yes             0.0%            1               4.2%
  820. --------------------------------------------------------------------------
  821. ::::::::::
  822. test3a.ada
  823. ::::::::::
  824. --
  825. --   T E S T 3A
  826. --
  827. ------------------------------------------------------------------------
  828. -- This is a modification of Test 3 to include ALL Ada keywords!
  829.  
  830. with TEXT_IO;
  831. procedure INSERT         (LENGTH : in ID_RANGE;
  832.                           STRG : in ID_STRING;
  833.                           T : in out TREE;
  834.                           REFERENCE_LINE_NUMBER : in  LINE_NUM_RANGE) is
  835.   FOLLOW_CHAIN : REFPTR;                     -- used to follow
  836.                                              -- chain of references
  837.   TESTER       : BOOLEAN := TRUE;
  838.  
  839.   -----------------------------------------------------------------------
  840.   --The following package declarations and package bodies have been
  841.   --added to this module for testing purposes.
  842.   -----------------------------------------------------------------------
  843.  
  844.   package CHECKER is
  845.  
  846.     task INTERRUPT is
  847.         entry DONE;
  848.         for DONE use at 16#40#;
  849.  
  850.         function HELP return BOOLEAN is separate;
  851.  
  852.         subtype XDATA is new REALS digits 4;
  853.         type    YDATA is REALS digits 4 range 0.0 .. 100.0;
  854.         LIMIT : constant INTEGER := 3;
  855.  
  856.         type INFO is
  857.             record
  858.                 VERTICAL : YDATA;
  859.                 HORIZONTAL : XDATA
  860.             end record;
  861.     limited private
  862.  
  863.         type NEW_PTR is access INFO;
  864.  
  865.         OOPS : exception;
  866.         generic
  867.         package COUNTER is
  868.         begin
  869.                 return;
  870.         end COUNTER;
  871.     begin
  872.  
  873.     LOOP_NAME:
  874.       loop
  875.       <<INTERRUPT_NAME>>
  876.         accept INTERRUPT do
  877.             delay 60.0;
  878.             GET_IT(INFO.all);
  879.         end INTERRUPT;
  880.  
  881.  
  882.         declare
  883.                 EXTRA : exception renames OOPS;
  884.                 FRACT : FRACTION delta 0.0001;
  885.                 SAVER : array(0..1) of BOOLEAN;
  886.  
  887.         begin
  888.             for I in reverse 1..31 loop
  889.                 if abs(INFO.HORIZONTAL) mod 30 = 0 and then
  890.                    not HELP
  891.                    or else INFO.VERTICAL rem 30 then
  892.                     abort OTHER_TASK;
  893.                 elsif HELP xor TRUE then
  894.                     goto INTERRUPT_NAME;
  895.                 end if;
  896.             end loop;
  897.         end;
  898.  
  899.  
  900.         case HELP is
  901.             when others =>
  902.                 exit;
  903.         end case;
  904.  
  905.  
  906.         select
  907.             when HELP =>
  908.                 exit;
  909.             when others =>
  910.                 raise OOPS;
  911.         end select;
  912.       end loop LOOP_NAME;
  913.         terminate;
  914.     end INTERRUPT;
  915.  
  916.     ----------------------------------------------------
  917.     -- The following should be flagged on the inner packages
  918.     -- as being nested too deeply!
  919.     ----------------------------------------------------
  920.  
  921.     package CHECKER_ONE is
  922.       package CHECKER_TWO is
  923.         package CHECKER_THREE is
  924.           procedure TRY_AGAIN;
  925.         end CHECKER_THREE;
  926.       end CHECKER_TWO;
  927.     end CHECKER_ONE;
  928.  
  929.   end CHECKER;
  930.  
  931.   package body CHECKER is
  932.  
  933.     package body CHECKER_ONE is
  934.       package body CHECKER_TWO is
  935.         package body CHECKER_THREE is
  936.           procedure TRY_AGAIN is
  937.           begin
  938.             null;
  939.           end TRY_AGAIN;
  940.         end CHECKER_THREE;
  941.       end CHECKER_TWO;
  942.     end CHECKER_ONE;
  943.  
  944.   end CHECKER;
  945.  
  946.   -----------------------------------------------------------------------
  947.   --The following procedure calls have been added to check for nesting
  948.   --levels.
  949.   -----------------------------------------------------------------------
  950.  
  951.   procedure STUFFER is
  952.  
  953.     procedure STUFFERONE is
  954.  
  955.       procedure STUFFERTWO is
  956.  
  957.         procedure STUFFERTHREE is
  958.  
  959.           procedure STUFFERFOUR is
  960.             begin
  961.               TEXT_IO.PUT_LINE("In stufferfour!");
  962.             end STUFFERFOUR;
  963.  
  964.           begin
  965.             TEXT_IO.PUT_LINE("In stufferthree!");
  966.           end STUFFERTHREE;
  967.  
  968.         begin
  969.           TEXT_IO.PUT_LINE("In stuffertwo!");
  970.         end STUFFERTWO;
  971.  
  972.       begin
  973.         TEXT_IO.PUT_LINE("In stufferone!");
  974.       end STUFFERONE;
  975.  
  976.     begin
  977.       TEXT_IO.PUT_LINE("In stuffer!");
  978.     end STUFFER;
  979.  
  980. begin
  981.   if T = null then           -- add this identifier and reference here
  982.     T := new NODE'(STRG,LENGTH,null,null,null);
  983.     T.REFERENCES := new REFS'(REFERENCE_LINE_NUMBER,null);
  984.   else
  985.     if T.STRG = STRG then    -- new reference to old identifier
  986.       FOLLOW_CHAIN := T.REFERENCES;
  987.       while FOLLOW_CHAIN.NEXT /= null loop
  988.         FOLLOW_CHAIN := FOLLOW_CHAIN.NEXT;
  989.  
  990.         -------------------------------------------------------------------
  991.         --The following loops are added to test nesting levels of loops.
  992.         -- The outer loop should be flagged as nested too deep.
  993.         -- The inner loop should be flagged as needing a loop name.
  994.         -------------------------------------------------------------------
  995.  
  996.         while TESTER loop
  997.           while TESTER loop
  998.             while TESTER loop
  999.               for INDEX in 1..100 loop
  1000.                 while TESTER loop
  1001.                   while TESTER loop
  1002.                     -- should be flagged - nesting too deep
  1003.                     while TESTER loop
  1004.                       null;
  1005.                     end loop;
  1006.                   end loop;
  1007.                 end loop;
  1008.               end loop;
  1009.               TESTER := FALSE;
  1010.             end loop;
  1011.           end loop;
  1012.         end loop;
  1013.       end loop;
  1014.       TESTER := TRUE;
  1015.       if FOLLOW_CHAIN.REFNUM /= REFERENCE_LINE_NUMBER then
  1016.         FOLLOW_CHAIN.NEXT := new REFS'(REFERENCE_LINE_NUMBER,null);
  1017.       end if;
  1018.     else
  1019.       if T.STRG > STRG then
  1020.         INSERT(LENGTH,STRG,T.LEFT,REFERENCE_LINE_NUMBER);
  1021.       else
  1022.         INSERT(LENGTH,STRG,T.RIGHT,REFERENCE_LINE_NUMBER);
  1023.  
  1024.         -----------------------------------------------------------------------
  1025.         --The following if's are inserted for testing purposes.
  1026.         -----------------------------------------------------------------------
  1027.  
  1028.         if TESTER then
  1029.           if TESTER then
  1030.             if TESTER then
  1031.               if TESTER then
  1032.                 null;
  1033.               end if;
  1034.               null;
  1035.             end if;
  1036.             null;
  1037.           end if;
  1038.           null;
  1039.         end if;
  1040.       end if;
  1041.     end if;
  1042.   end if;
  1043. end INSERT;
  1044. pragma MAIN;
  1045. ::::::::::
  1046. test3a.flw
  1047. ::::::::::
  1048.         for DONE use at 16#40#;
  1049. This may be a non-transportable statement (Address Clause).
  1050.  
  1051.         declare
  1052. This structure should have following blank lines to set it off.
  1053.  
  1054.       loop
  1055. This structure should have following blank lines to set it off.
  1056.  
  1057.       loop
  1058. This structure is large enough that it should have a loop-name!
  1059.  
  1060.         terminate;
  1061. This line should be indented to column:   7
  1062.  
  1063.     task INTERRUPT is
  1064. This structure should have following blank lines to set it off.
  1065.  
  1066.       package CHECKER_TWO is
  1067. This package is nested too deeply!
  1068.  
  1069.         package CHECKER_THREE is
  1070. This package is nested too deeply!
  1071.  
  1072.     package CHECKER_ONE is
  1073. This structure should have following blank lines to set it off.
  1074.  
  1075.       package body CHECKER_TWO is
  1076. This package is nested too deeply!
  1077.  
  1078.         package body CHECKER_THREE is
  1079. This package is nested too deeply!
  1080.  
  1081.           procedure TRY_AGAIN is
  1082. This subprogram is smaller than the defined limits!
  1083.  
  1084.       package body CHECKER_TWO is
  1085. This structure should have preceeding blank lines to set it off.
  1086.  
  1087.       package body CHECKER_TWO is
  1088. This structure should have following blank lines to set it off.
  1089.  
  1090.     package body CHECKER_ONE is
  1091. This structure should have following blank lines to set it off.
  1092.  
  1093.         procedure STUFFERTHREE is
  1094. This subprogram is nested too deeply!
  1095.  
  1096.           procedure STUFFERFOUR is
  1097. This subprogram is nested too deeply!
  1098.  
  1099.           procedure STUFFERFOUR is
  1100. This subprogram is smaller than the defined limits!
  1101.  
  1102.         procedure STUFFERTHREE is
  1103. This subprogram is smaller than the defined limits!
  1104.  
  1105.                   while TESTER loop
  1106. This control structure is nested too deeply!
  1107.  
  1108.                     while TESTER loop
  1109. This control structure is nested too deeply!
  1110.  
  1111.                 while TESTER loop
  1112. This structure should have preceeding blank lines to set it off.
  1113.  
  1114.                 while TESTER loop
  1115. This structure should have following blank lines to set it off.
  1116.  
  1117.                 while TESTER loop
  1118. This structure is large enough that it should have a loop-name!
  1119.  
  1120.               for INDEX in 1..100 loop
  1121. This structure should have preceeding blank lines to set it off.
  1122.  
  1123.               for INDEX in 1..100 loop
  1124. This structure is large enough that it should have a loop-name!
  1125.  
  1126.             while TESTER loop
  1127. This structure is large enough that it should have a loop-name!
  1128.  
  1129.           while TESTER loop
  1130. This structure is large enough that it should have a loop-name!
  1131.  
  1132.         while TESTER loop
  1133. This structure is large enough that it should have a loop-name!
  1134.  
  1135.       while FOLLOW_CHAIN.NEXT /= null loop
  1136. This structure is large enough that it should have a loop-name!
  1137.  
  1138. pragma MAIN;
  1139. Transportability Note:  Non-Standard Pragma!
  1140.  
  1141. -- 
  1142. Finish checking started in above statement.  Total statements: 136
  1143. ::::::::::
  1144. test3a.sty
  1145. ::::::::::
  1146. STYLE Report
  1147. :USER1:POWERS:NOSC:TEST3A.ADA
  1148.  
  1149.       Naming Conventions
  1150. --------------------------------------------------------------------------
  1151.       Invalid Case for an Object Identifier             0      Errors
  1152.       Invalid Case for a Keyword                        0      Errors
  1153.       Name Segment Size (Separated         Desired     <5      Characters
  1154.   *               by Underscores)          Actual       5.8    Characters
  1155.       Average Name Size                    Desired     >5      Characters
  1156.                                            Actual       7.2    Characters
  1157. --------------------------------------------------------------------------
  1158.  
  1159.       Physical Layout
  1160. --------------------------------------------------------------------------
  1161.       Occurrences of More Than One Statement/Line       0      Errors
  1162.   *   Inconsistant Indentation                          1      Error
  1163.   *   Missing Blank Lines to Set Off a Block           18      Errors
  1164.   *   Loops Without Names                               7      
  1165. --------------------------------------------------------------------------
  1166.  
  1167.       Information Hiding, Abstraction, Data Use
  1168. --------------------------------------------------------------------------
  1169.       Percent of Literals In Body          Desired   < 30.0%
  1170.   *                                        Actual      59.1%
  1171.       Percent of Universal Types           Desired   < 40.0%
  1172.                                            Actual       8.3%
  1173.   !   Data Structuring Types NOT Used
  1174.                                            Enumeration Types
  1175.   !   No Attributes are Used
  1176.   !   Ada-Specific Features NOT used
  1177.                                            EXCEPTION
  1178.                                            OUT parameters
  1179. --------------------------------------------------------------------------
  1180.  
  1181.       Modularity
  1182. --------------------------------------------------------------------------
  1183.       Average Number of Parameters         Range     0..4      Parameters
  1184.         Instances of parameters below minimum           0      
  1185.         Instances of parameters above maximum           0      
  1186.       Average Subprogram Size              Range  10..200      Statements
  1187.   *     Instances of size below minimum                 3      
  1188.         Instances of size above maximum                 0      
  1189.       Loops with too many exit statements               0      Instances
  1190.       Control Structure Nesting            Maximum      8      
  1191.   *                                        Exceeded     2      Instances
  1192.       Package Nesting                      Maximum      2      
  1193.   *                                        Exceeded     4      Instances
  1194.       Subprogram Nesting                   Maximum      4      
  1195.   *                                        Exceeded     2      Instances
  1196. --------------------------------------------------------------------------
  1197.  
  1198.       Comment Usage
  1199. --------------------------------------------------------------------------
  1200.       Number of Comments                               30      Comments
  1201.       Average Comment Size                 Desired    >15      Characters
  1202.                                            Actual      48.2    Characters
  1203. --------------------------------------------------------------------------
  1204.  
  1205.       Transportability
  1206. --------------------------------------------------------------------------
  1207.       Number of Lines Exceeding Line Length             0      
  1208.   *   Address Clauses                                   1      
  1209.       Representation Specifications                     0      
  1210.       PRAGMA'S used:
  1211.       Non-Standard PRAGMA's Used
  1212.                                            MAIN
  1213.       Packages/Procedures WITHed
  1214. --------------------------------------------------------------------------
  1215.  
  1216.       * => Style Flaw        ! => Note: Potential for improvement
  1217.  
  1218. Keyword Usage
  1219.  Used Keyword    Allowed         Restriction     Occurrences     Percentage
  1220. --------------------------------------------------------------------------
  1221.       AT        yes             0.0%            1               0.4%
  1222.       DO        yes             0.0%            1               0.4%
  1223.       IF        yes             0.0%           18               7.5%
  1224.       IN        yes             0.0%            6               2.5%
  1225.       IS        yes             0.0%           23               9.5%
  1226.       OF        yes             0.0%            1               0.4%
  1227.       OR        yes             0.0%            1               0.4%
  1228.       ABS       yes             0.0%            1               0.4%
  1229.       ALL       yes             0.0%            1               0.4%
  1230.       AND       yes             0.0%            1               0.4%
  1231.       END       yes             0.0%           41              17.0%
  1232.       FOR       yes             0.0%            3               1.2%
  1233.       MOD       yes             0.0%            1               0.4%
  1234.       NEW       yes             0.0%            4               1.7%
  1235.       NOT       yes             0.0%            1               0.4%
  1236.       OUT       yes             0.0%            1               0.4%
  1237.       REM       yes             0.0%            1               0.4%
  1238.       USE       yes            20.0%            1               0.4%
  1239.       XOR       yes             0.0%            1               0.4%
  1240.       BODY      yes             0.0%            4               1.7%
  1241.       CASE      yes             0.0%            2               0.8%
  1242.       ELSE      yes             0.0%            4               1.7%
  1243.       EXIT      yes             0.0%            2               0.8%
  1244.   *   GOTO       no             0.0%            1               0.4%
  1245.       LOOP      yes             0.0%           20               8.3%
  1246.       NULL      yes             0.0%           13               5.4%
  1247.       TASK      yes             0.0%            1               0.4%
  1248.       THEN      yes             0.0%           11               4.6%
  1249.       TYPE      yes             0.0%            3               1.2%
  1250.       WHEN      yes             0.0%            3               1.2%
  1251.       WITH      yes             0.0%            1               0.4%
  1252.       ABORT     yes             0.0%            1               0.4%
  1253.       ARRAY     yes             0.0%            1               0.4%
  1254.       BEGIN     yes             0.0%           10               4.1%
  1255.       DELAY     yes             0.0%            1               0.4%
  1256.       DELTA     yes             0.0%            1               0.4%
  1257.       ELSIF     yes             0.0%            1               0.4%
  1258.       ENTRY     yes             0.0%            1               0.4%
  1259.       RAISE     yes             0.0%            1               0.4%
  1260.       RANGE     yes             0.0%            1               0.4%
  1261.       WHILE     yes             0.0%            7               2.9%
  1262.       ACCEPT    yes             0.0%            1               0.4%
  1263.       ACCESS    yes             0.0%            1               0.4%
  1264.       DIGITS    yes             0.0%            2               0.8%
  1265.       OTHERS    yes             0.0%            2               0.8%
  1266.       PRAGMA    yes             0.0%            1               0.4%
  1267.       RECORD    yes             0.0%            2               0.8%
  1268.       RETURN    yes             0.0%            2               0.8%
  1269.       SELECT    yes             0.0%            2               0.8%
  1270.       DECLARE   yes             0.0%            1               0.4%
  1271.       GENERIC   yes             0.0%            1               0.4%
  1272.       LIMITED   yes             0.0%            1               0.4%
  1273.       PACKAGE   yes             0.0%            9               3.7%
  1274.       PRIVATE   yes             0.0%            1               0.4%
  1275.       RENAMES   yes             0.0%            1               0.4%
  1276.       REVERSE   yes             0.0%            1               0.4%
  1277.       SUBTYPE   yes             0.0%            1               0.4%
  1278.       CONSTANT  yes             0.0%            1               0.4%
  1279.       FUNCTION  yes             0.0%            1               0.4%
  1280.       SEPARATE  yes             0.0%            1               0.4%
  1281.       EXCEPTION yes             0.0%            2               0.8%
  1282.       PROCEDURE yes             0.0%            8               3.3%
  1283.       TERMINATE yes             0.0%            1               0.4%
  1284. --------------------------------------------------------------------------
  1285. ::::::::::
  1286. test4.ada
  1287. ::::::::::
  1288. -------------------------PROLOGUE---------------------------------------
  1289. --                                                                    -*
  1290. -- Unit name    : next_character
  1291. -- Author       : Richard D. Powers
  1292. -- Date created : 7-29-83
  1293. -- Last update  :
  1294. --                                                                    -*
  1295. ------------------------------------------------------------------------
  1296. --                                                                    -*
  1297. -- Abstract     : This procedure returns the next character from the
  1298. ----------------: input stream.  If the character is a lower case
  1299. ----------------: letter then it is converted to upper case.
  1300. --                                                                    -*
  1301. ------------------------------------------------------------------------
  1302. --                                                                    -*
  1303. -- Inputs       : INPUT_FILES - global file record
  1304. -- Outputs      : CH - next character from input stream
  1305. -- Procedures called : GET_LINE, NEXT_CHARACTER
  1306. -- Exceptions   : If end of file is encountered then the return
  1307. --                character is not changed, but current line will
  1308. --                have it's length set to -1.
  1309. --                                                                    -*
  1310. ------------------------------------------------------------------------
  1311. --
  1312. -- Mnemonic     :
  1313. -- Name         :
  1314. -- Release date :
  1315. ------------------ Revision history ------------------------------------
  1316. --
  1317. -- DATE         AUTHOR                  HISTORY
  1318. --
  1319. --
  1320. --
  1321. --------------------END-PROLOGUE----------------------------------------
  1322.  
  1323. with TEXT_IO;
  1324. procedure NEXT_CHARACTER         (CH : out CHARACTER) is
  1325. --pragma INCLUDE("GETLINE.ada.");
  1326. -------------------------PROLOGUE---------------------------------------
  1327. --                                                                    -*
  1328. -- Unit name    : get_line
  1329. -- Author       : Richard D. Powers
  1330. -- Date created : 7-29-83
  1331. -- Last update  : 10-07-83
  1332. --                                                                    -*
  1333. ------------------------------------------------------------------------
  1334. --                                                                    -*
  1335. -- Abstract     : This procedure gets the next line from the input
  1336. ----------------: stream.
  1337. --                                                                    -*
  1338. ------------------------------------------------------------------------
  1339. --                                                                    -*
  1340. -- Inputs       : INPUT_FILE - global file record
  1341. -- Outputs      : LINE - next line from input stream
  1342. -- Procedures called : PUT_HEADER, TEXT_IO.END_OF_FILE,
  1343. --                     TEXT_IO.END_OF_LINE, TEXT_IO.GET,
  1344. --                     TEXT_IO.INTEGER_IO.PUT, TEXT_IO.NEW_LINE
  1345. --                     TEXT_IO.PUT, TEXT_IO.SKIP_LINE
  1346. -- Exceptions   : If end of file is encountered then line length is
  1347. --                set to -1.
  1348. --                                                                    -*
  1349. ------------------------------------------------------------------------
  1350. --
  1351. -- Mnemonic     :
  1352. -- Name         :
  1353. -- Release date :
  1354. ------------------ Revision history ------------------------------------
  1355. --
  1356. -- DATE         AUTHOR                  HISTORY
  1357. -- 10-07-83     R. Powers       Don't read a character at a time
  1358. --
  1359. --
  1360. --------------------END-PROLOGUE----------------------------------------
  1361. procedure GET_LINE(LINE : out LINE_RECORD) is
  1362.   NEWLINE : STRING(1..MAX_LINE_LENGTH);      -- parameter for text_io routines
  1363.  
  1364.   LOOP_FLAG,LOOP_FLAG_ONE : BOOLEAN := true;
  1365.  
  1366. begin
  1367.  
  1368. ---------------------------------------------------------------------
  1369. --A loop added here for testing purposes.
  1370. ---------------------------------------------------------------------
  1371.  
  1372. for INDEX in 1..1 loop --long loop (no name) should be flagged.
  1373.   LOOP_TEST:  --long loop with a name (no flag)
  1374.   for INDEX in 1..1 loop
  1375.   if TEXT_IO.END_OF_FILE(INPUT_FILES(FILE_LEVEL).FILE) then
  1376.     LINE.LENGTH := -1;
  1377.     LINE.COLUMN := 0;
  1378.   else
  1379.     if LINE_NUMBER mod 40 = 0 then
  1380.       TEXT_IO.NEW_LINE;
  1381.     end if;
  1382.     if LINE_NUMBER mod 58 = 0 then
  1383.       PUT_HEADER;
  1384.     end if;
  1385.     TEXT_IO.PUT('.');
  1386.     LINE_NUMBER := LINE_NUMBER + 1;
  1387.     TEXT_IO.INTEGER_IO.PUT(OUTPUT_FILE,LINE_NUMBER,5);
  1388.     if LOOP_FLAG then
  1389.       exit;
  1390.     end if;
  1391.     if LOOP_FLAG_ONE then
  1392.       exit LOOP_TEST;
  1393.     end if;
  1394.     while LOOP_FLAG loop   --Multiple exits should be flagged.
  1395.       LOOP_FLAG := false;
  1396.       if LOOP_FLAG then
  1397.         exit LOOP_TEST;
  1398.       end if;
  1399.       exit;
  1400.     end loop;
  1401.     exit LOOP_TEST;
  1402.     TEXT_IO.PUT(OUTPUT_FILE,' ');
  1403.     TEXT_IO.GET_LINE(INPUT_FILES(FILE_LEVEL).FILE,NEWLINE,LINE.LENGTH);
  1404.     if LINE.LENGTH > 75 then -- only write first 75 characters
  1405.       TEXT_IO.PUT(OUTPUT_FILE,NEWLINE(1..74));
  1406.     else
  1407.       TEXT_IO.PUT(OUTPUT_FILE,NEWLINE(1..LINE.LENGTH));
  1408.     end if;
  1409.     for I in 1..LINE.LENGTH loop
  1410.       LINE.LINE(I) := NEWLINE(I); --No exits in loop (no flags)
  1411.     end loop;
  1412.     LINE.COLUMN := 0;
  1413.     TEXT_IO.NEW_LINE(OUTPUT_FILE);
  1414.   end if;
  1415.   end loop LOOP_TEST;
  1416. end loop;
  1417. end GET_LINE;
  1418.  
  1419. begin
  1420.   if INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
  1421.     INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH then
  1422.     INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN :=
  1423.           INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN + 1;
  1424.     CH := INPUT_FILES(FILE_LEVEL).CURRENT_LINE.
  1425.           LINE(INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN);
  1426.   elsif INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH > -1 then
  1427.     GET_LINE(INPUT_FILES(FILE_LEVEL).CURRENT_LINE);
  1428.     NEXT_CHARACTER(CH);
  1429.   end if;
  1430.   if (CH >= 'a') and (CH <= 'z') then
  1431.     CH := CHARACTER'VAL(CHARACTER'POS(CH) - CHARACTER'POS('a') +
  1432.           CHARACTER'POS('A'));
  1433.   end if;
  1434. end NEXT_CHARACTER;
  1435. ::::::::::
  1436. test4.flw
  1437. ::::::::::
  1438. procedure GET_LINE(LINE : out LINE_RECORD) is
  1439. Beginning of this block not indented properly. Line ignored for Indentation!
  1440.  
  1441.   LOOP_FLAG,LOOP_FLAG_ONE : BOOLEAN := true;
  1442. Object name true should be in upper case
  1443.  
  1444. for INDEX in 1..1 loop --long loop (no name) should be flagged. 
  1445. Beginning of this block not indented properly. Line ignored for Indentation!
  1446.  
  1447.   LOOP_TEST:  --long loop with a name (no flag) 
  1448. This Loop-name should be outdented further!
  1449.  
  1450.   if TEXT_IO.END_OF_FILE(INPUT_FILES(FILE_LEVEL).FILE) then
  1451. Beginning of this block not indented properly. Line ignored for Indentation!
  1452.  
  1453.       LOOP_FLAG := false;
  1454. Object name false should be in upper case
  1455.  
  1456.     while LOOP_FLAG loop   --Multiple exits should be flagged. 
  1457. This structure should have preceeding blank lines to set it off.
  1458.  
  1459.     while LOOP_FLAG loop   --Multiple exits should be flagged. 
  1460. This structure should have following blank lines to set it off.
  1461.  
  1462.     while LOOP_FLAG loop   --Multiple exits should be flagged. 
  1463. This structure is large enough that it should have a loop-name!
  1464.  
  1465.     while LOOP_FLAG loop   --Multiple exits should be flagged. 
  1466. This loop has more EXITS than allowed by the style.
  1467.  
  1468.   if TEXT_IO.END_OF_FILE(INPUT_FILES(FILE_LEVEL).FILE) then
  1469. This structure should have preceeding blank lines to set it off.
  1470.  
  1471.   if TEXT_IO.END_OF_FILE(INPUT_FILES(FILE_LEVEL).FILE) then
  1472. This structure should have following blank lines to set it off.
  1473.  
  1474.   for INDEX in 1..1 loop
  1475. This structure should have following blank lines to set it off.
  1476.  
  1477.   for INDEX in 1..1 loop
  1478. This structure is large enough that it should have a loop-name!
  1479.  
  1480. for INDEX in 1..1 loop --long loop (no name) should be flagged. 
  1481. This structure should have following blank lines to set it off.
  1482.  
  1483. for INDEX in 1..1 loop --long loop (no name) should be flagged. 
  1484. This structure is large enough that it should have a loop-name!
  1485.  
  1486. procedure GET_LINE(LINE : out LINE_RECORD) is
  1487. This structure should have following blank lines to set it off.
  1488.  
  1489. procedure NEXT_CHARACTER         (CH : out CHARACTER) is
  1490. This structure should have following blank lines to set it off.
  1491.  
  1492. -------------------------PROLOGUE--------------------------------------- 
  1493. Finish checking started in above statement.  Total statements: 61
  1494. ::::::::::
  1495. test4.sty
  1496. ::::::::::
  1497. STYLE Report
  1498. :USER1:POWERS:NOSC:TEST4.ADA
  1499.  
  1500.       Naming Conventions
  1501. --------------------------------------------------------------------------
  1502.   *   Invalid Case for an Object Identifier             2      Errors
  1503.       Invalid Case for a Keyword                        0      Errors
  1504.       Name Segment Size (Separated         Desired     <5      Characters
  1505.                   by Underscores)          Actual       4.6    Characters
  1506.       Average Name Size                    Desired     >5      Characters
  1507.                                            Actual       7.7    Characters
  1508. --------------------------------------------------------------------------
  1509.  
  1510.       Physical Layout
  1511. --------------------------------------------------------------------------
  1512.       Occurrences of More Than One Statement/Line       0      Errors
  1513.   *   Inconsistant Indentation                          4      Errors
  1514.   *   Missing Blank Lines to Set Off a Block            6      Errors
  1515.   *   Loops Without Names                               3      
  1516. --------------------------------------------------------------------------
  1517.  
  1518.       Information Hiding, Abstraction, Data Use
  1519. --------------------------------------------------------------------------
  1520.       Percent of Literals In Body          Desired   < 30.0%
  1521.   *                                        Actual      96.3%
  1522.       Percent of Universal Types           Desired   < 40.0%
  1523.                                            Actual       0.0%
  1524.   !   Data Structuring Types NOT Used
  1525.                                            Array Types
  1526.                                            Enumeration Types
  1527.                                            Record Types
  1528.   !   Ada-Specific Features NOT used
  1529.                                            AND THEN
  1530.                                            OR ELSE
  1531.                                            XOR
  1532.                                            EXCEPTION
  1533.                                            IN OUT parameters
  1534.                                            PRIVATEs
  1535. --------------------------------------------------------------------------
  1536.  
  1537.       Modularity
  1538. --------------------------------------------------------------------------
  1539.       Average Number of Parameters         Range     0..4      Parameters
  1540.         Instances of parameters below minimum           0      
  1541.         Instances of parameters above maximum           0      
  1542.       Average Subprogram Size              Range  10..200      Statements
  1543.         Instances of size below minimum                 0      
  1544.         Instances of size above maximum                 0      
  1545.   *   Loops with too many exit statements               1      Instance
  1546.       Control Structure Nesting            Maximum      8      
  1547.                                            Exceeded     0      Instances
  1548.       Package Nesting                      Maximum      2      
  1549.                                            Exceeded     0      Instances
  1550.       Subprogram Nesting                   Maximum      4      
  1551.                                            Exceeded     0      Instances
  1552. --------------------------------------------------------------------------
  1553.  
  1554.       Comment Usage
  1555. --------------------------------------------------------------------------
  1556.       Number of Comments                               79      Comments
  1557.       Average Comment Size                 Desired    >15      Characters
  1558.                                            Actual      45.5    Characters
  1559. --------------------------------------------------------------------------
  1560.  
  1561.       Transportability
  1562. --------------------------------------------------------------------------
  1563.       Number of Lines Exceeding Line Length             0      
  1564.       Address Clauses                                   0      
  1565.       Representation Specifications                     0      
  1566.       PRAGMA'S used:
  1567.       Non-Standard PRAGMA's Used
  1568.       Packages/Procedures WITHed
  1569. --------------------------------------------------------------------------
  1570.  
  1571.       * => Style Flaw        ! => Note: Potential for improvement
  1572.  
  1573. Keyword Usage
  1574.  Used Keyword    Allowed         Restriction     Occurrences     Percentage
  1575. --------------------------------------------------------------------------
  1576.       IF        yes             0.0%           18              23.1%
  1577.       IN        yes             0.0%            3               3.8%
  1578.       IS        yes             0.0%            2               2.6%
  1579.       AND       yes             0.0%            1               1.3%
  1580.       END       yes             0.0%           15              19.2%
  1581.       FOR       yes             0.0%            3               3.8%
  1582.       MOD       yes             0.0%            2               2.6%
  1583.       OUT       yes             0.0%            2               2.6%
  1584.       ELSE      yes             0.0%            2               2.6%
  1585.       EXIT      yes             0.0%            5               6.4%
  1586.       LOOP      yes             0.0%            8              10.3%
  1587.       THEN      yes             0.0%           10              12.8%
  1588.       WITH      yes             0.0%            1               1.3%
  1589.       BEGIN     yes             0.0%            2               2.6%
  1590.       ELSIF     yes             0.0%            1               1.3%
  1591.       WHILE     yes             0.0%            1               1.3%
  1592.       PROCEDURE yes             0.0%            2               2.6%
  1593. --------------------------------------------------------------------------
  1594. ::::::::::
  1595. test5.ada
  1596. ::::::::::
  1597. -----------------------------------------------------------------------
  1598. --This procedure has been altered in order to provide tests for the
  1599. --Style Checker program.  Line length must be set by the parameters
  1600. --of the Checker with a maximum length of 80 characters.
  1601. -------------------------PROLOGUE---------------------------------------
  1602. --                                                                    -*
  1603. -- Unit name    : next_identifier
  1604. -- Author       : Richard D. Powers
  1605. -- Date created : 7-29-83
  1606. -- Last update  :
  1607. --                                                                    -*
  1608. ------------------------------------------------------------------------
  1609. --                                                                    -*
  1610. -- Abstract     : This procedure returns the next identifier in the
  1611. ----------------: input stream.
  1612. --                                                                    -*
  1613. ------------------------------------------------------------------------
  1614. --                                                                    -*
  1615. -- Inputs       : INPUT_FILES - global input file record
  1616. -- Outputs      : IDENTIFIER - next identifier from input stream
  1617. --                LENGTH - length of next identifier
  1618. --                REFERENCE_LINE_NUMBER - line number of this id
  1619. -- Procedures called : NEXT_CHARACTER
  1620. -- Exceptions   : if no identifier is found (i.e. end of file) then
  1621. --                LENGTH is set to zero.
  1622. --                                                                    -*
  1623. ------------------------------------------------------------------------
  1624. --
  1625. -- Mnemonic     :
  1626. -- Name         :
  1627. -- Release date :
  1628. ------------------ Revision history ------------------------------------
  1629. --
  1630. -- DATE         AUTHOR                  HISTORY
  1631. --
  1632. --
  1633. --
  1634. --------------------END-PROLOGUE----------------------------------------
  1635.  
  1636. with CURRENT_EXCEPTION;
  1637. with TEXT_IO;
  1638. procedure NEXT_IDENTIFIER(IDENTIFIER : out LINE_STRING;
  1639.                           LENGTH : out LINE_INDEX_RANGE;
  1640.                           REFERENCE_LINE_NUMBER : out LINE_NUM_RANGE) is
  1641.  
  1642.   ------------------------------------------------------------------------
  1643.   --The following is added to test the flagging of representation specs.
  1644.   ------------------------------------------------------------------------
  1645.  
  1646.   type MEDIUM is range 0..100;
  1647.   BYTE : constant := 8;
  1648.   for MEDIUM'SIZE use 2*BYTE;
  1649.  
  1650.   type COLOR is (RED,BLUE,YELLOW);
  1651.   for COLOR use (RED => 5,BLUE => 10,YELLOW => 15);
  1652.  
  1653.  
  1654.   CH : CHARACTER;                            -- get a character at a time
  1655.   INDEX : INTEGER range 0..MAX_LINE_LENGTH;  -- index into identifier
  1656.  
  1657.   ------------------------------------------------------------------------
  1658.   --The following is a test for recognition of Pragmas
  1659.   ------------------------------------------------------------------------
  1660.  
  1661.  
  1662.  
  1663. pragma LIST(OFF);
  1664. pragma LIST(ON);
  1665. pragma OPTIMIZE(SPACE);
  1666. pragma PAGE;
  1667. begin
  1668.   for I in 1..ID_LENGTH loop
  1669.     IDENTIFIER(I) := ' ';
  1670.   end loop;
  1671.   CH := ' ';                      -- force entry into first loop
  1672.   WHILE not ((CH >= 'A') and (CH <= 'Z'))
  1673.     and (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH > -1) loop
  1674.     NEXT_CHARACTER(CH);
  1675.     if CH = '-' then               -- look for comment indicator
  1676.       INDEX := INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN;
  1677.                                    -- remember which column we are at
  1678.       NEXT_CHARACTER(CH);
  1679.       if (CH = '-') and
  1680.         (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN = INDEX + 1)
  1681.         then                       -- found a comment
  1682.         while INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
  1683.           INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH loop
  1684.           NEXT_CHARACTER(CH);
  1685.         end loop;
  1686.         CH := ' ';                  -- force us to remain in loop
  1687.       end if;
  1688.     end if;
  1689.     ----------------------------------------------------------------------------
  1690.     --This is a long line to allow for the maximum parameter of the StyleChecker
  1691.     ----------------------------------------------------------------------------
  1692.  
  1693.     if (CH >= '0' and CH <= '9') then -- skip over literals
  1694.       NEXT_CHARACTER(CH);
  1695.       while ((CH >= '0' and CH <= '9') or (CH = 'E') OR (CH = '_')) and
  1696.         (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
  1697.          INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
  1698.         loop
  1699.         NEXT_CHARACTER(CH);
  1700.         if (CH = '#') then            -- skip over based literals
  1701.           NEXT_CHARACTER(CH);
  1702.           WHILE (CH /= '#') and
  1703.             (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
  1704.              INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
  1705.             loop
  1706.             NEXT_CHARACTER(CH);
  1707.           end loop;
  1708.           NEXT_CHARACTER(CH);
  1709.         end if;
  1710.       end loop;
  1711.     end if;
  1712.     if (CH = '"') then                 -- skip over string constants
  1713.       NEXT_CHARACTER(CH);
  1714.       while (CH /= '"') and
  1715.         (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
  1716.          INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
  1717.         loop
  1718.           NEXT_CHARACTER(CH);
  1719.       end loop;
  1720.     end if;
  1721.     if ((CH = ''') and
  1722.       (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN + 2 <=
  1723.       INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)) and then
  1724.       INPUT_FILES(FILE_LEVEL).CURRENT_LINE.
  1725.            LINE(INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN + 2) = '''
  1726.       then
  1727.       NEXT_CHARACTER(CH);              -- skip character constant
  1728.       NEXT_CHARACTER(CH);              -- skip end of constant delimiter
  1729.     end if;
  1730.   end loop;
  1731.   if INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH = -1 then
  1732.     LENGTH := 0;                       -- end of file encountered
  1733.   else
  1734.     if INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN =
  1735.         INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH
  1736.       then                             -- last character on line
  1737.       IDENTIFIER(1) := CH;
  1738.       LENGTH := 1;
  1739.       REFERENCE_LINE_NUMBER := LINE_NUMBER;
  1740.     else
  1741.       REFERENCE_LINE_NUMBER := LINE_NUMBER;
  1742.       INDEX := 0;
  1743.       while (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
  1744.         INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
  1745.         and (((CH >= 'A') and (CH <= 'Z')) or (CH = '_') or
  1746.         ((CH >= '0') and (CH <= '9'))) loop
  1747.         INDEX := INDEX + 1;
  1748.         IDENTIFIER(INDEX) := CH;
  1749.         NEXT_CHARACTER(CH);
  1750.         if (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN =
  1751.           INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
  1752.           and (((CH >= 'A') and (CH <= 'Z')) OR
  1753.           ((CH >= '0') and (CH <= '9')) or (CH = '_')) then
  1754.           INDEX := INDEX + 1;
  1755.           IDENTIFIER(INDEX) := CH;
  1756.         end if;
  1757.       end loop;
  1758.       if INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN /=
  1759.          INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH
  1760.         then
  1761.         INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN :=
  1762.             INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN - 1;
  1763.       end if;
  1764.       if INDEX > ID_LENGTH then
  1765.         LENGTH := ID_LENGTH;
  1766.       else
  1767.         LENGTH := INDEX;
  1768.       end if;
  1769.     end if;
  1770.   end if;
  1771.   ----------------------------------------------------------------------
  1772.   --A call to a proscribed package
  1773.   ----------------------------------------------------------------------
  1774.   TEXT_IO.PUT(CURRENT_EXCEPTION.NAME);
  1775.   ----------------------------------------------------------------------
  1776. end NEXT_IDENTIFIER;
  1777.  
  1778. ----------------------------------------------------------------------
  1779. pragma MAIN;
  1780. ----------------------------------------------------------------------
  1781. ::::::::::
  1782. test5.flw
  1783. ::::::::::
  1784. with CURRENT_EXCEPTION;
  1785. This package is on the list of packages to be warned against.
  1786.  
  1787.   for MEDIUM'SIZE use 2*BYTE;
  1788. This may be a non-transportable statement (Representation Specification).
  1789.  
  1790.   for COLOR use (RED => 5,BLUE => 10,YELLOW => 15);
  1791. This may be a non-transportable statement (Representation Specification).
  1792.  
  1793. pragma LIST(OFF);
  1794. This line is not indented enough!
  1795.  
  1796. pragma LIST(OFF);
  1797. Transportability Note:  Pragma.
  1798.  
  1799. pragma LIST(ON);
  1800. This line is not indented enough!
  1801.  
  1802. pragma LIST(ON);
  1803. Transportability Note:  Pragma.
  1804.  
  1805. pragma OPTIMIZE(SPACE);
  1806. This line is not indented enough!
  1807.  
  1808. pragma OPTIMIZE(SPACE);
  1809. Transportability Note:  Pragma.
  1810.  
  1811. pragma PAGE;
  1812. This line is not indented enough!
  1813.  
  1814. pragma PAGE;
  1815. Transportability Note:  Pragma.
  1816.  
  1817.   WHILE not ((CH >= 'A') and (CH <= 'Z'))
  1818. Reserve word WHILE should be in lower case
  1819.  
  1820.     if CH = '-' then               -- look for comment indicator 
  1821. This structure should have preceeding blank lines to set it off.
  1822.  
  1823.     if CH = '-' then               -- look for comment indicator 
  1824. This structure should have following blank lines to set it off.
  1825.  
  1826.     ---------------------------------------------------------------------------- 
  1827. This line exceeds maximum line length
  1828.  
  1829.     --This is a long line to allow for the maximum parameter of the StyleChecker 
  1830. This line exceeds maximum line length
  1831.  
  1832.     ---------------------------------------------------------------------------- 
  1833. This line exceeds maximum line length
  1834.  
  1835.       while ((CH >= '0' and CH <= '9') or (CH = 'E') OR (CH = '_')) and
  1836. Reserve word OR should be in lower case
  1837.  
  1838.           WHILE (CH /= '#') and
  1839. Reserve word WHILE should be in lower case
  1840.  
  1841.         if (CH = '#') then            -- skip over based literals 
  1842. This structure should have preceeding blank lines to set it off.
  1843.  
  1844.         if (CH = '#') then            -- skip over based literals 
  1845. This structure should have following blank lines to set it off.
  1846.  
  1847.       while ((CH >= '0' and CH <= '9') or (CH = 'E') OR (CH = '_')) and
  1848. This structure should have preceeding blank lines to set it off.
  1849.  
  1850.       while ((CH >= '0' and CH <= '9') or (CH = 'E') OR (CH = '_')) and
  1851. This structure should have following blank lines to set it off.
  1852.  
  1853.       while ((CH >= '0' and CH <= '9') or (CH = 'E') OR (CH = '_')) and
  1854. This structure is large enough that it should have a loop-name!
  1855.  
  1856.     if (CH >= '0' and CH <= '9') then -- skip over literals 
  1857. This structure should have following blank lines to set it off.
  1858.  
  1859.   WHILE not ((CH >= 'A') and (CH <= 'Z'))
  1860. This structure should have following blank lines to set it off.
  1861.  
  1862.   WHILE not ((CH >= 'A') and (CH <= 'Z'))
  1863. This structure is large enough that it should have a loop-name!
  1864.  
  1865.           and (((CH >= 'A') and (CH <= 'Z')) OR
  1866. Reserve word OR should be in lower case
  1867.  
  1868.       while (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
  1869. This structure should have preceeding blank lines to set it off.
  1870.  
  1871.       while (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
  1872. This structure should have following blank lines to set it off.
  1873.  
  1874.       while (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
  1875. This structure is large enough that it should have a loop-name!
  1876.  
  1877. pragma MAIN;
  1878. Transportability Note:  Non-Standard Pragma!
  1879.  
  1880. ----------------------------------------------------------------------- 
  1881. Finish checking started in above statement.  Total statements: 81
  1882. ::::::::::
  1883. test5.sty
  1884. ::::::::::
  1885. STYLE Report
  1886. :USER1:POWERS:NOSC:NEWTEST5.ADA
  1887.  
  1888.       Naming Conventions
  1889. --------------------------------------------------------------------------
  1890.       Invalid Case for an Object Identifier             0      Errors
  1891.   *   Invalid Case for a Keyword                        4      Errors
  1892.       Name Segment Size (Separated         Desired     <5      Characters
  1893.   *               by Underscores)          Actual       5.5    Characters
  1894.       Average Name Size                    Desired     >5      Characters
  1895.                                            Actual       7.7    Characters
  1896. --------------------------------------------------------------------------
  1897.  
  1898.       Physical Layout
  1899. --------------------------------------------------------------------------
  1900.       Occurrences of More Than One Statement/Line       0      Errors
  1901.   *   Inconsistant Indentation                          4      Errors
  1902.   *   Missing Blank Lines to Set Off a Block            9      Errors
  1903.   *   Loops Without Names                               3      
  1904. --------------------------------------------------------------------------
  1905.  
  1906.       Information Hiding, Abstraction, Data Use
  1907. --------------------------------------------------------------------------
  1908.       Percent of Literals In Body          Desired   < 30.0%
  1909.   *                                        Actual      84.0%
  1910.       Percent of Universal Types           Desired   < 40.0%
  1911.                                            Actual      20.0%
  1912.   !   Data Structuring Types NOT Used
  1913.                                            Array Types
  1914.                                            Record Types
  1915.   !   Ada-Specific Features NOT used
  1916.                                            OR ELSE
  1917.                                            EXITS
  1918.                                            XOR
  1919.                                            ELSIF
  1920.                                            EXCEPTION
  1921.                                            IN OUT parameters
  1922.                                            PRIVATEs
  1923. --------------------------------------------------------------------------
  1924.  
  1925.       Modularity
  1926. --------------------------------------------------------------------------
  1927.       Average Number of Parameters         Range     0..4      Parameters
  1928.         Instances of parameters below minimum           0      
  1929.         Instances of parameters above maximum           0      
  1930.       Average Subprogram Size              Range  10..200      Statements
  1931.         Instances of size below minimum                 0      
  1932.         Instances of size above maximum                 0      
  1933.       Loops with too many exit statements               0      Instances
  1934.       Control Structure Nesting            Maximum      8      
  1935.                                            Exceeded     0      Instances
  1936.       Package Nesting                      Maximum      2      
  1937.                                            Exceeded     0      Instances
  1938.       Subprogram Nesting                   Maximum      4      
  1939.                                            Exceeded     0      Instances
  1940. --------------------------------------------------------------------------
  1941.  
  1942.       Comment Usage
  1943. --------------------------------------------------------------------------
  1944.       Number of Comments                               67      Comments
  1945.       Average Comment Size                 Desired    >15      Characters
  1946.                                            Actual      47.1    Characters
  1947. --------------------------------------------------------------------------
  1948.  
  1949.       Transportability
  1950. --------------------------------------------------------------------------
  1951.   *   Number of Lines Exceeding Line Length             3      
  1952.       Address Clauses                                   0      
  1953.   *   Representation Specifications                     2      
  1954.       PRAGMA'S used:
  1955.                                            LIST
  1956.                                            LIST
  1957.                                            OPTIMIZE
  1958.                                            PAGE
  1959.       Non-Standard PRAGMA's Used
  1960.                                            MAIN
  1961.       Packages/Procedures WITHed
  1962.                                            CURRENT_EXCEPTION
  1963. --------------------------------------------------------------------------
  1964.  
  1965.       * => Style Flaw        ! => Note: Potential for improvement
  1966.  
  1967. Keyword Usage
  1968.  Used Keyword    Allowed         Restriction     Occurrences     Percentage
  1969. --------------------------------------------------------------------------
  1970.       IF        yes             0.0%           22              17.6%
  1971.       IN        yes             0.0%            1               0.8%
  1972.       IS        yes             0.0%            3               2.4%
  1973.       OR        yes             0.0%            6               4.8%
  1974.       AND       yes             0.0%           16              12.8%
  1975.       END       yes             0.0%           19              15.2%
  1976.       FOR       yes             0.0%            3               2.4%
  1977.       NOT       yes             0.0%            1               0.8%
  1978.       OUT       yes             0.0%            3               2.4%
  1979.       USE       yes            20.0%            2               1.6%
  1980.       ELSE      yes             0.0%            3               2.4%
  1981.       LOOP      yes             0.0%           14              11.2%
  1982.       THEN      yes             0.0%           12               9.6%
  1983.       TYPE      yes             0.0%            2               1.6%
  1984.       WITH      yes             0.0%            2               1.6%
  1985.       BEGIN     yes             0.0%            1               0.8%
  1986.       RANGE     yes             0.0%            2               1.6%
  1987.       WHILE     yes             0.0%            6               4.8%
  1988.       PRAGMA    yes             0.0%            5               4.0%
  1989.       CONSTANT  yes             0.0%            1               0.8%
  1990.       PROCEDURE yes             0.0%            1               0.8%
  1991. --------------------------------------------------------------------------
  1992. ::::::::::
  1993. test6.ada
  1994. ::::::::::
  1995. -------------------------PROLOGUE---------------------------------------
  1996. --                                                                    -*
  1997. -- Unit name    : push_file
  1998. -- Author       : Richard D. Powers
  1999. -- Date created : 7-29-83
  2000. -- Last update  : 1-31-84
  2001. --                                                                    -*
  2002. ------------------------------------------------------------------------
  2003. --                                                                    -*
  2004. -- Abstract     : This procedure handles the pragma include, opening
  2005. ----------------: the include file and pointing current input to it.
  2006. --                                                                    -*
  2007. ------------------------------------------------------------------------
  2008. --                                                                    -*
  2009. -- Inputs       : INPUT_FILES - global file record
  2010. -- Outputs      : INPUT_FILES - global file record
  2011. -- Procedures called : NEXT_CHARACTER, FILE_IO.OPEN_INPUT_FILE,
  2012. --                     TEXT_IO.NEW_LINE, TEXT_IO.PUT
  2013. -- Exceptions   :
  2014. --                                                                    -*
  2015. ------------------------------------------------------------------------
  2016. --
  2017. -- Mnemonic     :
  2018. -- Name         :
  2019. -- Release date :
  2020. ------------------ Revision history ------------------------------------
  2021. --
  2022. -- DATE         AUTHOR                  HISTORY
  2023. -- 1-31-84      R. Powers     Open routines moved to own package
  2024. --
  2025. --
  2026. --------------------END-PROLOGUE----------------------------------------
  2027.  
  2028. procedure PUSH_FILE is
  2029.   CH : CHARACTER;                            -- read a character at a time
  2030.   FILE_NAME : STRING(1..MAX_LINE_LENGTH);    -- name of new input file
  2031.   FILE_NAME_LENGTH : INTEGER range 0..MAX_LINE_LENGTH := 0;
  2032.                                              -- length of name
  2033.   OPENED : BOOLEAN;                          -- parameter to open_input_file
  2034. begin
  2035.   for I in 1..FILE_NAME'LAST loop
  2036.     FILE_NAME(I) := ' ';
  2037.   end loop;
  2038.   NEXT_CHARACTER(CH);
  2039.   WHILE CH = ' ' loop
  2040.     NEXT_CHARACTER(CH);
  2041.   end loop;
  2042.   if CH /= '(' then
  2043.     TEXT_IO.PUT("ERROR IN PARSING PRAGMA INCLUDE - MISSING '('");
  2044.     TEXT_IO.NEW_LINE;
  2045.   else
  2046.     NEXT_CHARACTER(CH);
  2047.     while CH = ' ' loop
  2048.       NEXT_CHARACTER(CH);
  2049.     end loop;
  2050.     if (CH /= '"') then
  2051.       TEXT_IO.PUT("ERROR IN PARSING PRAGMA INCLUDE - MISSING '""'");
  2052.       TEXT_IO.NEW_LINE;
  2053.     else
  2054.       NEXT_CHARACTER(CH);
  2055.       while (CH /= '"') and
  2056.         (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
  2057.          INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
  2058.         loop
  2059.         FILE_NAME_LENGTH := FILE_NAME_LENGTH + 1;
  2060.         FILE_NAME(FILE_NAME_LENGTH) := CH;
  2061.         NEXT_CHARACTER(CH);
  2062.       end loop;
  2063.       -- include pragma appends file type of TXT if a period is not at end
  2064.       -- of file name, but open fails if we put the period on there!
  2065.       if FILE_NAME(FILE_NAME_LENGTH) = '.' then
  2066.         FILE_NAME_LENGTH := FILE_NAME_LENGTH - 1;
  2067.       end if;
  2068.       FILE_IO.OPEN_INPUT_FILE(INPUT_FILES(FILE_LEVEL + 1).FILE,
  2069.                       OPENED, FILE_NAME, FILE_NAME_LENGTH);
  2070.       if not OPENED then
  2071.         TEXT_IO.PUT("ERROR IN OPENING INCLUDE FILE");
  2072.         TEXT_IO.NEW_LINE;
  2073.       else
  2074.         FILE_LEVEL := FILE_LEVEL + 1;
  2075.         INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH := 0;
  2076.         INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN := 0;
  2077.       end if;
  2078.     end if;
  2079.   end if;
  2080. end PUSH_FILE;
  2081. ::::::::::
  2082. test6.flw
  2083. ::::::::::
  2084.   WHILE CH = ' ' loop
  2085. Reserve word WHILE should be in lower case
  2086.  
  2087.       if not OPENED then
  2088. This structure should have preceeding blank lines to set it off.
  2089.  
  2090.       if not OPENED then
  2091. This structure should have following blank lines to set it off.
  2092.  
  2093.     if (CH /= '"') then
  2094. This structure should have preceeding blank lines to set it off.
  2095.  
  2096.     if (CH /= '"') then
  2097. This structure should have following blank lines to set it off.
  2098.  
  2099.   if CH /= '(' then
  2100. This structure should have preceeding blank lines to set it off.
  2101.  
  2102.   if CH /= '(' then
  2103. This structure should have following blank lines to set it off.
  2104.  
  2105. procedure PUSH_FILE is
  2106. This structure should have following blank lines to set it off.
  2107.  
  2108. -------------------------PROLOGUE--------------------------------------- 
  2109. Finish checking started in above statement.  Total statements: 43
  2110. ::::::::::
  2111. test6.sty
  2112. ::::::::::
  2113. STYLE Report
  2114. :USER1:POWERS:NOSC:TEST6.ADA
  2115.  
  2116.       Naming Conventions
  2117. --------------------------------------------------------------------------
  2118.       Invalid Case for an Object Identifier             0      Errors
  2119.   *   Invalid Case for a Keyword                        1      Error
  2120.       Name Segment Size (Separated         Desired     <5      Characters
  2121.                   by Underscores)          Actual       4.7    Characters
  2122.       Average Name Size                    Desired     >5      Characters
  2123.                                            Actual       8.1    Characters
  2124. --------------------------------------------------------------------------
  2125.  
  2126.       Physical Layout
  2127. --------------------------------------------------------------------------
  2128.       Occurrences of More Than One Statement/Line       0      Errors
  2129.       Inconsistant Indentation                          0      Errors
  2130.   *   Missing Blank Lines to Set Off a Block            4      Errors
  2131.       Loops Without Names                               0      
  2132. --------------------------------------------------------------------------
  2133.  
  2134.       Information Hiding, Abstraction, Data Use
  2135. --------------------------------------------------------------------------
  2136.       Percent of Literals In Body          Desired   < 30.0%
  2137.   *                                        Actual      85.7%
  2138.       Percent of Universal Types           Desired   < 40.0%
  2139.                                            Actual      25.0%
  2140.   !   Data Structuring Types NOT Used
  2141.                                            Array Types
  2142.                                            Enumeration Types
  2143.                                            Record Types
  2144.   !   Ada-Specific Features NOT used
  2145.                                            AND THEN
  2146.                                            OR ELSE
  2147.                                            EXITS
  2148.                                            XOR
  2149.                                            ELSIF
  2150.                                            EXCEPTION
  2151.                                            OUT parameters
  2152.                                            IN OUT parameters
  2153.                                            PRIVATEs
  2154. --------------------------------------------------------------------------
  2155.  
  2156.       Modularity
  2157. --------------------------------------------------------------------------
  2158.       Average Number of Parameters         Range     0..4      Parameters
  2159.         Instances of parameters below minimum           0      
  2160.         Instances of parameters above maximum           0      
  2161.       Average Subprogram Size              Range  10..200      Statements
  2162.         Instances of size below minimum                 0      
  2163.         Instances of size above maximum                 0      
  2164.       Loops with too many exit statements               0      Instances
  2165.       Control Structure Nesting            Maximum      8      
  2166.                                            Exceeded     0      Instances
  2167.       Package Nesting                      Maximum      2      
  2168.                                            Exceeded     0      Instances
  2169.       Subprogram Nesting                   Maximum      4      
  2170.                                            Exceeded     0      Instances
  2171. --------------------------------------------------------------------------
  2172.  
  2173.       Comment Usage
  2174. --------------------------------------------------------------------------
  2175.       Number of Comments                               38      Comments
  2176.       Average Comment Size                 Desired    >15      Characters
  2177.                                            Actual      44.9    Characters
  2178. --------------------------------------------------------------------------
  2179.  
  2180.       Transportability
  2181. --------------------------------------------------------------------------
  2182.       Number of Lines Exceeding Line Length             0      
  2183.       Address Clauses                                   0      
  2184.       Representation Specifications                     0      
  2185.       PRAGMA'S used:
  2186.       Non-Standard PRAGMA's Used
  2187.       Packages/Procedures WITHed
  2188. --------------------------------------------------------------------------
  2189.  
  2190.       * => Style Flaw        ! => Note: Potential for improvement
  2191.  
  2192. Keyword Usage
  2193.  Used Keyword    Allowed         Restriction     Occurrences     Percentage
  2194. --------------------------------------------------------------------------
  2195.       IF        yes             0.0%            8              18.6%
  2196.       IN        yes             0.0%            1               2.3%
  2197.       IS        yes             0.0%            1               2.3%
  2198.       AND       yes             0.0%            1               2.3%
  2199.       END       yes             0.0%            9              20.9%
  2200.       FOR       yes             0.0%            1               2.3%
  2201.       NOT       yes             0.0%            1               2.3%
  2202.       ELSE      yes             0.0%            3               7.0%
  2203.       LOOP      yes             0.0%            8              18.6%
  2204.       THEN      yes             0.0%            4               9.3%
  2205.       BEGIN     yes             0.0%            1               2.3%
  2206.       RANGE     yes             0.0%            1               2.3%
  2207.       WHILE     yes             0.0%            3               7.0%
  2208.       PROCEDURE yes             0.0%            1               2.3%
  2209. --------------------------------------------------------------------------
  2210. ::::::::::
  2211. test7.ada
  2212. ::::::::::
  2213. -- Ada Style Checker Test program
  2214. with TEXT_IO; use TEXT_IO;
  2215. with SYSTEM;
  2216. with UNCHECKED_DEALLOCATION;
  2217. PRAGMA OPTIMIZE;
  2218. pragma STUPID_PRAGMA;
  2219.  
  2220. PROcedure ADATEST is
  2221.  type X is record
  2222.    dum1 : integer;
  2223.    DUM2 : positive;
  2224.  end record;
  2225.                      ~ %
  2226. begIn
  2227.     PUT("Test Program");                      -- try some
  2228.     NEW_LINE;                                 -- trailing
  2229.     X := CALL;                          -- lkjkljlk
  2230.   x := "Line too little indented!";     -- kjljkl
  2231.      LONGVARIABLENAMEWITHOUTUNDERCORES := "Line too far indented.";
  2232. END ADATEST;
  2233. ::::::::::
  2234. test7.flw
  2235. ::::::::::
  2236. with TEXT_IO; use TEXT_IO;
  2237. There are more than one statements on this line!
  2238.  
  2239. with SYSTEM;
  2240. This package is on the list of packages to be warned against.
  2241.  
  2242. with UNCHECKED_DEALLOCATION;
  2243. This package is on the list of packages to be warned against.
  2244.  
  2245. PRAGMA OPTIMIZE;
  2246. Reserve word PRAGMA should be in lower case
  2247.  
  2248. PRAGMA OPTIMIZE;
  2249. Transportability Note:  Pragma.
  2250.  
  2251. pragma STUPID_PRAGMA;
  2252. Transportability Note:  Non-Standard Pragma!
  2253.  
  2254. PROcedure ADATEST is
  2255. Reserve word PROcedure should be in lower case
  2256.  
  2257. PROcedure ADATEST is
  2258. The number of parameters is BELOW the set limit!
  2259.  
  2260.    dum1 : integer;
  2261. Object name dum1 should be in upper case
  2262.  
  2263.    dum1 : integer;
  2264. Object name integer should be in upper case
  2265.  
  2266.    DUM2 : positive;
  2267. Object name positive should be in upper case
  2268.  
  2269.                      ~ %
  2270. Illegal character in this line
  2271.  
  2272.                      ~ %
  2273. Illegal character in this line
  2274.  
  2275. begIn
  2276. Reserve word begIn should be in lower case
  2277.  
  2278.   x := "Line too little indented!";     -- kjljkl 
  2279. This line is not indented enough!
  2280.  
  2281.   x := "Line too little indented!";     -- kjljkl 
  2282. Object name x should be in upper case
  2283.  
  2284.      LONGVARIABLENAMEWITHOUTUNDERCORES := "Line too far indented.";
  2285. This line should be indented to column:   5
  2286.  
  2287. END ADATEST;
  2288. Reserve word END should be in lower case
  2289.  
  2290. PROcedure ADATEST is
  2291. This loop should have preceeding blank lines to set it off.
  2292.  
  2293. PROcedure ADATEST is
  2294. This loop should have following blank lines to set it off.
  2295.  
  2296. -- Ada Style Checker Test program 
  2297. Finish checking started in above statement.  Total statements: 18
  2298. ::::::::::
  2299. test7.sty
  2300. ::::::::::
  2301. STYLE Report
  2302. NAME????????
  2303.  
  2304.       Naming Conventions
  2305. --------------------------------------------------------------------------
  2306.   *   Invalid Case for an Object Identifier             4      Errors
  2307.   *   Invalid Case for a Keyword                        4      Errors
  2308.       Name Segment Size (Separated         Desired     <5      Characters
  2309.                   by Underscores)          Actual       5.0    Characters
  2310.       Average Name Size                    Desired     >5      Characters
  2311.                                            Actual       9.0    Characters
  2312. --------------------------------------------------------------------------
  2313.  
  2314.       Physical Layout
  2315. --------------------------------------------------------------------------
  2316.   *   Occurrences of More Than One Statement/Line       1      Error
  2317.   *   Inconsistant Indentation                          2      Errors
  2318.   *   Missing Blank Lines to Set Off a Block            1      Error
  2319.       Loops Without Names                               0      
  2320. --------------------------------------------------------------------------
  2321.  
  2322.       Information Hiding, Abstraction, Data Use
  2323. --------------------------------------------------------------------------
  2324.       Percent of Literals In Body          Desired   < 10.0%
  2325.   *                                        Actual     100.0%
  2326.       Percent of Universal Types           Desired   < 40.0%
  2327.   *                                        Actual      66.7%
  2328.   !   Data Structuring Types NOT Used
  2329.                                            Array Types
  2330.                                            Enumeration Types
  2331.   !   No Attributes are Used
  2332. --------------------------------------------------------------------------
  2333.  
  2334.       Modularity
  2335. --------------------------------------------------------------------------
  2336.       Average Number of Parameters         Range     1..8      Parameters
  2337.   *     Instances of parameters below minimum           1      
  2338.         Instances of parameters above maximum           0      
  2339.       Average Subprogram Size              Range  10..200      Statements
  2340.         Instances of size below minimum                 0      
  2341.         Instances of size above maximum                 0      
  2342.       Loops with too many exit statements               0      Instances
  2343.       Control Structure Nesting            Maximum      8      
  2344.                                            Exceeded     0      Instances
  2345.       Package Nesting                      Maximum      2      
  2346.                                            Exceeded     0      Instances
  2347.       Subprogram Nesting                   Maximum      4      
  2348.                                            Exceeded     0      Instances
  2349. --------------------------------------------------------------------------
  2350.  
  2351.       Comment Usage
  2352. --------------------------------------------------------------------------
  2353.       Number of Comments                                5      Comments
  2354.       Average Comment Size                 Desired    >15      Characters
  2355.   *                                        Actual      14.0    Characters
  2356. --------------------------------------------------------------------------
  2357.  
  2358.       Transportability
  2359. --------------------------------------------------------------------------
  2360.       Number of Lines Exceeding Line Length             0      
  2361.       Address Clauses                                   0      
  2362.       Representation Specifications                     0      
  2363.       PRAGMA'S used:
  2364.                                            OPTIMIZE
  2365.       Non-Standard PRAGMA's Used
  2366.                                            STUPID_PRAGMA
  2367.       Packages/Procedures WITHed
  2368.                                            SYSTEM
  2369.                                            UNCHECKED_DEALLOCATION
  2370. --------------------------------------------------------------------------
  2371.  
  2372.       * => Style Flaw        ! => Note: Potential for improvement
  2373.  
  2374. Keyword Usage
  2375.  Used Keyword    Allowed         Restriction     Occurrences     Percentage
  2376. --------------------------------------------------------------------------
  2377.       AT        yes             0.0%            0               0.0%
  2378.       DO        yes             0.0%            0               0.0%
  2379.       IF        yes             0.0%            0               0.0%
  2380.       IN        yes             0.0%            0               0.0%
  2381.       IS        yes             0.0%            2              13.3%
  2382.       OF        yes             0.0%            0               0.0%
  2383.       OR        yes             0.0%            0               0.0%
  2384.       ABS       yes             0.0%            0               0.0%
  2385.       ALL       yes             0.0%            0               0.0%
  2386.       AND       yes             0.0%            0               0.0%
  2387.       END       yes             0.0%            2              13.3%
  2388.       FOR       yes             0.0%            0               0.0%
  2389.       MOD       yes             0.0%            0               0.0%
  2390.       NEW       yes             0.0%            0               0.0%
  2391.       NOT       yes             0.0%            0               0.0%
  2392.       OUT       yes             0.0%            0               0.0%
  2393.       REM       yes             0.0%            0               0.0%
  2394.       USE       yes            20.0%            1               6.7%
  2395.       XOR       yes             0.0%            0               0.0%
  2396.       BODY      yes             0.0%            0               0.0%
  2397.       CASE      yes             0.0%            0               0.0%
  2398.       ELSE      yes             0.0%            0               0.0%
  2399.       EXIT      yes             0.0%            0               0.0%
  2400.       GOTO      yes             5.0%            0               0.0%
  2401.       LOOP      yes             0.0%            0               0.0%
  2402.       NULL      yes             0.0%            0               0.0%
  2403.       TASK      yes             0.0%            0               0.0%
  2404.       THEN      yes             0.0%            0               0.0%
  2405.       TYPE      yes             0.0%            1               6.7%
  2406.       WHEN      yes             0.0%            0               0.0%
  2407.       WITH      yes             0.0%            3              20.0%
  2408.       ABORT     yes             0.0%            0               0.0%
  2409.       ARRAY     yes             0.0%            0               0.0%
  2410.       BEGIN     yes             0.0%            1               6.7%
  2411.       DELAY     yes             0.0%            0               0.0%
  2412.       DELTA     yes             0.0%            0               0.0%
  2413.       ELSIF     yes             0.0%            0               0.0%
  2414.       ENTRY     yes             0.0%            0               0.0%
  2415.       RAISE     yes             0.0%            0               0.0%
  2416.       RANGE     yes             0.0%            0               0.0%
  2417.       WHILE     yes             0.0%            0               0.0%
  2418.       ACCEPT    yes             0.0%            0               0.0%
  2419.       ACCESS    yes             0.0%            0               0.0%
  2420.       DIGITS    yes             0.0%            0               0.0%
  2421.       OTHERS    yes             0.0%            0               0.0%
  2422.       PRAGMA    yes             0.0%            2              13.3%
  2423.       RECORD    yes             0.0%            2              13.3%
  2424.       RETURN    yes             0.0%            0               0.0%
  2425.       SELECT    yes             0.0%            0               0.0%
  2426.       DECLARE   yes             0.0%            0               0.0%
  2427.       GENERIC   yes             0.0%            0               0.0%
  2428.       LIMITED   yes             0.0%            0               0.0%
  2429.       PACKAGE   yes             0.0%            0               0.0%
  2430.       PRIVATE   yes             0.0%            0               0.0%
  2431.       RENAMES   yes             0.0%            0               0.0%
  2432.       REVERSE   yes             0.0%            0               0.0%
  2433.       SUBTYPE   yes             0.0%            0               0.0%
  2434.       CONSTANT  yes             0.0%            0               0.0%
  2435.       FUNCTION  yes             0.0%            0               0.0%
  2436.       SEPARATE  yes             0.0%            0               0.0%
  2437.       EXCEPTION yes             0.0%            0               0.0%
  2438.       PROCEDURE yes             0.0%            1               6.7%
  2439.       TERMINATE yes             0.0%            0               0.0%
  2440. --------------------------------------------------------------------------
  2441. ::::::::::
  2442. testplan.doc
  2443. ::::::::::
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.                                CHAPTER 1
  2457.  
  2458.  
  2459.                               INTRODUCTION
  2460.  
  2461.  
  2462.  
  2463.  
  2464. 1.1  PURPOSE
  2465.  
  2466.  
  2467. This Computer Program Test Plan describes the test  activities  for  the
  2468.  
  2469. Coding  Style  Standards  Checker  computer  program.  This research and
  2470.  
  2471. development is being done for the  Naval  Ocean  Systems  Center  (NOSC)
  2472.  
  2473. under  contract   N66001-84-R-0030.   The  Coding Standards Checker is a
  2474.  
  2475. general-purpose Ada Coding Style Standards checker that operates  on  an
  2476.  
  2477. existing Ada source file to check software for conformance to the coding
  2478.  
  2479. standard.
  2480.  
  2481.  
  2482.      The Style Checker Computer Program  Test  Plan  (SCCPTP)  has  been
  2483.  
  2484. prepared in accordance with [NAV78A].
  2485.  
  2486.  
  2487. 1.2  SCOPE
  2488.  
  2489.  
  2490. SCCPTP describes the testing activities that will  be  conducted  during
  2491.  
  2492. the development phase of style checker.
  2493.  
  2494.  
  2495. 1.3  SUMMARY
  2496.  
  2497.  
  2498. The objective of the SCCPTP is to successfully define  all  the  testing
  2499.  
  2500. activities  that  are  necessary  to ensure that the developing standard
  2501.  
  2502. checker program meets the requirements of the  Proposal  to  Design  and
  2503.  
  2504. Implement a Standards Checker in Ada [TI84A].  Testing will be conducted
  2505.  
  2506. in two independent and sequential activities:
  2507.  
  2508.  
  2509.      1.  Unit Testing - Execution of a series  of  tests  on  individual
  2510.  
  2511.          modules or groups of modules.
  2512.  
  2513.  
  2514.      2.  Program Testing - Execution of a series of defined tests on the
  2515.  
  2516.          integrated  version  of  the  standards checker to validate its
  2517.  
  2518.          performance against the requirements defined  in  the  Proposal
  2519.  
  2520.          [TI84A].
  2521.  
  2522.  
  2523. When all unit testing is successfully completed, program testing will be
  2524.  
  2525. conducted to complete the testing activity.
  2526.  
  2527. INTRODUCTION                                                    Page 1-2
  2528.  
  2529.  
  2530.  
  2531. 1.4  SCHEDULE
  2532.  
  2533.  
  2534. Unit testing will be performed as an integral part of implementation and
  2535.  
  2536. is  therefore  dependent  upon  that  schedule.  Program testing will be
  2537.  
  2538. performed after implementation.
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.                                CHAPTER 2
  2553.  
  2554.  
  2555.                           APPLICABLE DOCUMENTS
  2556.  
  2557.  
  2558.  
  2559.  
  2560. 2.1  GOVERNMENT DOCUMENTS
  2561.  
  2562.  
  2563. The following documents of the exact issue shown form  a  part  of  this
  2564.  
  2565. specification  to the extent specified herein.  In the event of conflict
  2566.  
  2567. between the documents referenced and the contents of this specification,
  2568.  
  2569. the  contents  of  this  specification  will be considered a superceding
  2570.  
  2571. requirement.
  2572.  
  2573.  
  2574.  
  2575.    [NAV78A]  Navy,  "Data  Item Description,  Computer Program Test
  2576.  
  2577.              Plan", Navy DI-T-2142, 29 November 1978.
  2578.  
  2579.  
  2580.    [NAV78B]  Navy, "Data Item Description,  Computer  Program  Test
  2581.  
  2582.              Report", Navy DI-T-2156, 29 November 1978.
  2583.  
  2584.  
  2585.    [TI84A ]  Texas  Instruments, " Proposal to Design and Implement
  2586.  
  2587.              an Ada Style Standards Checking Tool", Prepared for
  2588.  
  2589.              Naval  Ocean  Systems  Center  (NOSC)  under  contract 
  2590.  
  2591.              #N66001-84-R-0030, 13 January 1984.
  2592.  
  2593.    
  2594.  
  2595.    [TI84B ]  Texas Instruments, " Software  Development Plan for an   
  2596.  
  2597.              Interactive  Spelling  Checker  in  Ada", Prepared for 
  2598.  
  2599.              Naval  Ocean  Systems  Center  (NOSC)  under  contract 
  2600.  
  2601.              #N66001-84-R-0030, 21 August 1984.
  2602.  
  2603.            
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.                                CHAPTER 3
  2618.  
  2619.  
  2620.                           TESTING REQUIREMENTS
  2621.  
  2622.  
  2623.  
  2624.  
  2625. 3.1  GENERAL
  2626.  
  2627.  
  2628. The style checker will be tested as an integral  part  of  the  software
  2629.  
  2630. development  process  by  first  testing  the  individual  parts in unit
  2631.  
  2632. testing and then testing the integrated whole in program  testing.   The
  2633.  
  2634. software  development  process  to follow in implementation is described
  2635.  
  2636. below :
  2637.  
  2638.  
  2639.      1.  Engineer fetches a local copy of the module that  they  are  to
  2640.  
  2641.          develop from the master TxtLib directory.
  2642.  
  2643.  
  2644.      2.  Engineer fetches a local copy of the modules needed to  develop
  2645.  
  2646.          a test harness for the module under development.
  2647.  
  2648.  
  2649.      3.  Engineer develops the module and test harnesses.
  2650.  
  2651.  
  2652.      4.  Code walk through and review.
  2653.  
  2654.  
  2655.      5.  The corrections and comments are incorporated from  review  and
  2656.  
  2657.          walk through.  Steps 4 and 5 are repeated as necessary.
  2658.  
  2659.  
  2660.      6.  Module source goes into master TxtLib directory.
  2661.  
  2662.  
  2663.      7.  Test harness modules are placed  in  the  test  harness  TxtLib
  2664.  
  2665.          directory with a new variant name.
  2666.  
  2667.  
  2668.      8.  Documentation changes are noted  in  detail  and  sent  to  the
  2669.  
  2670.          engineer responsible for logging.
  2671.  
  2672.  
  2673. Where a test harness is defined as a module (package,  task,  procedure,
  2674.  
  2675. etc)  used  to  test  another  package, task, procedure, etc.  Typically
  2676.  
  2677. these take the  form  of  stubbed  procedures,  functions,  tasks,  etc.
  2678.  
  2679. within existing packages.
  2680.  
  2681.  
  2682.      There are three types of TxtLib directories:
  2683.  
  2684.  
  2685.      1.  the engineer's local TxtLib directory,
  2686.  
  2687. TESTING REQUIREMENTS                                            Page 3-2
  2688.  
  2689.  
  2690.  
  2691.      2.  the master source TxtLib directory, and
  2692.  
  2693.  
  2694.      3.  the test harness TxtLib directory.
  2695.  
  2696.  
  2697. Each engineer has a local TxtLib directory  used  to  develop  packages,
  2698.  
  2699. procedures,  etc.   and  to keep notes in.  Eligible information for the
  2700.  
  2701. engineer's local TxtLib directory include:
  2702.  
  2703.  
  2704.      1.  modules under development (and completed)
  2705.  
  2706.  
  2707.      2.  test harnesses under development (and completed), and
  2708.  
  2709.  
  2710.      3.  notes including:
  2711.  
  2712.  
  2713.          1.  test harness procedures,
  2714.  
  2715.  
  2716.          2.  documentation changes, and
  2717.  
  2718.  
  2719.          3.  integration information.
  2720.  
  2721.  
  2722.  
  2723. The master source TxtLib directory contains the Style Checker source  in
  2724.  
  2725. its  debugged  form.   Each  debugged module is inserted into a revision
  2726.  
  2727. with a name according  to  the  naming  conventions  below.   This  name
  2728.  
  2729. matches  the revision name of the revision that the test harness modules
  2730.  
  2731. are placed into in the test harness TxtLib directory.
  2732.  
  2733.  
  2734.      The test harness TxtLib directory contains the test harnesses  used
  2735.  
  2736. to  test  the  modules  contained in the master source TxtLib directory.
  2737.  
  2738. The modules inserted  into  this  directory  should  be  placed  into  a
  2739.  
  2740. revision  whose  name matches the name of the revision that the debugged
  2741.  
  2742. module in the master source TxtLib directory has.
  2743.  
  2744.  
  2745.      When inserting modules into the master  TxtLib  directory  and  the
  2746.  
  2747. test  harness  TxtLib directory, the revision names will be formed using
  2748.  
  2749. the revision  name  format  "major.minor"  where  major  and  minor  are
  2750.  
  2751. integers  between  0  and  999.   "0.1"  is  the  initial revision name,
  2752.  
  2753. followed by "0.2", "0.3", etc.  until  the  time  of  release  when  the
  2754.  
  2755. revision name will be formed as "1.0".
  2756.  
  2757.  
  2758.      The test activities described below are  designed  to  ensure  that
  2759.  
  2760. Spell  satisfies  the  requirements identified in the Proposal [TI84A ].
  2761.  
  2762. Unit testing will be conducted by the software engineer responsible  for
  2763.  
  2764. each  unit's  implementation.   Upon completion of unit testing, program
  2765.  
  2766. testing will be conducted by the engineer.  During program testing, each
  2767.  
  2768. requirement of the Proposal [TI84A] will be demonstrated as being met.
  2769.  
  2770.  
  2771. 3.2  UNIT TESTING
  2772.  
  2773.  
  2774. Unit testing will be performed to ensure that the details of  the  Style
  2775.  
  2776. Checker  are  implemented according to the Style Checker design.  A unit
  2777.  
  2778. test is the demonstration of the performance of a segment of code.
  2779.  
  2780. TESTING REQUIREMENTS                                            Page 3-3
  2781.  
  2782.  
  2783.  
  2784. 3.3  PROGRAM TESTING
  2785.  
  2786.  
  2787. Program testing will be performed to validate  the  performance  of  the
  2788.  
  2789. Style Checker against the Proposal [TI84A ].  Program testing treats the
  2790.  
  2791. Style Checker as a black box and thereby complements unit testing  which
  2792.  
  2793. tests  the  detailed  internals  of the black box.  Unit testing will be
  2794.  
  2795. completed before program testing begins.
  2796.  
  2797.  
  2798.      Each requirement, as referenced in the  Software  Development  Plan
  2799.  
  2800. [TI84B ], will be tested by at least one program test procedure.  A test
  2801.  
  2802. matrix with one column for each requirement and one row for each program
  2803.  
  2804. test  procedure, will be maintained to show progress and completeness in
  2805.  
  2806. testing.
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.                                CHAPTER 4
  2821.  
  2822.  
  2823.                          PERSONNEL REQUIREMENTS
  2824.  
  2825.  
  2826.  
  2827.  
  2828. The testing of the Style Checker will be the responsibility of the Style
  2829.  
  2830. Checker  development  team.   The  team  is  composed  of  two  software
  2831.  
  2832. engineers  and   personnel   from   Quality   Assurance   and   Software
  2833.  
  2834. Configuration Management organizations.
  2835.  
  2836.  
  2837.      The responsibilities of the software engineers are to:
  2838.  
  2839.  
  2840.      1.  prepare and conduct the unit tests,
  2841.  
  2842.  
  2843.      2.  prepare and conduct the program tests,
  2844.  
  2845.  
  2846.      3.  maintain a program test matrix, and
  2847.  
  2848.  
  2849.      4.  write an internal test report.
  2850.  
  2851.  
  2852.  
  2853.      The responsibilities of the  Quality  Assurance  and  Configuration
  2854.  
  2855. Management personnel are to:
  2856.  
  2857.  
  2858.      1.  verify that the execution of each test is  in  accordance  with
  2859.  
  2860.          the  test procedures, that the test data satisfy the acceptance
  2861.  
  2862.          criteria, and that the documentation of each test is  complete,
  2863.  
  2864.          and
  2865.  
  2866.  
  2867.      2.  maintain configuration control of all software undergoing test.
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.                                CHAPTER 5
  2883.  
  2884.  
  2885.                               TEST REPORT
  2886.  
  2887.  
  2888.  
  2889.  
  2890. Internal documentation  of  the  results  of  test  activities  will  be
  2891.  
  2892. maintained  at  TI.   This  internal  Test Report will use [NAV78B] as a
  2893.  
  2894. guide.
  2895.  
  2896.