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

Pylint pep8 fixes #185

Merged
merged 4 commits into from
Jan 3, 2018
Merged

Pylint pep8 fixes #185

merged 4 commits into from
Jan 3, 2018

Conversation

jbampton
Copy link
Contributor

@jbampton jbampton commented Jan 3, 2018

No description provided.

…ne - https://www.python.org/dev/peps/pep-0008/#blank-lines.  Remove unused imports dash, time, re, itertools and json. Remove unused State imported from dash.dependencies (unused-import). Remove unused Event imported from dash.dependencies (unused-import).
…river.common.keys, dash, dash_core_components, dash_html_components imported as html, importlib, os. Standard imports 'multiprocessing, sys, time, unittest' should be placed before 'from selenium import webdriver' (wrong-import-order) - https://www.python.org/dev/peps/pep-0008/#imports. Method definitions inside a class are surrounded by a single blank line - https://www.python.org/dev/peps/pep-0008/#blank-lines.
…before 'import dash_html_components as html' (wrong-import-order). Third party import 'import dash_html_components as html' should be placed before 'from dash import Dash' (wrong-import-order). Third party import 'import dash_core_components as dcc' should be placed before 'from dash import Dash' (wrong-import-order)

 https://www.python.org/dev/peps/pep-0008/#imports
@chriddyp
Copy link
Member

chriddyp commented Jan 3, 2018

Thanks @jbampton , you're quick! Do you have these checks automated? I really gotta get #181 merged.

@chriddyp chriddyp merged commit 56a7e8f into plotly:master Jan 3, 2018
@jbampton jbampton deleted the pylint-pep8-fixes branch January 4, 2018 02:15
@jbampton
Copy link
Contributor Author

jbampton commented Jan 4, 2018

Hey @chriddyp no I don't have them automated. I just ran Pylint against each file I wanted to check. Also I run Pycharm here and it picks up most of the problems just in the code editor. I mainly just looked at some of the recent commits and noticed some of the PEP8 problems.

@jbampton
Copy link
Contributor Author

jbampton commented Jan 11, 2018

Hey @chriddyp I see the pylint command works on a whole directory at once if you have an __init__.py inside that directory. It should recurse into sub directories that also have __init__.py files. For example on the dash-docs ->
Beast@Destiny~/GitHub/dash-docs $ pylint tutorial

I wanted to catch the Python files in directories that don't have __init__.py so I wrote a Ruby script to automate it as seen below:

#!/usr/bin/env ruby

# Ruby command line script that runs the Pylint python code linting tool.
# https://www.pylint.org/ against a whole directory recursively

def lint(src)
  Dir.glob("#{src}/**/*.py").map do |filename|
    puts `pylint "#{filename}"` unless filename.include? '/venv/'
  end
end

if ARGV[0].nil?
  STDOUT.puts 'Please provide the directory - /path/to/dir - to run pylint ' \
              'against or use . for the current directory.'
else
  lint(ARGV[0])
end

Runs like this:

Beast@Destiny~/GitHub/ruby-pylint $ ruby pylint.rb ../dash > dash.txt

I put it up in a repo here -> https://github.com/jbampton/ruby-pylint

AnnMarieW pushed a commit to AnnMarieW/dash that referenced this pull request Jan 6, 2022
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.

None yet

2 participants