Skip to content

Commit

Permalink
Merge pull request #15 from MichaelKim0407/develop
Browse files Browse the repository at this point in the history
release 1.2
  • Loading branch information
MichaelKim0407 authored Oct 19, 2021
2 parents 02d13ff + eb25851 commit 5bf7aca
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 30 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test

on:
- push
- pull_request

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools
pip install -e .[ci]
- name: Lint with flake8
run: |
flake8 ./
- name: Test with pytest
run: |
pytest --cov --cov-report term-missing:skip-covered
- name: Upload to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
run: |
coveralls --service=github
coveralls:
name: Indicate completion to coveralls.io
needs: test
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# flake8-use-fstring

[![Release Status](https://github.com/MichaelKim0407/flake8-use-fstring/actions/workflows/python-publish.yml/badge.svg)](https://github.com/MichaelKim0407/flake8-use-fstring/releases)
[![PyPI package](https://badge.fury.io/py/flake8-use-fstring.svg)](https://pypi.org/project/flake8-use-fstring)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/flake8-use-fstring)](https://pypi.org/project/flake8-use-fstring)

* `master` (release)
[![Build Status](https://travis-ci.com/MichaelKim0407/flake8-use-fstring.svg?branch=master)](https://travis-ci.com/MichaelKim0407/flake8-use-fstring)
[![Build Status](https://github.com/MichaelKim0407/flake8-use-fstring/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/MichaelKim0407/flake8-use-fstring/tree/master)
[![Coverage Status](https://coveralls.io/repos/github/MichaelKim0407/flake8-use-fstring/badge.svg?branch=master)](https://coveralls.io/github/MichaelKim0407/flake8-use-fstring?branch=master)
* `develop` (main)
[![Build Status](https://travis-ci.com/MichaelKim0407/flake8-use-fstring.svg?branch=develop)](https://travis-ci.com/MichaelKim0407/flake8-use-fstring)
[![Build Status](https://github.com/MichaelKim0407/flake8-use-fstring/actions/workflows/test.yml/badge.svg?branch=develop)](https://github.com/MichaelKim0407/flake8-use-fstring/)
[![Coverage Status](https://coveralls.io/repos/github/MichaelKim0407/flake8-use-fstring/badge.svg?branch=develop)](https://coveralls.io/github/MichaelKim0407/flake8-use-fstring?branch=develop)

Jump-start into modern Python by forcing yourself to use f-strings.

Works only with `python>=3.6`, apparently.
Works only with `python>=3.6` since it was when f-strings were introduced.

## Installation

Expand All @@ -27,7 +31,7 @@ pip install flake8-use-fstring

## Available Configurations

### `--percent-greedy`, `--format-greedy`, and `--fstring-ignore-format`
### `--percent-greedy` and `--format-greedy`

This plugin checks each python statement (logical line)
and see if `%` or `.format` is used.
Expand All @@ -54,15 +58,21 @@ To set greedy levels,
set `--percent-greedy=<level>` and `--format-greedy=<level>` in the command line,
or set `percent-greedy=<level>` and `format-greedy=<level>` in the `.flake8` config file.

Optionally, this plugin can also check for strings that appear to be intended to be f-strings
but are missing the `f` prefix.
This check is meant to assist when converting code to use f-strings.
### `--enable-extensions=FS003` and `--fstring-ignore-format`

This plugin can also check for strings that appear to be f-strings but don't have the `f` prefix.

Due to the potential for false positives, this check (`FS003`) is disabled by default.
To enable this check,
add the `--enable-extensions=FS003` command line option,
or set `enable-extensions=FS003` in the `.flake8` config file.

The missing prefix check normally ignores strings that are using `%` or `.format` formatting,
to check those strings as well,
**NOTE**:
If you use the `--ignore` option of `flake8`, the default ignore list will be overwritten.
See [`--ignore`](https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-ignore)
vs [`--extend-ignore`](https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-extend-ignore).

The missing prefix check normally ignores strings that are using `%` or `.format` formatting.
To check those strings as well,
add the `--fstring-ignore-format` command line option,
or set `fstring-ignore-format=True` in the `.flake8` config file.
or set `fstring-ignore-format=True` in the `.flake8` config file.
2 changes: 1 addition & 1 deletion flake8_use_fstring/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.1'
__version__ = '1.2'
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

extra_ci = [
*extra_test,
'python-coveralls',
'coveralls',
]

setup(
Expand All @@ -37,7 +37,7 @@
python_requires='>=3.6',

install_requires=[
'flake8==3.*',
'flake8>=3',
],

extras_require={
Expand Down Expand Up @@ -65,6 +65,10 @@
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',

'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Software Development :: Quality Assurance',
Expand Down

0 comments on commit 5bf7aca

Please sign in to comment.