Skip to content

[Lottie Exporter] Code cleanup for Lottie exporter plugin - #1226

Merged
ice0 merged 6 commits into
synfig:masterfrom
saurabh-ramola:code_cleanup_for_lottie_exporter
Mar 13, 2020
Merged

ice0 merged 6 commits into
synfig:masterfrom
saurabh-ramola:code_cleanup_for_lottie_exporter

Conversation

@saurabh-ramola

@saurabh-ramola saurabh-ramola commented Mar 11, 2020 •

Copy link
Copy Markdown
Member

Cleaned up the code for Lottie Exporter plugin and removed LGTM warning alerts. In #1199 I had focussed only on adding changes tagged as recommendations.
Link for the alerts : LGTM warning alerts for the Lottie Exporter plugin

@AnishGG , @ice0 Please have a look at this

@AnishGG
AnishGG self-requested a review March 12, 2020 01:19
cp3 = qp2
cp1 = qp0 + 2/3*(qp1 - qp0)
cp2 = qp2 + 2/3*(qp1 - qp2)
cp1 = qp0 + 2/float(3)*(qp1 - qp0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you can just use 3.0 here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Made the changes which you've suggested.

2/(float(3) converted to 2/3.0 since both will do the same job.
@AnishGG

AnishGG commented Mar 12, 2020

Copy link
Copy Markdown
Member

@saurabh-ramola kindly link the issue to which this P.R. is related.

@lgtm-com

lgtm-com Bot commented Mar 12, 2020

Copy link
Copy Markdown

This pull request fixes 8 alerts when merging 551054c into b380d8a - view on LGTM.com

fixed alerts:

  • 7 for Result of integer division may be truncated
  • 1 for Redundant comparison

@saurabh-ramola

Copy link
Copy Markdown
Member Author

NOTE: Related to #958

tangent = (p2 - p1) * (1.0 + bias) / 2.0 + (p3 - p2) * (1.0 - bias) / 2.0
elif p1 > p2:
if p2 >= p1 or p2 <= p3:
if p2 <= p3:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You pointed out a mistake here actually.
It should have been p1 > p3 instead of p1 > p2 in line number 65.(See here:

)

This might also solve some other issues raised in the milestone of Lottie exporter

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So I recommend to change this in another PR, pointing out the mistake.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Okay, I will do that.

@ice0 ice0 Mar 13, 2020 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I suggest returning this line of code back. Here is the reason:
LGTM.com says that p2> = p1 has no effect, because you already checked elif p1 > p2.
But since there is an error in the first condition, you do not need to delete this condition, since it will become correct when you fix first condition (elif p1 > p2 -> elif p1 > p3).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@ice0 Done. 😄
I have fixed that mistake in a different PR(#1233).

@lgtm-com

lgtm-com Bot commented Mar 12, 2020

Copy link
Copy Markdown

This pull request fixes 8 alerts when merging 3df36db into b380d8a - view on LGTM.com

fixed alerts:

  • 7 for Result of integer division may be truncated
  • 1 for Redundant comparison

@AnishGG

AnishGG commented Mar 12, 2020

Copy link
Copy Markdown
Member

@saurabh-ramola, I suggest to make this change in a new PR.
Otherwise this issue could be lost.
@ice0

@lgtm-com

lgtm-com Bot commented Mar 12, 2020

Copy link
Copy Markdown

This pull request fixes 8 alerts when merging ec5f7c8 into b380d8a - view on LGTM.com

fixed alerts:

  • 7 for Result of integer division may be truncated
  • 1 for Redundant comparison

@saurabh-ramola
saurabh-ramola force-pushed the code_cleanup_for_lottie_exporter branch from ec5f7c8 to 3df36db Compare March 12, 2020 19:40
@saurabh-ramola

Copy link
Copy Markdown
Member Author

I accidentally added the changes to the same PR. I have reverted that commit with the last known safe commit now. Will make a new PR for the issue.

@lgtm-com

lgtm-com Bot commented Mar 12, 2020

Copy link
Copy Markdown

This pull request introduces 6 alerts and fixes 14 when merging beb51a8 into b380d8a - view on LGTM.com

new alerts:

  • 6 for Unused import

fixed alerts:

  • 7 for Result of integer division may be truncated
  • 6 for Unused local variable
  • 1 for Redundant comparison

@lgtm-com

lgtm-com Bot commented Mar 12, 2020

Copy link
Copy Markdown

This pull request fixes 14 alerts when merging 0694af7 into b380d8a - view on LGTM.com

fixed alerts:

  • 7 for Result of integer division may be truncated
  • 6 for Unused local variable
  • 1 for Redundant comparison

@saurabh-ramola

Copy link
Copy Markdown
Member Author

@AnishGG , please have a look at the latest changes made.

@AnishGG

ghost commented Mar 13, 2020

Copy link
Copy Markdown
Member

Yup they look good.
I think this is ready to be merged @ice0

tangent = (p2 - p1) * (1.0 + bias) / 2.0 + (p3 - p2) * (1.0 - bias) / 2.0
elif p1 > p2:
if p2 >= p1 or p2 <= p3:
if p2 <= p3:

ghost Mar 13, 2020 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I suggest returning this line of code back. Here is the reason:
LGTM.com says that p2> = p1 has no effect, because you already checked elif p1 > p2.
But since there is an error in the first condition, you do not need to delete this condition, since it will become correct when you fix first condition (elif p1 > p2 -> elif p1 > p3).

@lgtm-com

ghost commented Mar 13, 2020

Copy link
Copy Markdown

This pull request fixes 13 alerts when merging 04285b8 into b380d8a - view on LGTM.com

fixed alerts:

  • 7 for Result of integer division may be truncated
  • 6 for Unused local variable

ghost left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome! I will merge it when all checks will be done.

@ice0
ice0 merged commit 5d8a08b into synfig:master Mar 13, 2020
@ice0

ghost commented Mar 13, 2020

Copy link
Copy Markdown
Collaborator

Merged. Thank you!

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