Friday, September 14, 2012

code style warnings

3-09-12

(I)


a)
I think that autofix option is just available for gnat pro.
Do you have a "coding standard file" already generated?
Theoretically I can use it to "check coding standard" option

Anyway I already fixed my sources, 
also if when I added the "-gnatyg" flag on my test.gpr gps don't show any (style) messages


But now I have a copyright issue, it yields:

[panzon@baleada intro]$ git push
Counting objects: 17, done.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (13/13), 193.76 KiB, done.
Total 13 (delta 3), reused 0 (delta 0)
remote: main.adb:70:10: Copyright notice missing, must occur before line 24
remote: Style check failed for trunk/hi-lite/libs/containers/ada/intro/src/main.adb
remote: error: hook declined to update refs/heads/master
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'git+ssh://panzon@scm.forge.open-do.org//scmrepos/git/hi-lite/hi-lite.git'


I took a look and I saw that hi-lite have different copyright headers

b)
Do I should use this one?

------------------------------------------------------------------------------
--                                                                          --
--                            INTRO COMPONENTS                           --
--                                                                          --
--                     W H Y - G E N - N A M E _ G E N                      --
--                                                                          --
--                                 B o d y                                  --
--                                                                          --
--                       Copyright (C) 2010-2012, AdaCore                   --
--                                                                          --
-- intro is  free  software;  you can redistribute  it and/or  modify it --
-- under terms of the  GNU General Public License as published  by the Free --
-- Software  Foundation;  either version 3,  or (at your option)  any later --
-- version.  gnat2why is distributed  in the hope that  it will be  useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
-- License for  more details.  You should have  received  a copy of the GNU --
-- General  Public License  distributed with  gnat2why;  see file COPYING3. --
-- If not,  go to  http://www.gnu.org/licenses  for a complete  copy of the --
-- license.                                                                 --
--                                                                          --
-- intro is maintained by AdaCore (http://www.adacore.com)               --
--                                                                          --
------------------------------------------------------------------------------


I just substitute intro instead WHY
or maybe you already have some script that generate this header.

3-09-12
(them)

On 09/03/2012 04:28 PM, Ricardo Aguirre wrote:
a)
I think that autofix option is just available for gnat pro.
No, when you compile inside GPS with the option -gnatyg, and if you get style warnings like the ones you sent us, then you should have a small icon on the left side of the warning *and* the same icon on the left side of the line with a warning that allows you to autofix the problem by clicking on the icon.


Do you have a "coding standard file" already generated?
Didn't you see the attachment in my previous email? This is the coding standard we use at AdaCore.


Theoretically I can use it to "check coding standard" option
Do you mean an input file to gnatcheck?


Anyway I already fixed my sources,
ok, good.


also if when I added the "-gnatyg" flag on my test.gpr gps don't show
any (style) messages
good, keep it then in your project file.

But now I have a copyright issue, it yields:
    /[panzon@baleada intro]$ git push/
    /Counting objects: 17, done./
    /Compressing objects: 100% (12/12), done./
    /Writing objects: 100% (13/13), 193.76 KiB, done./
    /Total 13 (delta 3), reused 0 (delta 0)/
    /remote: main.adb:70:10: Copyright notice missing, must occur before
    line 24/
    /remote: Style check failed for
    trunk/hi-lite/libs/containers/ada/intro/src/main.adb/
    /remote: error: hook declined to update refs/heads/master/
    /To
    git+ssh://panzon@scm.forge.open-do.org//scmrepos/git/hi-lite/hi-lite.git
    <http://panzon@scm.forge.open-do.org//scmrepos/git/hi-lite/hi-lite.git>/
    / ! [remote rejected] master -> master (hook declined)/
    /error: failed to push some refs to
    'git+ssh://panzon@scm.forge.open-do.org//scmrepos/git/hi-lite/hi-lite.git
    <http://panzon@scm.forge.open-do.org//scmrepos/git/hi-lite/hi-lite.git>'/


I took a look and I saw that hi-lite have different copyright headers

Ah yes, you should not bother about copyright at this stage.
I have committed a change to .gitattributes so that you don't have this problem anymore (you can see my change after you update your repository). Retry committing now (after doing a "git pull --rebase" and checking you have no conflicts of course).

14-09-12
(them)

On Fri 14 Sep 2012 01:34:57 AM CEST, Ricardo Aguirre wrote:
>>Do you mean an input file to gnatcheck?

Maybe yes, I'm not pretty sure

When I click the right button on the editor
it appears "check coding standard" option
if I click it
then it appears this message (attached image).
I meant that file.
You are trying to use GNATcheck. This is not what I meant by using our coding style. Most rules in our coding style have to do with spacing/indentation/naming of entities and do not require GNATcheck. They are simple enough that you can follow them easily while developing, if you take the time to read the coding style pdf that I sent you.

BTW, I just tried to compile your code, and I get various warnings related to style problems, that should be corrected:

$ gnatmake -P test
unbounded_stacks.ads:40:36: (style) space required
main_stacks.adb:33:03: (style) incorrect layout
main_stacks.adb:41:03: (style) incorrect layout
stacks.ads:11:80: (style) this line is too long
stacks.ads:48:04: (style) horizontal tab not allowed
stacks.ads:54:80: (style) this line is too long

No comments:

Post a Comment