-
Notifications
You must be signed in to change notification settings - Fork 1
Code Style
Sam Crow edited this page Feb 2, 2016
·
3 revisions
Code in the Cook-E project should follow the Android code style rules, with the following exceptions:
-
For positioning of braces, Stroustrup style is acceptable. This means that an
else
keyword may appear on the line after the closing curly brace that precedes it.// OK (Stroustrup style) if (...) { ... } else { ... } // OK (Java style) if (...) { ... } else { ... }
Each source file should start with a license header. Java files should use this header:
/*
* Copyright 2016 the Cook-E development team
*
* This file is part of Cook-E.
*
* Cook-E is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Cook-E is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY 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
* along with Cook-E. If not, see <http://www.gnu.org/licenses/>.
*/
The license header in Java files should be the first thing in the file, before the package declaration.
XML files should use the header below. Both headers have the same text.
<!--
Copyright 2016 the Cook-E development team
This file is part of Cook-E.
Cook-E is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Cook-E is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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
along with Cook-E. If not, see <http://www.gnu.org/licenses/>.
-->
The license header in XML files should immediately follow the <?xml version="1.0" encoding="utf-8"?>
tag.