Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #158

Merged
merged 7 commits into from
Nov 10, 2023
Merged

Cleanup #158

merged 7 commits into from
Nov 10, 2023

Conversation

GodsBoss
Copy link
Contributor

Motivation/Abstract

There were some cosmetic issues and also some dead code. Imports weren't formatted with goimports, for example.

Description/Comments

Imports are now formatted with goimports, did a few other changes that keep the behaviour of the code. I did not create an issue because that seemed unnecessarely bureaucratic to me.

Checklist

Depending on your PR, please ensure the overall consistency/integrity of the project remains.
Please tick just one check item per section below

Tests

  • did you update or create tests for your code changes?
  • not relevant

Code examples

  • did you update or add example code snippets, which relate to your code changes
  • not relevant

Documentation

  • did you update or create documentation, which relates to your code changes
  • not relevant

@@ -124,10 +125,5 @@ func findExistingTimerNotYetTriggered(state *BpmnEngineState, id string, instanc
}

func findDurationValue(ice BPMN20.TIntermediateCatchEvent) (duration.Duration, error) {
durationStr := &ice.TimerEventDefinition.TimeDuration.XMLText
if durationStr == nil {
return duration.Duration{}, newEngineErrorf("Can't find 'timeDuration' value for INTERMEDIATE_CATCH_EVENT with id=%s", ice.Id)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error message is lost

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

durationStr could never be nil, so that error never actually occured.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GodsBoss good catch, if durationStr can't be nil - but then we need to rewrite the if clause, to capture the case when the text is empty. The goal here is to capture required and missing input as early as possible and provide good error message to the user.
If you agree, would you please bring the check back?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nitram509 I'd rather have this PR only change cosmetics, not behaviour. If you wish I can remove that particular change.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point was rather to rework this change towards a fail fast check and not removing "dead code".
Don't worry, I will merge it and then bring back the change on my own ... that round trip is shorter.

Copy link

@jinjaghost jinjaghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat in agreement with these changes, the loss of the error message is, however, a problem.

@jinjaghost
Copy link

As spotted by GodsBoss, there is no message error issue.

@codecov
Copy link

codecov bot commented Oct 1, 2023

Codecov Report

Merging #158 (7c3a348) into main (f816a48) will increase coverage by 0.38%.
Report is 1 commits behind head on main.
The diff coverage is 25.00%.

@@            Coverage Diff             @@
##             main     #158      +/-   ##
==========================================
+ Coverage   64.09%   64.48%   +0.38%     
==========================================
  Files          24       24              
  Lines        1557     1543      -14     
==========================================
- Hits          998      995       -3     
+ Misses        534      524      -10     
+ Partials       25       24       -1     
Files Coverage Δ
pkg/bpmn_engine/command.go 100.00% <ø> (ø)
pkg/bpmn_engine/conditions.go 100.00% <ø> (ø)
pkg/bpmn_engine/engine_properties.go 77.41% <ø> (ø)
pkg/bpmn_engine/events.go 84.95% <ø> (ø)
pkg/bpmn_engine/expressions.go 100.00% <ø> (ø)
pkg/bpmn_engine/jobs.go 100.00% <ø> (ø)
pkg/bpmn_engine/jobs_activated.go 91.66% <ø> (ø)
pkg/bpmn_engine/key_gen.go 87.50% <ø> (ø)
pkg/bpmn_engine/links.go 58.33% <100.00%> (-1.13%) ⬇️
pkg/bpmn_engine/process_instance.go 84.61% <ø> (ø)
... and 4 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -124,10 +125,5 @@ func findExistingTimerNotYetTriggered(state *BpmnEngineState, id string, instanc
}

func findDurationValue(ice BPMN20.TIntermediateCatchEvent) (duration.Duration, error) {
durationStr := &ice.TimerEventDefinition.TimeDuration.XMLText
if durationStr == nil {
return duration.Duration{}, newEngineErrorf("Can't find 'timeDuration' value for INTERMEDIATE_CATCH_EVENT with id=%s", ice.Id)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GodsBoss good catch, if durationStr can't be nil - but then we need to rewrite the if clause, to capture the case when the text is empty. The goal here is to capture required and missing input as early as possible and provide good error message to the user.
If you agree, would you please bring the check back?

@nitram509 nitram509 merged commit e840b0e into nitram509:main Nov 10, 2023
@nitram509
Copy link
Owner

@GodsBoss thank you for your contribution 🚀

@GodsBoss GodsBoss deleted the cleanup branch November 14, 2023 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants