Skip to content

Commit

Permalink
Adds OpenFastTrace for requirements tracking (#11710)
Browse files Browse the repository at this point in the history
* Initial requirement

* Initial requirement

* Add OpenFastTrace

* Fix linting

* Remove wrong disable rule
  • Loading branch information
koppor authored Sep 8, 2024
1 parent 7965eaa commit d8b935e
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,22 @@ jobs:
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

requirements_coverage:
name: "Validate requiremenet coverage"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21.0.2
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- run: ./gradlew traceRequirements

# This is https://github.com/marketplace/actions/gradle-wrapper-validation
# It ensures that the jar file is from gradle and not by a strange third party.
gradlevalidation:
Expand Down
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ plugins {
id 'idea'

id 'org.openrewrite.rewrite' version '6.20.0'

id "org.itsallcode.openfasttrace" version "3.0.0"
}

// Enable following for debugging
Expand Down Expand Up @@ -898,3 +900,7 @@ jmh {
iterations = 10
fork = 2
}

requirementTracing {
inputDirectories = files('docs', 'src/main/java', 'src/test/java')
}
2 changes: 2 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,5 @@ If you want to indicate that a pull request is not yet complete **before** creat

For improving developer's documentation, go on at the [docs/ subdirectory of JabRef's code](https://github.com/JabRef/jabref/tree/main/docs) and edit the file.
GitHub offers a good guide at [Editing files in another user's repository](https://help.github.com/en/github/managing-files-in-a-repository/editing-files-in-another-users-repository).

One can also add [callouts](https://just-the-docs.github.io/just-the-docs-tests/components/callouts/).
16 changes: 16 additions & 0 deletions docs/requirements/ai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
parent: Requirements
---
# AI

## User Interface

### Chatting with AI
`req~ai.chat.new-message-based-on-previous~1`

To enable simple editing and resending of previous messages, <kbd>Cursor Up</kbd> should show last message.
This should only happen if the current text field is empty.

Needs: impl

<!-- markdownlint-disable-file MD022 -->
49 changes: 49 additions & 0 deletions docs/requirements/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
nav_order: 7
has_children: true
---
# Requirements

This part of the documentation collects requirements using [OpenFastTrace](https://github.com/itsallcode/openfasttrace).

## Specifying requirements

One writes directly below a Markdown heading a requirement identifier.

Example:

```markdown
### Example
`req~ai.example~1`
```

It is important that there is no empty line directly after the heading.

{: note}
One needs to add `<!-- markdownlint-disable-file MD022 -->` to the end of the file, because the id of the requirement needs to follow the heading directly.

## Linking implementations

Then, one writes down at the requirement.
Directly at the end, one writes that it requires an implementation:

```markdown
Needs: impl
```

One can also state that there should be detailed design document (`dsn`).
However, typically in JabRef, we go from the requirement directly to the implementation.

Then, at the implementation, a comment is added this implementation is covered:

```java
// [impl->req~ai.example~1]
```

When executing the gradle task `traceRequirements`, `build/tracing.txt` is generated.
In case of a tracing error, one can inspect this file to see which requirements were not covered.

## More Information

- [User manual of OpenFastTrace](https://github.com/itsallcode/openfasttrace/blob/main/doc/user_guide.md)
- We cannot copy and paste real examples here, because of [openfasttrace#280](https://github.com/itsallcode/openfasttrace/issues/280).
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private void initialize() {
// will be true (this is important).
}
} else if (keyEvent.getCode() == KeyCode.UP) {
// [impl->req~ai.chat.new-message-based-on-previous~1]
if ((currentUserMessageScroll.get() < history.get().size() - 1) && (userPromptTextArea.getText().isEmpty() || showingHistoryMessage.get())) {
// 1. We should not go up the maximum number of user messages.
// 2. We can scroll history only on two conditions:
Expand Down

0 comments on commit d8b935e

Please sign in to comment.