Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #17, correct --print-dlint-linters behavior in Windows and dev en…
…vironments
  • Loading branch information
mschwager committed Feb 13, 2020
1 parent 1433378 commit 9220365
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 25 deletions.
26 changes: 12 additions & 14 deletions .appveyor.yml
@@ -1,20 +1,18 @@
build: false
version: "0.10.1.{build}"
platform: "x64"

environment:
matrix:
- PYTHON: "C:\\Python27"
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python37"
- PYTHON: "C:\\Python38"

matrix:
- PYTHON: "C:\\Python27"
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python37"
- PYTHON: "C:\\Python38"
install:
- pip install --requirement requirements.txt
- pip install --requirement requirements-dev.txt
- pip install --editable .

- pip install --requirement requirements.txt
- pip install --requirement requirements-dev.txt
- pip install --editable .
test_script:
- flake8
- pytest --cov
- flake8
- flake8 --print-dlint-linters
- pytest --cov
7 changes: 4 additions & 3 deletions .travis.yml
Expand Up @@ -12,11 +12,12 @@ jobs:
allow_failures:
- python: nightly
install:
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- pip install -e .
- pip install --requirement requirements.txt
- pip install --requirement requirements-dev.txt
- pip install --editable .
script:
- flake8
- flake8 --print-dlint-linters
- pytest --cov
after_success:
- coveralls
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- The `--print-dlint-linters` flag on Windows ([#17](https://github.com/dlint-py/dlint/issues/17))

## [0.10.1] - 2020-01-21
### Fixed
Expand Down
24 changes: 16 additions & 8 deletions dlint/extension.py
Expand Up @@ -9,8 +9,8 @@

import importlib
import inspect
import os
import pkgutil
import optparse
import sys

import dlint
Expand All @@ -26,12 +26,19 @@ def __init__(self, tree, filename):

@classmethod
def add_options(cls, parser):
parser.add_option(
'--print-dlint-linters',
action='store_true',
help='Print Dlint linter information.',
parse_from_config=False
)
try:
parser.add_option(
'--print-dlint-linters',
action='store_true',
help='Print Dlint linter information.',
parse_from_config=False
)
except optparse.OptionConflictError:
# Occurs during development when flake8 detects the dlint package
# twice: once because it's been installed in editable mode, and
# once from the local filesystem directory. We can safely nop here
# since the option(s) have already been added.
pass

@classmethod
def parse_options(cls, options):
Expand All @@ -43,7 +50,8 @@ def parse_options(cls, options):
for l in sorted(linters, key=lambda li: li._code)
]
print("\n".join(output_lines))
sys.exit(os.EX_OK)
EX_OK = 0
sys.exit(EX_OK)

@staticmethod
def get_plugin_linter_classes():
Expand Down

0 comments on commit 9220365

Please sign in to comment.