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

Improving the dev workflow: Milestone 1.2.3 Enable checks for directive scope #4980

Merged
merged 84 commits into from
Jun 6, 2018
Merged

Improving the dev workflow: Milestone 1.2.3 Enable checks for directive scope #4980

merged 84 commits into from
Jun 6, 2018

Conversation

apb7
Copy link
Contributor

@apb7 apb7 commented May 25, 2018

Explanation

Fixes #4955

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes.
  • The PR explanation includes the words "Fixes #bugnum: ...".
  • The linter/Karma presubmit checks have passed.
    • These should run automatically, but if not, you can manually trigger them locally using python scripts/pre_commit_linter.py and bash scripts/run_frontend_tests.sh.
  • The PR is made from a branch that's not called "develop".
  • The PR follows the style guide.
  • The PR is assigned to an appropriate reviewer.
    • If you're a new contributor, please ask on Gitter for someone to assign a reviewer.
    • If you're not sure who the appropriate reviewer is, please assign to the issue's "owner" -- see the "talk-to" label on the issue.

@apb7 apb7 self-assigned this May 25, 2018
@codecov-io
Copy link

codecov-io commented May 25, 2018

Codecov Report

Merging #4980 into develop will increase coverage by 0.12%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4980      +/-   ##
===========================================
+ Coverage    45.04%   45.16%   +0.12%     
===========================================
  Files          392      397       +5     
  Lines        23705    23789      +84     
  Branches      3848     3849       +1     
===========================================
+ Hits         10678    10745      +67     
- Misses       13027    13044      +17
Impacted Files Coverage Δ
extensions/objects/templates/GraphEditor.js 11.11% <ø> (ø) ⬆️
extensions/objects/templates/HtmlEditor.js 11.11% <ø> (ø) ⬆️
core/templates/dev/head/directives.js 22.05% <ø> (ø) ⬆️
extensions/value_generators/templates/Copier.js 7.14% <0%> (+0.47%) ⬆️
...ns/PencilCodeEditor/directives/PencilCodeEditor.js 32.32% <0%> (ø) ⬆️
...ions/objects/templates/LogicErrorCategoryEditor.js 6.25% <0%> (ø) ⬆️
...ons/objects/templates/ListOfUnicodeStringEditor.js 9.09% <0%> (ø) ⬆️
...dev/head/components/forms/ObjectEditorDirective.js 7.14% <0%> (-5.36%) ⬇️
extensions/objects/templates/CodeStringEditor.js 5.55% <0%> (ø) ⬆️
...xploration_editor/ValueGeneratorEditorDirective.js 7.69% <0%> (-6.6%) ⬇️
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f27d9b...baf53e4. Read the comment docs.

@apb7
Copy link
Contributor Author

apb7 commented Jun 4, 2018

@seanlip and @kevinlee12: I have added a regex check for $scope.$parent. The only problem I am facing at the moment is the removal of $scope.$parent statements from RandomSelector and Copier. The pattern checks, therefore, will fail at the moment. I have tested the object templates locally.
Thanks!

@seanlip
Copy link
Member

seanlip commented Jun 4, 2018

Can you explain your debugging process for RandomSelector and Copier, similar to what I showed you for how to debug the issue with the object templates? It would help to understand how far you've gotten.

return scope.objType;
};
element.html('<' + directiveName +
' customization-args="customizationArgs"' +
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't forget the spacing :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant the indentation :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops! Fixed.

Copy link
Contributor Author

@apb7 apb7 left a comment

Choose a reason for hiding this comment

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

@kevinlee12 and @seanlip: I have fixed all directive scopes now. Just a single doubt. Thanks!

return scope.objType;
};
element.html('<' + directiveName +
' customization-args="customizationArgs"' +
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks!

}, true);

$scope.$watch('$parent.objType', function() {
$scope.objType = $scope.$parent.objType;
$scope.objType = $scope.getObjType();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had a doubt here. How do we modify lines 47 and 51 to remove $scope.$parent?

Copy link
Member

Choose a reason for hiding this comment

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

I don't know, but it looks like you might have addressed this :) (Though this needs careful and thorough manual testing of get/update/etc. operations.)

In general try to get rid of the $parent in the line above too, and have a lint check to forbid use of $parent anywhere (not just scope.$parent).

Thanks!

@kevinlee12
Copy link
Contributor

Functionality and code, it looks good up to this point, though please check if you can remove $parent from app.js.

Copy link
Contributor

@kevinlee12 kevinlee12 left a comment

Choose a reason for hiding this comment

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

lgtm, thanks for tackling this one!

@apb7
Copy link
Contributor Author

apb7 commented Jun 6, 2018

Discussed with @seanlip. I have filed Issue #5040 for this. Thanks!

@kevinlee12
Copy link
Contributor

@apb7, feel free to merge once tests pass.

@apb7
Copy link
Contributor Author

apb7 commented Jun 6, 2018

Merging, thanks @kevinlee12!

@apb7 apb7 merged commit a06a0bd into oppia:develop Jun 6, 2018
@apb7 apb7 deleted the enable-directive-scope-check branch June 6, 2018 15:43
hoangviet1993 pushed a commit to hoangviet1993/oppia that referenced this pull request Jun 20, 2018
…ve scope (oppia#4980)

* isolate RandomSelector scope

* change RandomSelector & Copier scope

* Fix directive scope

* modify scopes

* isolate scopes

* isolate scopes

* isolate scopes(3)

* Revert and fix

* Run all e2e

* isolate UnicodeStringEditor scope

* Run all tests

* isolate NormalizedStringEditor

* isolate SanitizedUrlEditor

* isolate BooleanEditor

* isolate CodeStringEditor

* isolate FractionEditor

* isolate GraphEditor and GraphPropertyEditor

* isolate HtmlEditor

* Modify previous scopes, isolate IntEditor, ListOfUnicodeStringEditor

* isolate LogicQuestionEditor

* isolate LogicErrorCategoryEditor

* isolate ImageWithRegionsEditor

* isolate MathLatexStringEditor

* isolate MusicPhraseEditor

* isolate NonnegativeIntEditor

* isolate ParameterNameEditor

* isolate RealEditor

* isolate SetOfHtmlStringEditor

* isolate SetOfUnicodeStringEditor

* isolate CoordTwoDimEditor

* isolate FilepathEditor

* Remove optional binding

* isolate mobileFriendlyTooltip

* isolate Copier

* Revert: isolate Copier

* isolate RandomSelector

* isolate Copier

* Fix SetOfHtmlStringEditor

* Alphabetize scopes

* Fix SetOfHtmlStringEditor

* Fix ImageWithRegionsEditor

* Fix GraphEditor

* Fix SetOfHtmlStringEditor

* Add regex check for .

* Passed values via ObjectEditorDirective and made corresponding fixes

* Remove parent from FractionEditor

* Add functions to pass other values

* Remove . from editor objects and fix scopes

* Fix hanging indentation

* Remove scope.parent statement from PencilCodeEditor

* Fix Copier and RandomSelector directives

* Remove scope.parent from RandomSelector

* Add spaces

* Remove watch blocks from Copier

* Modify NumberWithUnitsEditor

* Enable directive scope check

* Remove parent from Copier

* Add parent regexp in pre-commit script

* Remove parent from directives

* Fix indentation
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.

Enable _check_directive_scope function and fix corresponding problems
5 participants