Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • textplus/text-software-development-guidelines
  • fe/technical-reference
2 results
Show changes
Commits on Source (1)
......@@ -20,46 +20,22 @@ the new as well as the old developer can quickly comprehend the code base.
#### General
Style encompasses the style of your code in the narrow sense (your functions, classes, variables, etc.), as well as that
of your documentation. Many of the style guides we use give directions on how to write code and documentation. For
languages we don't provide a recommended style guide, you `SHOULD` name and link the style guide you used in your `README`.
#### For Specific Programming Languages
For the more prominent programming languages you `SHOULD` stick to:
- **Java**: The Java style guide can be found [here](./styles/rdd-eclipse-java-google-style.xml). It's based on the
[Google style guide for Java](https://github.com/google/styleguide) with some minor RDD specific settings. You can
configure Eclipse to use it automatically at *Eclipse > Preferences > Java > Code Style > Formatter*. Just
load the [RDD Eclipse Java Google
Style](https://gitlab.gwdg.de/fe/technical-reference/-/blob/main/styles/rdd-eclipse-java-google-style.xml)
in the formatter preferences and use it in your RDD projects.
- **JavaScript**: For JS we use the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript).
- **HTML/CSS**: For HTML/CSS we agreed upon the [Google HTML/CSS Style Guide](https://google.github.io/styleguide/htmlcssguide.html).
- **XQuery**: We use the [xqdoc style guide](http://xqdoc.org/xquery-style.pdf) with the following addenda:
- use double quotes for easy escaping
- prefer element constructors when creating dynamic output. Use direct notation for static content such as icons or a
maximum of one simple XQuery expression inside: `{ some very simple query }`.
- use minified variable names only at control variables - anything else must be *readable* and *understandable*.
- use four spaces for a TAB (because eXide switching the preferences in eXide's setting isn't permanent)
- for serialization to JSON prefer the `map` data type over the `json-node-output-method` ([specs](https://www.w3.org/XML/Group/qtspecs/specifications/xslt-xquery-serialization-31/html/#json-output))
- **XSLT**: Since there is no official style guide for XSLT, we decided to write
[our own](https://gitlab.gwdg.de/fe/technical-reference/tree/main/style-guides/rdd-xslt.md), resulting from
common best practices and own experiences within
the department.
- **Python**: For Python [PEP 8](https://www.python.org/dev/peps/pep-0008/) should be used, Django has a style guide
based on PEP-8 with some exceptions:
[Django-Styleguide](https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/). There are
linters and tools like [flake-8](https://pypi.org/project/flake8/) and [pep-8](https://pypi.org/project/pep8/)
available as support.
- **SPARQL**: For SPARQL there is not really any official style guide and there is no possibility to simply include any
code style automatically using a code style file. We just collect some advice how to format and use SPARQL code
of your documentation. Many of the style guides we use give directions on how to write code and documentation.
You `SHOULD` name and link the style guide you use in your `README`.
#### Recommendations
If your project already has a style guide, stick to it, until there are good reasons to change.
If you are looking for a style guide for a new language or project here are some recommendations:
- **Java**: [Google style guide for Java](https://github.com/google/styleguide)
- **JavaScript**: [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript).
- **HTML/CSS**: [Google HTML/CSS Style Guide](https://google.github.io/styleguide/htmlcssguide.html).
- **XQuery**: [xqdoc style guide](http://xqdoc.org/xquery-style.pdf)
- **XSLT**: There is no official style guide for XSLT, we wrote
[our own](https://gitlab.gwdg.de/fe/technical-reference/tree/main/style-guides/rdd-xslt.md)
- **Python**: [PEP 8](https://www.python.org/dev/peps/pep-0008/) or
[Django-Styleguide](https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/)
- **SPARQL**: There is no official style guide, so we have some advice how to format and use SPARQL code
[here](https://gitlab.gwdg.de/fe/technical-reference/tree/main/style-guides/rdd-sparql.md).
- **Golang**: The official style guide by google can be found [here](https://google.github.io/styleguide/go/guide)
- **Golang**: [Google Go style guide](https://google.github.io/styleguide/go/guide)