Skip to content
Permalink
Browse files

update lint setup

Summary:
* move config in to pylintrc so arc and CI stay aligned
* stop using pylint targets and just lint all python files

Test Plan: edit a snapshot file, run `arc lint --trace` verify it skips it.

Reviewers: max, natekupp

Reviewed By: max, natekupp

Differential Revision: https://dagster.phacility.com/D184
  • Loading branch information...
alangenfeld committed May 24, 2019
1 parent 8194c3b commit e79252248666743bec230a488cb9b3221e226df0
Showing with 34 additions and 77 deletions.
  1. +0 −32 .pylint_targets
  2. +9 −16 .pylintrc
  3. +5 −11 Makefile
  4. +20 −17 bin/publish.py
  5. +0 −1 js_modules/dagit/append_generated.py

This file was deleted.

@@ -9,24 +9,17 @@
# can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once).#
# C0102 blacklisted variable name (foo)
# C0103 invalid variable name (e.g. two chars)
# R0100 duplicate code (false positive in test cases)
# R0201 method could be a function
# R0903 too few public methods
# R0913 too many arguments
#
# R - refactoring related checks
# C - convention related checks
# W0511 disable TODO warning
# W1201, W1202 disable log format warning. False positives (I think)
# R1705 Unnecessary else after return
# R0902 Too many instance attributes. Sometimes big config objects are what you want
# R1710 All returns should return an expression
# C0302 too many lines in single module
# R0911 Too many returns
# R0901 Too many ancestors
# R0205 py3-only inherit from object warning
# C0330 bad-continuation (we let black take care of this)
disable=C0111,C0330,C0103,duplicate-code,R0201,R0903,R0913,W0511,W1201,W1202,R1705,R0902,R1710,C0102,C0302,R0911,R0901,R0205

disable=C,R,duplicate-code,W0511,W1201,W1202

# See: https://github.com/getsentry/responses/issues/74
[TYPECHECK]
ignored-classes= responses
ignored-classes= responses

[MASTER]
ignore=snapshots
@@ -1,15 +1,5 @@
# This is a hack because we are getting timeouts on CircleCI running pylint on all the targets
# at once
pylint-iterative:
set -e;
for target in `cat .pylint_targets` ; do \
echo $$target; \
pylint -j 0 $$target --rcfile=.pylintrc --disable=R,C || exit 1;\
done;
set +e;

pylint:
pylint -j 0 `cat .pylint_targets` --rcfile=.pylintrc --disable=R,C
pylint -j 0 `find . -name '*.py'` --rcfile=.pylintrc

update_doc_snapshot:
pytest docs --snapshot-update
@@ -40,8 +30,12 @@ install_dev_python_modules:
pip install -e python_modules/libraries/dagster-snowflake
pip install -e python_modules/libraries/dagster-spark
pip install -e python_modules/libraries/dagster-pyspark
pip install -e python_modules/libraries/dagster-pagerduty
pip install -e python_modules/libraries/dagster-slack
pip install -e python_modules/libraries/dagster-datadog
pip install -e python_modules/automation
pip install -e examples[full]
pip install -r bin/requirements.txt

graphql:
cd js_modules/dagit/; make generate-types
@@ -14,15 +14,12 @@
import os
import re

# import shlex
import subprocess
import sys
import tempfile

# https://github.com/PyCQA/pylint/issues/73
from distutils import spawn # pylint: disable=no-name-in-module
from itertools import groupby
from threading import Thread

import click
import packaging.version
@@ -76,7 +73,7 @@ def construct_publish_comands(additional_steps=None, nightly=False):
return publish_commands


'''For dagit, we need to build the JS assets.'''
# For dagit, we need to build the JS assets.
DAGIT_ADDITIONAL_STEPS = [
'pushd ../../js_modules/dagit; yarn install && yarn build-for-python; popd'
]
@@ -199,7 +196,7 @@ def set_git_tag(tag, signed=False):
)

match = re.search(
'fatal: tag \'(?P<tag>[\.a-z0-9]+)\' already exists', str(exc_info.output)
r'fatal: tag \'(?P<tag>[\.a-z0-9]+)\' already exists', str(exc_info.output)
)
if match:
raise Exception(
@@ -212,7 +209,7 @@ def set_git_tag(tag, signed=False):
return tag


def format_module_versions(module_versions, nightly=False):
def format_module_versions(module_versions):
return '\n'.join(
[
' {module_name}: {version} {nightly}'.format(
@@ -371,7 +368,9 @@ def check_new_version(new_version):
parsed_version = packaging.version.parse(new_version)
module_versions = check_existing_version()
errors = {}
last_version = None
for module_name, module_version in module_versions.items():
last_version = module_version
if packaging.version.parse(module_version['__version__']) >= parsed_version:
errors[module_name] = module_version['__version__']
if errors:
@@ -387,13 +386,13 @@ def check_new_version(new_version):
or parsed_version.is_postrelease
or parsed_version.is_devrelease
):
parsed_previous_version = packaging.version.parse(module_version['__version__'])
parsed_previous_version = packaging.version.parse(last_version['__version__'])
if not (parsed_previous_version.release == parsed_version.release):
should_continue = input(
'You appear to be releasing a new version, {new_version}, without having '
'previously run a prerelease.\n(Last version found was {previous_version})\n'
'Are you sure you know what you\'re doing? (Y/n)'.format(
new_version=new_version, previous_version=module_version['__version__']
new_version=new_version, previous_version=last_version['__version__']
)
)
if not should_continue == 'Y':
@@ -687,20 +686,20 @@ def publish(nightly, autoclean):

@cli.command()
@click.argument('version')
def release(version):
def release(ver):
"""Tags all submodules for a new release.
Ensures that git tags, as well as the version.py files in each submodule, agree and that the
new version is strictly greater than the current version. Will fail if the new version
is not an increment (following PEP 440). Creates a new git tag and commit.
"""
check_new_version(version)
set_new_version(version)
commit_new_version(version)
set_git_tag(version)
check_new_version(ver)
set_new_version(ver)
commit_new_version(ver)
set_git_tag(ver)
print(
'Successfully set new version and created git tag {version}. You may continue with the '
'release checklist.'.format(version=version)
'release checklist.'.format(version=ver)
)


@@ -722,12 +721,16 @@ def version():
)
)
else:
print('All modules in lockstep with most recent tagged version: {git_tag}'.format(git_tag))
print(
'All modules in lockstep with most recent tagged version: {git_tag}'.format(
git_tag=git_tag
)
)


@cli.command()
@click.argument('version')
def audit(version):
def audit(ver):
"""Checks that the given version is installable from PyPI in a new virtualenv."""

bootstrap_text = '''
@@ -746,7 +749,7 @@ def after_install(options, home_dir):
for module_name in MODULE_NAMES + LIBRARY_MODULES
]
),
version=version,
version=ver,
)

bootstrap_script = virtualenv.create_bootstrap_script(bootstrap_text)
@@ -1,5 +1,4 @@
import glob
import json
import os

if __name__ == '__main__':

0 comments on commit e792522

Please sign in to comment.
You can’t perform that action at this time.