diff --git a/README.md b/README.md index a03808e94a..5d2ca55dce 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ Then we need to start knora-api after loading the data: $ make stack-up ``` -Then try opening [http://localhost:3333/v1/resources/http%3A%2F%2Frdfh.ch%2F0803%2Fc5058f3a](http://localhost:3333/v1/resources/http%3A%2F%2Frdfh.ch%2F0803%2Fc5058f3a) in a web browser. You should see a response in JSON describing a book. +Then try opening [http://localhost:3333/v2/resources/http%3A%2F%2Frdfh.ch%2F0803%2Fc5058f3a](http://localhost:3333/v2/resources/http%3A%2F%2Frdfh.ch%2F0803%2Fc5058f3a) in a web browser. You should see a response in JSON-LD describing a book. To shut down the Knora-Stack: @@ -150,7 +150,11 @@ implementing the desired functionality. Use `camelCase` for names of classes, variables, and functions. Make names descriptive, and don't worry if they're long. -Format your code consistently. We [IntelliJ IDEA](https://www.jetbrains.com/idea) to format code, with 4 spaces indentation. Use whitespace to make your code easier to read. Add lots of implementation comments describing what your code is doing, how it works, and why it works that way. +Use [Scalafmt](https://scalameta.org/scalafmt/) in [IntelliJ IDEA](https://www.jetbrains.com/idea) to format Scala code. + +Use whitespace to make your code easier to read. +Add lots of implementation comments describing what your code is doing, +how it works, and why it works that way. ### Tests diff --git a/docs/05-internals/development/figures/setting-tab-space.png b/docs/05-internals/development/figures/setting-tab-space.png deleted file mode 100644 index ca981751e4..0000000000 Binary files a/docs/05-internals/development/figures/setting-tab-space.png and /dev/null differ diff --git a/docs/05-internals/development/figures/setup_formatting.png b/docs/05-internals/development/figures/setup_formatting.png new file mode 100644 index 0000000000..fae914e165 Binary files /dev/null and b/docs/05-internals/development/figures/setup_formatting.png differ diff --git a/docs/05-internals/development/intellij-config.md b/docs/05-internals/development/intellij-config.md index 89f830ee11..13623ac71e 100644 --- a/docs/05-internals/development/intellij-config.md +++ b/docs/05-internals/development/intellij-config.md @@ -49,14 +49,16 @@ License along with Knora. If not, see . on Bazel logo `Sync Project with Build Files`. This needs to be repeated every time there is a change in a `BUILD.bazel` file. ![screenshot 'Bazel sync'](figures/bazel-sync.png) - - - Make sure that the tab size is set correctly to **4 spaces** (so you - can use automatic code reformatting): `Preferences -> Code Style -> - Scala`: - ![screenshot 'setting tab size'](figures/setting-tab-space.png) +## Setup IntelliJ Code Formatter + +Use [Scalafmt](https://scalameta.org/scalafmt/) in [IntelliJ IDEA](https://www.jetbrains.com/idea) to format Scala code. +In IntelliJ editor setting (`Preferences -> Editor -> Code Style -> Scala`), choose `Scalafmt` as formatter and check the box for +`Reformat on file save` as shown below: + ![screenshot 'setting tab size'](figures/setup_formatting.png) + ## Use IntelliJ IDEA's Run/Debugger Configuration with Knora First, you need to create an application configuration to run or debug a code. Here the configuration is explained using a test as an