Rework specifying and layering of configuration
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia tracciando il parsing della CLI di flake8, il caricamento dei file di configurazione e i percorsi di sovrapposizione della configurazione; l’issue non indica file o test specifici. Confronta il comportamento attuale con ciascun esempio di shell, quindi definisci l’ordine di parsing e le regole di precedenza necessarie per la ripetizione di --config, la rimozione di --append-config e la gestione di --isolated. Il lavoro è considerato completato quando i comportamenti elencati sono implementati e verificati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
In GitLab by @ericvw on Dec 29, 2019, 07:30
After having spent some time making changes in CLI parsing, the configuration
file loading, and the layering of the configuration options, I would like to
simplify how configuration gets specified and layered. I wanted to raise this
issue for awareness and discussion before proceeding with this larger goal.
The user-facing would be the following:
- Allow
--configto be used multiple times for specifying configuration
files. Options in subsequent--configfile take precedence. The command
line arguments in the configuration files will be used as if they were
provided first on the command line before other options that are specified on
the command line. - Remove
--append-configin favor of--confignow that--configcan be
specified multiple times. - Keep
--isolatedto ignore the automatic detection of configuration (i.e.,
user configuration and the searching-up-the-paths configuration). However,
--configmay be specified with--isolatedto provide files to be parsed.
Below are the behaviors expected if the above changes were implemented:
# Configuration options found in the user's config path followed by
# configuration options found locally taking precedence.
flake8 file1.py file2.py
# Same as above with options in 'config.ini' taking precedence.
flake8 --config config.ini file1.py file2.py
# The '--max-line-length 99' takes precedence over the option specified in
# any configuration file.
flake8 --max-line-length 99 --config config.ini file1.py file2.py
# Configuration options in 'config2.ini' takes precedence over those in 'config1.ini'.
flake8 --config config1.ini --config2.ini file1.py file2.py
# Configuration options in 'config1.ini' takes precedence over those in 'config2.ini'.
flake8 --config2.ini --config config1.ini file1.py file2.py
# Default configuration is used and not read from the user's config path nor
# detecting local configuration.
flake8 --isolated file1.py file2.py
# Same as above, however, configuration options in 'config.ini' are used as if they were
# specified on the command line.
flake8 --isolated --config 'config.ini' file1.py file2.py
With these changes, the benefits are the following:
- Configuration files from
--configare just appended to a single list to be
parsed. If--isolatedis not specified, elide the user and local files
included in the list of configuration files to parse. - Handling of single configuration and what is considered "appended"
configuration is exactly the same. - With
--isolatedpresent, there is still an elegant way to specify a set of
configuration options via file without having to put them all on the command
line.
The following trade-offs are the following:
- The changes are backward-incompatible.
- Removal of
--append-config. - Changing the behavior of
--isolatedto allow--configin addition to. - Change the behavior of
--configto be specified multiple times.
- Removal of
@asottile and @sigmavirus24, would greatly appreciate your input and feedback
before I proceed forward. Thanks!
- Lingua principale
- Python
- Stelle
- 3.8k
- Fork
- 356
- Merge medio
- 3h 25m
- PR unite (30g)
- 5
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PyCQA/flake8
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
Tutte le issue di PyCQA/flake8
Issue simili
-
bug server
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
sportsdataverse/sportsdataverse-py#641 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
googleapis/google-cloud-python#18532 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno