-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detecting duplicated components Add check to detect duplicated components of a record when parsing a TRLC file. Example: ``` Something duplicated { description = "This is fine!" description = "This is the duplicate." } ``` The behavior of the `Record_Object` class is changed such that the `assign` method only assigns components to the record if it has not been assigned already. This is implemented by checking if the field type is different from `Implicit_Null`. The `Parser` class asks the `Record_Object` if the component is `Implicit_Null`. If no, then an error is sent to the message handler.
- Loading branch information
Showing
15 changed files
with
272 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,11 @@ docs | |
*.pyc | ||
*.egg-info | ||
.venv/ | ||
venv/ | ||
build | ||
dist | ||
launch.json | ||
settings.json | ||
|
||
# EMACS ignores | ||
*~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package Example | ||
|
||
type Requirement { | ||
description String | ||
critical Boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package Example | ||
|
||
Requirement shape { | ||
description = "Our car shall have four wheels." | ||
critical = false | ||
} | ||
|
||
Requirement safety { | ||
critical = false | ||
description = "Our car shall not explode." | ||
critical = true | ||
} | ||
|
||
Requirement form { | ||
description = "Our car should look nice." | ||
critical = false | ||
} | ||
|
||
Requirement duplicated { | ||
description = "This is fine" | ||
critical = true | ||
description = "This is not fine anymore" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
critical = true | ||
^^^^^^^^ rbt-single-value-assignment/foo.trlc:11: error: component 'critical' already assigned at line 9 | ||
description = "This is not fine anymore" | ||
^^^^^^^^^^^ rbt-single-value-assignment/foo.trlc:22: error: component 'description' already assigned at line 20 | ||
Processed 1 model and 1 requirement file and found 2 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
rbt-single-value-assignment/foo.trlc:11:3: trlc error: component 'critical' already assigned at line 9 | ||
rbt-single-value-assignment/foo.trlc:22:3: trlc error: component 'description' already assigned at line 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
critical = true | ||
^^^^^^^^ rbt-single-value-assignment/foo.trlc:11: error: component 'critical' already assigned at line 9 | ||
description = "This is not fine anymore" | ||
^^^^^^^^^^^ rbt-single-value-assignment/foo.trlc:22: error: component 'description' already assigned at line 20 | ||
Processed 1 model and 1 requirement file and found 2 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
critical = true | ||
^^^^^^^^ rbt-single-value-assignment/foo.trlc:11: error: component 'critical' already assigned at line 9 | ||
description = "This is not fine anymore" | ||
^^^^^^^^^^^ rbt-single-value-assignment/foo.trlc:22: error: component 'description' already assigned at line 20 | ||
Processed 1 model and 1 requirement file and found 2 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
|
||
set -e # Exit immediately if any command exits with a non-zero status | ||
|
||
# Function: check if the environment is clean | ||
# checks for unstagged (diff --quiet) or stagged but uncommited changes (git diff --cached --quiet) | ||
check_clean_worktree() { | ||
if ! git diff --quiet || ! git diff --cached --quiet; then | ||
echo "Error: Uncommitted changes detected. Please commit or stash changes first." | ||
exit 1 | ||
fi | ||
} | ||
|
||
fetch_and_rebase() { | ||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
git fetch origin | ||
echo "Checking if the branch is up to date with 'origin/$CURRENT_BRANCH'..." | ||
if ! git diff --quiet "$CURRENT_BRANCH" "origin/$CURRENT_BRANCH"; then | ||
echo "Branch is out of date. Rebasing onto 'origin/$CURRENT_BRANCH'..." | ||
git rebase "origin/$CURRENT_BRANCH" || handle_rebase_conflicts | ||
fi | ||
} | ||
|
||
handle_rebase_conflicts() { | ||
while ! git rebase --continue 2>/dev/null; do | ||
echo "Resolve conflicts, stage the changes, and reattempting 'git rebase --continue'..." | ||
read -p "Press ENTER after resolving conflicts and staging changes." | ||
done | ||
} | ||
|
||
# Squash commits interactively | ||
interactive_squash() { | ||
echo "Starting interactive rebase to squash commits into one..." | ||
git rebase -i origin/main || handle_rebase_conflicts | ||
} | ||
|
||
# Function to force push changes after confirmation | ||
force_push_with_confirmation() { | ||
read -p "Do you want to force push the changes to the remote branch? (yes/no): " RESPONSE | ||
case "$RESPONSE" in | ||
[Yy][Ee][Ss]|[Yy]) | ||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
echo "Force pushing changes to 'origin/$CURRENT_BRANCH'..." | ||
git push --force-with-lease | ||
echo "Changes successfully pushed to remote." | ||
;; | ||
*) | ||
echo "Force push canceled. Your changes are local only." | ||
;; | ||
esac | ||
} | ||
|
||
# Main script execution | ||
main() { | ||
check_clean_worktree | ||
fetch_and_rebase | ||
interactive_squash | ||
echo "Rebase and squash completed successfully." | ||
force_push_with_confirmation | ||
} | ||
|
||
# Entry point | ||
main |