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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add autofixer to attribute-indentation
rule
#2271
base: master
Are you sure you want to change the base?
Add autofixer to attribute-indentation
rule
#2271
Conversation
attribute-indentation
rule
3c96c11
to
9b89ccd
Compare
@bmish I think it's good 馃ぉ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Looks like linting needs to be fixed
- I see some commented-out code
- I think we still need some more comments throughout complex parts of the logic / flow to ensure readers understand what's happening
5a32516
to
7a14740
Compare
Back to you @bmish. Thanks for your review. FOr the test to pass I need the PR on ember-template-recast 馃檹 |
7a14740
to
30a8e48
Compare
8e5c06b
to
3cfa342
Compare
@bmish should be all god now 馃槈 |
Can you fix CI? |
Can you also make sure that all of the lines of code in this rule are covered by the tests? I just checked and see many lines missing coverage:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage looks better but I still see the following uncovered lines:
yarn test:jest test/unit/rules/attribute-indentation-test.js
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------------------------------------|---------|----------|---------|---------|------------------------------
attribute-indentation.js | 98.42 | 93.56 | 100 | 98.41 | 544-546,757,797
The code for this rule is quite long and complicated so it's even more important that we ensure all of its lines are covered by comprehensive tests.
Thanks for your work on this so far! Nearing the finish line.
|
@VincentMolinie thanks for the explanation. Those may be pre-existing issues then or even deadcode. So we can ignore that then. The next step is to run this autofixer on a real codebase. I tried running on a large codebase and I'm hitting various crashes. {{#sq-dropdown as |dropdown|}}
{{#dropdown.trigger class="button super-table__plus-button"}}
<i class="{{if isActive "icon-plus-small-hover" "icon-plus-small"}} super-table__plus-button__icon"></i>
{{/dropdown.trigger}}
{{/sq-dropdown}}
{{directory/onboard-tooltip buttonText=(t "button.ok")
content=(t "foo")
flag=onboardTooltipFlag
flagPrevious=onboardTooltipFlagPrevious
popoverClass="foo"}}
And there appear to be many other crashes. Can you give this a try? Excited for the autofixer but it would be a shame if everyone hits crashes when they try to use it. |
Thanks for fixing the previous issue. Here are the next crashes I found (I'll test your updated rule again after you fix these, there are probably more crashes still, you should also try to find a large codebase to test on): Crash 2{{#if showMerge}}
<button class="button button--primary customer-list-bulk-actions__action" {{action (action merge)}}>
Merge
</button>
{{/if}}
{{#if showDelete}}
<button class="button button--primary button--destructive customer-list-bulk-actions__action" {{action (action delete)}} disabled={{disableDelete}}>
Delete
</button>
{{/if}}
Crash 3{{#if isSuccessMessageVisible}}
{{#banner-static type="SUCCESS"
dismiss=(action "dismiss" "SUCCESS" false)
data-foo=true}}
{{/banner-static}}
{{/if}}
{{#if isWarningMessageVisible}}
{{#banner-static type="WARNING"
dismiss=(action "dismiss" "WARNING" false)
data-foo=true}}
{{/banner-static}}
{{/if}}
Crash 4The {{#if isErrorFlow}}
{{#content.section key=SELECTOR_STEP.DOWNLOAD_REPORT}}
<h2 data-test-directory-import-sheet-step-header>{{t "customers.list.sheet.import.downloadReport.header" count=importService.errorStatus.rowsNotImportedCount}}</h2>
<a href={{errorReportUrl}}
{{! template-lint-disable no-element-event-actions }}
data-test-directory-import-sheet-report-download-btn>
{{t "customers.list.sheet.import.btn.downloadReport"}}
</a>
{{/content.section}}
{{/if}}
Issue 5<h4 data-test-directory-import-guide-tile-title>{{title}}</h4>
<p data-test-directory-import-guide-tile-content>{{content}}</p>
{{sq-help-link articleId="6632"
articleSection="field-type-support"}} Incorrectly autofixes to (note <h4 data-test-directory-import-guide-tile-title=>{{title}}</h4>
<p data-test-directory-import-guide-tile-content=>{{content}}</p>
{{sq-help-link
articleId="6632"
articleSection="field-type-support"
}} |
Hey @bmish I don't have time lately to handle those crash sorry. I'll try asap |
The code is not clean at all but it's a beginning. Any help is welcome on the cleaning part 馃檹