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

Fix CircleCI pylint, esline and flake8 failed checks #110

Merged
merged 33 commits into from
Jan 22, 2019

Conversation

Bachibouzouk
Copy link
Contributor

@Bachibouzouk Bachibouzouk commented Jan 18, 2019

Dash Bio pull request

Addressing the eslint errors for the .react.js files described in issue #109 and #114
Addressing the pylint and flake8 errors for the .py files described in issue #111

closes #109 , closes #111

Before asking for a review

PR merging checklist

Please make sure you have done these things before asking for approval to finally merge.

  • Address all comments in the code review.
  • Make sure you are up-to-date with the latest master: check out the master branch with git checkout master, pull the latest changes with git pull origin master, check out back to your branch with git checkout your-branch, merge (latest) master into your branch with git merge master. Resolve conflicts if there are any, and finally git push origin your-branch.
  • Update/regenerate package-lock.json (run npm install)
  • Ensure that your requirements.txt is complete
  • Rebuild (run npm run build:all or npm run build:js followed by npm run build:py
  • Regenerate tarball (run python setup.py sdist, then copy dist/dash_bio-X.Y.Z.tar.gz into the top-level directory)
  • Ensure that you installed the tarball you generated with the above commands (run pip install dash-bio-X.Y.Z.tar.gz)
  • Run your application successfully in a virtual environment and test that other apps still run
  • Commit and push the files that were generated in the dash_bio/ subfolder by the above command(s)
  • Ask for a final review and look for a 💃!
  • Have your dancer? Merge to master!

DDS Deployment

  • Get the developers user credentials from a dash-bio team member.
  • Checkout the master branch of the dash-bio repository, make sure you have the latest master (git pull).
  • Check remotes associated to your repository: git remote -v, make sure you have the dash-bio one: https://dash-gallery.plotly.host/GIT/dash-bio.
  • If you don't have the dash-bio remote add it with https, ssh will not work: git remote add dash-bio https://dash-gallery.plotly.host/GIT/dash-bio.
  • You will be asked to enter the developers user credentials, have them ready.
  • Push local master to the dds dash-bio master: git push dash-bio master.

DDS Deployment Debugging

  • If running git push dash-bio master you may encounter the following issue:
remote: User <username> does not have permissions to run git-hook on dash-bio, or dash-bio does not exist
remote: Access denied
To https://dash-gallery.plotly.host/GIT/dash-bio
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://dash-gallery.plotly.host/GIT/dash-bio'

This may be because the git credentials are saved on the client-side. In order to solve this, do the following:

Windows

Go to: Control Panel -> User Accounts -> Manage your credentials -> Windows Credentials -> Under Generic Credentials find: git:https://dash-gallery.plotly.host -> Remove credential OR edit username/password to provided account.

OS X

Go to: Keychain Access -> Search for dash-gallery.plotly.host -> Change "Account" to "developers" -> Click on "show password" -> Change the password to the one provided -> Click "Save Changes". 

@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 18, 2019 10:54 Inactive
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 18, 2019 11:04 Inactive
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 18, 2019 11:30 Inactive
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 18, 2019 11:40 Inactive
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 18, 2019 11:55 Inactive
Copy link
Contributor Author

@Bachibouzouk Bachibouzouk left a comment

Choose a reason for hiding this comment

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

@shammamah , @VeraZab I addressed almost all the eslint errors, I commented some of my fixes which should be double checked (I looked at the demo app locally and couldn't find differences before and after which should be a good sign)

@@ -26,7 +26,7 @@ export default class Circos extends Component {
* Used to set a click or hover event on tracks/layout that will show annotations for the circos grpah.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Address the improper undefined usage

var condColor = configApply.color.conditional
configApply.color = d => {
let returnedColor;
for (var i = 0; i < condColor.value.length; i++) {
if (d[condColor.end] - d[condColor.start] > condColor.value[i]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix Expected to return a value at the end of arrow function. (consistent-return)

@@ -192,13 +192,14 @@ export default class Ideogram extends Component {

if (this.props.setProps) {
this.tooltipData = document.getElementById('_ideogramTooltip').innerHTML;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix Expected an assignment or function call and instead saw an expression. (no-unused-expressions)

@@ -115,6 +114,7 @@ export default class Speck extends Component {
}

// finally apply the user-supplied view parameters
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shammamah : this one I am not sure how to address...

Copy link
Contributor

Choose a reason for hiding this comment

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

It's looking for a length prop in view, which doesn't make sense because it's a PropTypes.shape (i.e., object)... I have to find some way to check how many properties there are.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's looking for a length prop in view, which doesn't make sense because it's a PropTypes.shape (i.e., object)... I have to find some way to check how many properties there are.

Copy link
Contributor Author

@Bachibouzouk Bachibouzouk Jan 21, 2019

Choose a reason for hiding this comment

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

@shammamah : could you find out the way to check how many properties there are? I created the issue as you asked me on slack -> #114

// add event listeners
const interactionHandler = new speckInteractions(this, renderer, container);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shammamah : this one too I am not sure how to address

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I guess this is kind of a weird thing to do. If you look at the code here: https://github.com/shammamah/speck/blob/master/src/interactions.js you'll see that there is a function for the module.exports that doesn't really return anything; it just performs some actions like attaching event handlers to the mouse, scroll wheel, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shammamah : could you indicate to me which properties on the app this line has an effect on? This would help me check that I haven't break anything :)

src/lib/components/SequenceViewer.react.js Show resolved Hide resolved
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 18, 2019 12:08 Inactive
@Bachibouzouk Bachibouzouk changed the title Fix eslint errors in .react.js files Fix CircleCI failed checks Jan 18, 2019
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 18, 2019 13:55 Inactive
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 18, 2019 14:00 Inactive
@VeraZab
Copy link
Contributor

VeraZab commented Jan 18, 2019

Thanks for fixing a lot of these up Pierre.
However, I think that if you have a bit of time, what we should do is to set up automatic code formatting for this repository.

For js a popular way to do this is to set up prettier: https://github.com/prettier/prettier
Prettier can be configured so that each save, automatically formats the code for you in your editor. It can also be ran on the entirety of a codebase to output files formatted according to an agreed upon set of rules. Looks like dash-core-components uses it and the rules they're using are here: https://github.com/plotly/dash-core-components/blob/master/.prettierrc

For python, I'd have to double check if there is an agreed upon convention at Plotly. I've posted a question on that in #dash-private.

In another pr, would you like to give a shot at setting up prettier for this repository? You can take inspiration from the dash-core-components repo as it uses it, and go through the docs of prettier to set it up.

@VeraZab
Copy link
Contributor

VeraZab commented Jan 18, 2019

So for Python, looks like there is no consensus yet on the dash-team, so flake8 and manual fixing still seems to be the way unfortunately. We could still add prettier though, for js formatting.

@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 22, 2019 15:45 Inactive
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 22, 2019 16:17 Inactive
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 22, 2019 16:39 Inactive
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 22, 2019 17:01 Inactive
@mtwichan mtwichan temporarily deployed to dash-bio-test-pr-110 January 22, 2019 17:42 Inactive
@Bachibouzouk Bachibouzouk moved this from In progress to Pending review in Sprint 3 Jan 22, 2019
@Bachibouzouk
Copy link
Contributor Author

@VeraZab @shammamah @mkcor : should we merge this PR (once the last two errors from ESlint are solved, cf #114 ) and open a new one to tackle the next failing checks as now pylinter and flake8 are happy ?

@mkcor
Copy link
Contributor

mkcor commented Jan 22, 2019

Yes! Please rename the PR accordingly (something along the lines of "Fix flake8 and pylint errors") and then feel free to ask for review/approval. Thanks for all the clean-up work!

@Bachibouzouk Bachibouzouk changed the title Fix CircleCI failed checks Fix CircleCI pylint, esline and flake8 failed checks Jan 22, 2019
@Bachibouzouk
Copy link
Contributor Author

Bachibouzouk commented Jan 22, 2019

@shammamah @VeraZab @mkcor : the problem was the tests/requirements.txt file which was missing packages, now the tests pass on the python side :) \o/

Sprint 3 automation moved this from Pending review to Needs merge Jan 22, 2019
@mkcor
Copy link
Contributor

mkcor commented Jan 22, 2019

It's amazing to see the tests pass for Python 3.6!! We will probably want to include other versions of Python 3. Locally, I'm developing in Python 3.7...

@Bachibouzouk Bachibouzouk merged commit 7616aa3 into master Jan 22, 2019
Sprint 3 automation moved this from Needs merge to Done Jan 22, 2019
@Bachibouzouk
Copy link
Contributor Author

Bachibouzouk commented Jan 23, 2019

close #109 #111

@VeraZab VeraZab deleted the fix_eslint_errors branch January 23, 2019 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Sprint 3
  
Done
5 participants