Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • M mapnik3
  • Project information
    • Project information
    • Activity
    • Members
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
Collapse sidebar
  • 周峰
  • mapnik3
  • Wiki
  • CodingStandards

CodingStandards · Changes

Page history
clone mapnik wiki from github. authored May 14, 2021 by 周峰's avatar 周峰
Hide whitespace changes
Inline Side-by-side
CodingStandards.md 0 → 100644
View page @ 8516de00
<!-- Name: CodingStandards -->
<!-- Version: 5 -->
<!-- Last-Modified: 2009/11/09 09:21:05 -->
<!-- Author: artem -->
# Coding Standards
There are no coding standards yet defined for this project. This is an initial attempt to create some.
This needs to be discussed, since the current document is just a single person's draft.
Also read 'Code commits best practices' and 'Coding Conventions' in [Contributing](https://github.com/mapnik/mapnik/blob/master/docs/contributing.markdown), in the Docs.
## C++
* Trailing whitespace is never allowed. This includes lines with nothing but spaces or tabs in them, as well as spaces or tabs being the last characters on a line with non-whitespace characters.
* Indentation is four spaces.
* Case statements?
* Public and private declarations?
* Line continuation?
* Should a maximum line limit be enforced?
* Single spaces should surround all binary operators (e.g. +, -. =, /, <<, >>).
* Parenthesis should not contain padding spaces:
* Acceptable: (a == b)
* Not Acceptable: ( a == b )
* Function definitions should not be separated from their arguments:
* Acceptable: void foo(int a) { ... }
* Not Acceptable: void foo (int a) { ... }
* Keywords should be separated from their arguments by a single space:
* Acceptable: if (a == b)
* Not Acceptable: if(a == b)
* Braces should always be on a separate line, and indented to the same level as the line that they're associated with.
* Functions should be separated from each other by a single blank line.
* Comma-separated lists should have spaces after each comma.
(Emacs C++ mode - copy & paste into .emacs file)
;; mapnik c++
(setq c-default-style "bsd")
;; no tabs please
(setq indent-tabs-mode nil)
;; ident by four spaces
(setq c-basic-offset 4)
;; don't ident inside namespace decl
(c-set-offset 'innamespace 0)
;;
(c-set-offset 'template-args-cont 'c-lineup-template-args)
## Python
It would probably be best to follow Guido van Rossum's preferred coding style, as documented in [PEP 8](http://www.python.org/dev/peps/pep-0008/).
* Trailing whitespace is never allowed. This includes lines with nothing but spaces or tabs in them, as well as spaces or tabs being the last characters on a line with non-whitespace characters.
* Indentation is four spaces.
## Tools
We will need some tools to automatically reformat the code before a commit is done. The initial run of these tools will likely result in a massive commit that only contains formatting changes.
Candidates:
* [astyle](http://astyle.sourceforge.net/)
* [GC GreatCode](http://sourceforge.net/projects/gcgreatcode/)
* [indent](http://www.gnu.org/software/indent/)
Clone repository
  • A perfect testcase
  • API changes between v2.0 and v2.1
  • API changes between v3.0 and v3.1
  • AWS Lambda
  • About Mapnik
  • AlsoFilter
  • Api changes between v2.1 and v2.2
  • Api changes between v2.2 and v2.3
  • Api changes between v2.3 and v3.0
  • ArchInstallation
  • Aspect Fix Mode
  • Benchmark Notes
  • BoundsClipping
  • BrokenExceptions
  • BuildingSymbolizer
View All Pages