[Freeciv-tickets] [freeciv] #45075: configure linter to enforce code style

アーカイブの一覧に戻る
OSDN Ticket System norep****@osdn*****
Sun May 28 02:44:12 JST 2023


#45075: configure linter to enforce code style

  Open Date: 2022-07-09 14:39
Last Update: 2023-05-27 20:44

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/45075
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=45075

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2023-05-27 20:44 Updated by: cazfi

Comment:

Once we've cleared most of the clang analyzer warnings, we may have time to start looking in to style issues. Not sure, though, as there are also other tools we could/should take to use.

---------------------------------------------------------------------
Ticket Status:

      Reporter: dark-ether
         Owner: (None)
          Type: Tasks
        Status: Open
      Priority: 5 - Medium
     MileStone: (None)
     Component: General
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

there are a lot of rules in the code style required and most of them can be enforced by a linter.
another open source project i contributed in the past has a linter configured so that after coding you only need to run a command to be in the correct style, this is a significantly better coding experience than submitting a patch and then someone saying you forgot a space after a comma, on the otherside if a linter was configured you wouldn't have to deal with non compliant code patches.
besides that if we configure a linter we could make old non compliant code follow the style, and it would lower the barrier for contributing.
i tried to create a configuration for clang-format, and it mostly works, however clang format doesn't have a option to automatically insert a space after a comma and it mistakes the looping macros as functions so it adds a line break, however the previously said part about making old code compliant is still true so if we wanted to change the code style rules we could just run the linter on the whole project to change, i do not know any other linters for c other than clang format/tidy but if there is a better one i would be willing to configure it, the two problems i mentioned don't seem fixable without upstream patches, although i may be wrong.
i am not saying we need to change the coding style to follow the linter configuration however something like this could be an option.
to use clang format just install clang and place the  .clang-format file in the freeciv directory or a parent directory. do note that it outputs to stdout normally and needs a option to edit in place.

-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/45075
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=45075



More information about the Freeciv-tickets mailing list
アーカイブの一覧に戻る