Enforce the same configuration across multiple projects

Overview

Nitpick

PyPI GitHub Actions Python Workflow Documentation Status Coveralls Maintainability Test Coverage Supported Python versions Project License Code style: black Dependabot Status semantic-release pre-commit.ci status

Flake8 plugin to enforce the same tool configuration (flake8, isort, mypy, Pylint...) across multiple Python projects.

Useful if you maintain multiple projects and want to use the same configs in all of them.

Style file

A "nitpick code style" is a TOML file with the settings that should be present in config files from other tools.

Example of a style:

["pyproject.toml".tool.black]
line-length = 120

["pyproject.toml".tool.poetry.dev-dependencies]
pylint = "*"

["setup.cfg".flake8]
ignore = "D107,D202,D203,D401"
max-line-length = 120
inline-quotes = "double"

["setup.cfg".isort]
line_length = 120
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
combine_as_imports = true

This style will assert that:

Quick setup

To try the package, simply install it (in a virtualenv or globally) and run flake8 on a project with at least one Python (.py) file:

# Install using pip:
$ pip install -U nitpick

# Or using Poetry:
$ poetry add --dev nitpick

$ flake8 .

Nitpick will download and use the opinionated default style file.

You can use it as a template to configure your own style.

Run as a pre-commit hook (recommended)

If you use pre-commit on your project (you should), add this to the .pre-commit-config.yaml in your repository:

repos:
  - repo: https://github.com/andreoliwa/nitpick
    rev: v0.23.1
    hooks:
      - id: nitpick

To install the pre-commit and commit-msg Git hooks:

pre-commit install --install-hooks
pre-commit install -t commit-msg

To start checking all your code against the default rules:

pre-commit run --all-files

For more details on styles and which configuration files are currently supported, see the full documentation.

Comments
  • feat: Resolve relative URIs in nitpick.styles.include

    feat: Resolve relative URIs in nitpick.styles.include

    Proposed changes

    • Refactored fetchers to operate on furl parsed objects
    • Relative URIs are resolved against the URI of the style file they are contained in.
    • During normalization, gh:// is mapped to github://, and pypackge:// is mapped to py:// to avoid loading styles more than once.

    Fix: #464

    Checklist

    • [x] Read the contribution guidelines
    • [x] Run make locally before pushing commits
    • [x] Add tests for the relevant parts:
      • [x] API
      • [ ] CLI
      • [ ] flake8 plugin (normal mode)
      • [ ] flake8 plugin (offline mode)
    • [x] Write documentation when there's a new API or functionality
    released 
    opened by mjpieters 12
  • Offline mode

    Offline mode

    [@sobolevn wrote this originally. I used hub pull-request --draft -i 129 -b andreoliwa:master -h andreoliwa:offline-mode, and then it replaced the description... 😐 ]

    Hi!

    I faced an issue with running nitpick while offline. That's what it shows:

    » flake8 .
    multiprocessing.pool.RemoteTraceback: 
    """
    Traceback (most recent call last):
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
        (self._dns_host, self.port), self.timeout, **extra_kw
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/urllib3/util/connection.py", line 61, in create_connection
        for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
      File "/Users/sobolev/.pyenv/versions/3.7.4/lib/python3.7/socket.py", line 748, in getaddrinfo
        for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
    socket.gaierror: [Errno 8] nodename nor servname provided, or not known
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
        chunked=chunked,
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 376, in _make_request
        self._validate_conn(conn)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
        conn.connect()
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 334, in connect
        conn = self._new_conn()
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
        self, "Failed to establish a new connection: %s" % e
    urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x10d03cc10>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
        timeout=timeout
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
        method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
        raise MaxRetryError(_pool, url, error or ResponseError(cause))
    urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /wemake-services/wemake-python-styleguide/master/styles/nitpick-style-wemake.toml (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x10d03cc10>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/sobolev/.pyenv/versions/3.7.4/lib/python3.7/multiprocessing/pool.py", line 121, in worker
        result = (True, func(*args, **kwds))
      File "/Users/sobolev/.pyenv/versions/3.7.4/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
        return list(map(*args))
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/checker.py", line 666, in _run_checks
        return checker.run_checks()
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/checker.py", line 598, in run_checks
        self.run_ast_checks()
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/checker.py", line 502, in run_ast_checks
        for (line_number, offset, text, check) in runner:
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/plugin.py", line 50, in run
        Nitpick.current_app().config.merge_styles(), self.check_files(True), self.check_files(False)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/config.py", line 65, in merge_styles
        style.find_initial_styles(configured_styles)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/style.py", line 61, in find_initial_styles
        self.include_multiple_styles(chosen_styles)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/style.py", line 76, in include_multiple_styles
        style_path = self.get_style_path(style_uri)  # type: Optional[Path]
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/style.py", line 105, in get_style_path
        style_path = self.fetch_style_from_url(clean_style_uri)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/style.py", line 134, in fetch_style_from_url
        response = requests.get(new_url)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/requests/api.py", line 75, in get
        return request('get', url, params=params, **kwargs)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/requests/api.py", line 60, in request
        return session.request(method=method, url=url, **kwargs)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
        resp = self.send(prep, **send_kwargs)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
        r = adapter.send(request, **kwargs)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
        raise ConnectionError(e, request=request)
    requests.exceptions.ConnectionError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /wemake-services/wemake-python-styleguide/master/styles/nitpick-style-wemake.toml (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x10d03cc10>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
    """
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/Users/sobolev/Documents/github/returns/.venv/bin/flake8", line 10, in <module>
        sys.exit(main())
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/main/cli.py", line 18, in main
        app.run(argv)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/main/application.py", line 393, in run
        self._run(argv)
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/main/application.py", line 381, in _run
        self.run_checks()
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/main/application.py", line 300, in run_checks
        self.file_checker_manager.run()
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/checker.py", line 329, in run
        self.run_parallel()
      File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/checker.py", line 293, in run_parallel
        for ret in pool_map:
      File "/Users/sobolev/.pyenv/versions/3.7.4/lib/python3.7/multiprocessing/pool.py", line 354, in <genexpr>
        return (item for chunk in result for item in chunk)
      File "/Users/sobolev/.pyenv/versions/3.7.4/lib/python3.7/multiprocessing/pool.py", line 748, in next
        raise value
    requests.exceptions.ConnectionError: None: Max retries exceeded with url: /wemake-services/wemake-python-styleguide/master/styles/nitpick-style-wemake.toml (Caused by None)
    
    

    I guess that there two things to be improved:

    1. --offline flag to skip nitpick check
    2. Better exception message that would say: "you probably should add --offline flag because it seems that your network is unreachable. Or fix your connection."

    What do you think?

    bug released 
    opened by sobolevn 11
  • Unable to get from private repo (within a GitHub team)

    Unable to get from private repo (within a GitHub team)

    Your bug may already be reported! Please search on the issue tracker before creating one. If you found an issue, write a comment or upvote it with a thumbs-up 👍🏻.

    Expected behavior

    I should be able to get the style from a private repo within a GitHub team.

    Current behavior

    Currently getting a 404 error with URL not found.

    Steps to reproduce

    1. Put a nitpick style in a private repo
    2. Create a PAT with the repos scope
    3. Add github://$GITHUB_PAT@team-name/repo-name/nitpick-style.toml to a pyproject.toml in another project ($GITHUB_PAT is the GitHub Personal Access Token, which can either be copy-pasted or as a env variable, as described in the documentation).
    4. Run nitpick check
    5. Get 404.

    Possible Solution

    I looked at the fetcher for GitHub URLs and I noticed that there isn't an aspect which also specifies the username. I tried to use curl as shown by the GitHub API docs and was able to get to the correct repo and file because I provided both my username and the PAT in -u.

    Context

    We have a common template repository with rules and such for GitHub Actions and a common style guide, but any changes to it need to be manually updated to all derived repositories. Nitpick reminds me of ESLint configs (like AirBnB's) where there can be a single source that projects can pull from, and any changes can be reflected throughout.

    Your environment

    • nitpick version used: 0.31.0

    • Python version: 3.9.9

    • Operating System and version: Mac OS 12.0.1

    • Link to your project:

    • Run the following commands and paste the output:

      which python3
      python3 -V
      pip freeze
      cat $(which flake8)
      

    For more information, see the CONTRIBUTING guide.

    bug question style 
    opened by amitkparekh 10
  • Unexpected behavior (or misunderstanding) of nitpick quickstart steps

    Unexpected behavior (or misunderstanding) of nitpick quickstart steps

    Not sure i misunderstood the out-of-the-box behavior of nitpick or there is a bug. I except that nitpick should report missing files when ran inside an empty project folder, and the default style file should be downloaded

    Expected Behavior

    In a folder, with poetry, pyproject.toml, and venv setup, install nitpick and run flake8:

    • Default style file is downloaded into folder (nitpick-style.toml)
    • "Missing" files are reported by flake8 command (e.g missing toml files, setup.cfg)

    Current Behavior

    In an empty folder, while running in a venv, install nitpick and run flake8:

    • nothing happens. You get another command prompt

    Possible Solution

    Not sure if this is the correct behavior or my misinterpretation of nitpick's functionality/docs

    Steps to Reproduce

    • mkdir test && cd test
    • poetry init
    • poetry add nitpick
    • poetry shell
    • flake8

    Your Environment

    • nitpick version used:0.21.3

    • Python version: 3.7

    • Operating System and version: macos

    • Run the following commands and paste the output: Python 3.7.3 attrs==19.3.0 certifi==2019.11.28 chardet==3.0.4 Click==7.0 dictdiffer==0.8.1 entrypoints==0.3 flake8==3.7.9 idna==2.8 jmespath==0.9.4 marshmallow==3.4.0 marshmallow-polyfield==5.8 mccabe==0.6.1 nitpick==0.21.3 pycodestyle==2.5.0 pyflakes==2.1.1 python-slugify==4.0.0 requests==2.22.0 ruamel.yaml==0.16.10 ruamel.yaml.clib==0.2.0 sortedcontainers==2.1.0 text-unidecode==1.3 toml==0.10.0 urllib3==1.25.8 #~/.asdf/installs/python/3.7.3/bin/python3.7

    -- coding: utf-8 --

    import re import sys

    from flake8.main.cli import main

    if name == 'main': sys.argv[0] = re.sub(r'(-script.pyw?|.exe)?$', '', sys.argv[0]) sys.exit(main())

    bug released 
    opened by tolusonaike 10
  • Error related to multiprocessing  / ForkingPickler

    Error related to multiprocessing / ForkingPickler

    After installing Nitpick 0.16.1 via pip install nitpick and then invoking flake8, the following error is returned:

    > flake8
    Exception in thread Thread-3:
    Traceback (most recent call last):
      File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
        self.run()
      File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
        self._target(*self._args, **self._kwargs)
      File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 470, in _handle_results
        task = get()
      File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py", line 251, in recv
        return _ForkingPickler.loads(buf.getbuffer())
    TypeError: __init__() missing 2 required positional arguments: 'doc' and 'pos'
    

    Uninstalling Nitpick resolves the problem and restores flake8 to its normal behavior.

    Configuration in pyproject.toml

    [tool.nitpick]
    style = [
        "~/Projects/dotfiles/python/styles.toml",
    ]
    

    Contents of ~/Projects/dotfiles/python/styles.toml

    ["pyproject.toml".tool.black]
    line-length = 85
    
    ["setup.cfg".flake8]
    max-line-length = 85
    max-complexity = 12
    ignore = D100,D101,D102,D103,D104,D105,D106,D107,D202,E203,W503
    select = E241,C,E,F,W,B,B9
    
    ["setup.cfg"]
    comma_separated_values = ["flake8.ignore", "flake8.exclude"]
    

    Your Environment

    • nitpick version used: 0.16.1
    • Python version: 3.7.3 (via Homebrew)
    • Operating System and version: macOS 10.13.6
    bug 
    opened by justinmayer 10
  • nitpick@0.24 fails with ParsingError

    [email protected] fails with ParsingError

    Run poetry run flake8 .
    multiprocessing.pool.RemoteTraceback: 
    """
    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/multiprocessing/pool.py", line 121, in worker
        result = (True, func(*args, **kwds))
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/flake8/checker.py", line 676, in _run_checks
        return checker.run_checks()
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/flake8/checker.py", line 589, in run_checks
        self.run_ast_checks()
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/flake8/checker.py", line 494, in run_ast_checks
        for (line_number, offset, text, _) in runner:
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/nitpick/flake8.py", line 35, in run
        for collected_fuss in self.collect_errors():
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/nitpick/flake8.py", line 59, in collect_errors
        yield from nit.run()
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/nitpick/core.py", line 67, in run
        self.enforce_style(*partial_names, apply=apply),
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/nitpick/core.py", line 124, in enforce_style
        yield from plugin_class(info, config_dict, apply).entry_point()
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/nitpick/plugins/base.py", line 85, in entry_point
        yield from self.enforce_rules()
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/nitpick/plugins/setup_cfg.py", line 94, in enforce_rules
        self.updater.read(str(self.file_path))
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/configupdater/configupdater.py", line 618, in read
        self._read(fp, filename)
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/configupdater/configupdater.py", line 826, in _read
        raise e
    configparser.ParsingError: Source contains parsing errors: '/home/runner/work/mimesis-factory/mimesis-factory/setup.cfg'
    	[line 29]: '  .git\n'
    	[line 30]: '  __pycache__\n'
    	[line 31]: '  .venv\n'
    	[line 32]: '  .eggs\n'
    	[line 33]: '  *.egg\n'
    """
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/bin/flake8", line 8, in <module>
        sys.exit(main())
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/flake8/main/cli.py", line 22, in main
        app.run(argv)
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/flake8/main/application.py", line 363, in run
        self._run(argv)
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/flake8/main/application.py", line 351, in _run
        self.run_checks()
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/flake8/main/application.py", line 264, in run_checks
        self.file_checker_manager.run()
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/flake8/checker.py", line 321, in run
        self.run_parallel()
      File "/home/runner/work/mimesis-factory/mimesis-factory/.venv/lib/python3.7/site-packages/flake8/checker.py", line 287, in run_parallel
        for ret in pool_map:
      File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/multiprocessing/pool.py", line 748, in next
        raise value
    configparser.ParsingError: Source contains parsing errors: '/home/runner/work/mimesis-factory/mimesis-factory/setup.cfg'
    	[line 29]: '  .git\n'
    	[line 30]: '  __pycache__\n'
    	[line 31]: '  .venv\n'
    	[line 32]: '  .eggs\n'
    	[line 33]: '  *.egg\n'
    Error: Process completed with exit code 1.
    

    Link: https://github.com/mimesis-lab/mimesis-factory/pull/218/checks?check_run_id=1965298372 Related PR: https://github.com/mimesis-lab/mimesis-factory/pull/218 Source: https://github.com/mimesis-lab/mimesis-factory

    bug released 
    opened by sobolevn 9
  • Infinite loop in generic.climb_directory_tree

    Infinite loop in generic.climb_directory_tree

    Expected Behavior

    I expect 'nitpick' to complete in few minutes

    Current Behavior

    I get endless completion time. I think it's happens because of behaviour of Path().root and Path().parent on windows

    >>> Path('c:/')
    WindowsPath('c:/')
    >>> Path('c:/').root
    '\\'
    >>> Path('c:/').parent
    WindowsPath('c:/')
    

    Steps to Reproduce

    1. Run flake8
    2. Get endless execution

    Your Environment

    • nitpick version used: 0.21.1

    • Python version: Python 3.7.4

    • Operating System and version: Windows 10

    • Run the following commands and paste the output:

      (venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>where python
      C:\Users\Sleip\Desktop\Git\poe_gems_requirements\venv\Scripts\python.exe
      C:\Users\Sleip\AppData\Local\Programs\Python\Python37-32\python.exe
      
      (venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>python -V
      Python 3.7.4
      
      (venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>pip freeze
      altgraph==0.16.1
      astor==0.8.0
      atomicwrites==1.3.0
      attrs==19.2.0
      bandit==1.6.2
      certifi==2019.9.11
      chardet==3.0.4
      Click==7.0
      colorama==0.3.9
      dictdiffer==0.8.0
      docutils==0.15.2
      entrypoints==0.3
      eradicate==1.0
      flake8==3.7.8
      flake8-annotations-complexity==0.0.2
      flake8-bandit==2.1.2
      flake8-broken-line==0.1.1
      flake8-bugbear==19.8.0
      flake8-builtins==1.4.1
      flake8-coding==1.3.2
      flake8-commas==2.0.0
      flake8-comprehensions==2.2.0
      flake8-debugger==3.1.1
      flake8-docstrings==1.5.0
      flake8-eradicate==0.2.2
      flake8-executable==2.0.3
      flake8-isort==2.7.0
      flake8-logging-format==0.6.0
      flake8-pep3101==1.2.1
      flake8-polyfill==1.0.2
      flake8-print==3.1.1
      flake8-quotes==2.1.0
      flake8-rst-docstrings==0.0.11
      flake8-string-format==0.2.3
      future==0.18.0
      gitdb2==2.0.6
      GitPython==3.0.3
      idna==2.8
      importlib-metadata==0.23
      isort==4.3.21
      jmespath==0.9.4
      mando==0.6.4
      marshmallow==3.2.1
      marshmallow-polyfield==5.7
      mccabe==0.6.1
      more-itertools==7.2.0
      nitpick==0.21.1
      packaging==19.2
      pbr==5.4.3
      pefile==2019.4.18
      pep8-naming==0.8.2
      pluggy==0.13.0
      py==1.8.0
      pycodestyle==2.5.0
      pydocstyle==4.0.1
      pyflakes==2.1.1
      Pygments==2.4.2
      PyInstaller==3.5
      pyparsing==2.4.2
      pytest==5.2.1
      python-slugify==3.0.6
      pywin32-ctypes==0.2.0
      PyYAML==5.1.2
      radon==2.4.0
      requests==2.22.0
      restructuredtext-lint==1.3.0
      ruamel.yaml==0.16.5
      ruamel.yaml.clib==0.2.0
      six==1.12.0
      smmap2==2.0.5
      snowballstemmer==2.0.0
      sortedcontainers==2.1.0
      stevedore==1.31.0
      testfixtures==6.10.0
      text-unidecode==1.3
      toml==0.10.0
      typing-extensions==3.7.4
      urllib3==1.25.6
      wcwidth==0.1.7
      wemake-python-styleguide==0.12.5
      zipp==0.6.0
      
    bug released 
    opened by Skrierz 9
  • Check arbitrary (supported) files

    Check arbitrary (supported) files

    Expected Behavior

    Similar to the "[nitpick.JSONFile]" section, arbitrary TOML, YAML, etc. files can have content enforcement.

    Current Behavior

    With the notable exception of JSON files, there is a definitive list of supported files that one has to abide by. Even though the formats are parsed and handled by nitpick, the files are not on the whitelist.

    Possible Solution

    Rely on the filename extension to apply the format checker instead of using a whitelist.

    Context

    We would like to enforce new configurations with nitpick:

    Prettier can also parse a JSON configuration, but we would ideally not rewrite the configuration and open the door for more of our YAML files.

    enhancement wontfix 
    opened by bibz 8
  • Can't download default style with nitpick

    Can't download default style with nitpick

    Expected Behavior

    I expect nitpick to download default style file.

    Current Behavior

    I get Requests exception about invalid url.

    Traceback (most recent call last):
      File "C:\Users\Sleip\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "C:\Users\Sleip\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "C:\Users\Sleip\Desktop\Git\poe_gems_requirements\venv\Scripts\flake8.exe\__main__.py", line 9, in <module>
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\main\cli.py", line 18, in main
        app.run(argv)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\main\application.py", line 393, in run
        self._run(argv)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\main\application.py", line 381, in _run
        self.run_checks()
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\main\application.py", line 300, in run_checks
        self.file_checker_manager.run()
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\checker.py", line 331, in run
        self.run_serial()
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\checker.py", line 315, in run_serial
        checker.run_checks()
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\checker.py", line 598, in run_checks
        self.run_ast_checks()
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\checker.py", line 502, in run_ast_checks
        for (line_number, offset, text, check) in runner:
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\plugin.py", line 50, in run
        Nitpick.current_app().config.merge_styles(), self.check_files(True), self.check_files(False)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\config.py", line 65, in merge_styles
        style.find_initial_styles(configured_styles)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\style.py", line 61, in find_initial_styles
        self.include_multiple_styles(chosen_styles)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\style.py", line 97, in include_multiple_styles
        self.include_multiple_styles(sub_styles)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\style.py", line 76, in include_multiple_styles
        style_path = self.get_style_path(style_uri)  # type: Optional[Path]
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\style.py", line 105, in get_style_path
        style_path = self.fetch_style_from_url(clean_style_uri)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\style.py", line 134, in fetch_style_from_url
        response = requests.get(new_url)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\api.py", line 75, in get
        return request('get', url, params=params, **kwargs)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\api.py", line 60, in request
        return session.request(method=method, url=url, **kwargs)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\sessions.py", line 519, in request
        prep = self.prepare_request(req)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\sessions.py", line 462, in prepare_request
        hooks=merge_hooks(request.hooks, self.hooks),
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\models.py", line 313, in prepare
        self.prepare_url(url, params)
      File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\models.py", line 390, in prepare_url
        raise InvalidURL("Invalid URL %r: No host supplied" % url)
    requests.exceptions.InvalidURL: Invalid URL 'https:///C:\\raw.githubusercontent.com\\andreoliwa\\nitpick\\v0.21.2\\styles\\python37.toml': No host supplied
    

    Possible Solution

    I think that problem is due to resolving domain_plus_url in style.fetch_style_from_url. I don't understand why it's done for but it's looks like that problem can accure on Linux too.

    >>> url = PosixPath('\\raw.githubusercontent.com\\andreoliwa\\nitpick\\v0.21.2\\styles\\python37')
    >>> url.resolve()
    PosixPath('/home/.anon-737a48732c124779a7a9e587/\\raw.githubusercontent.com\\andreoliwa\\nitpick\\v0.21.2\
    \styles\\python37')
    
    >>> url = WindowsPath('\\raw.githubusercontent.com\\andreoliwa\\nitpick\\v0.21.2\\styles\\python37')
    >>> url.resolve()
    WindowsPath('C:/raw.githubusercontent.com/andreoliwa/nitpick/v0.21.2/styles/python37')
    

    Steps to Reproduce

    1. Install nitpick.
    2. Open project without any configs for flake8/nitpick.
    3. Run flake8 in project root.
    4. Get exception.

    Your Environment

    • nitpick version used: 0.21.2

    • Python version: Python 3.7.4

    • Operating System and version: Windows 10

    • Run the following commands and paste the output:

      (venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>where python
      C:\Users\Sleip\Desktop\Git\poe_gems_requirements\venv\Scripts\python.exe
      C:\Users\Sleip\AppData\Local\Programs\Python\Python37-32\python.exe
      
      (venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>python -V
      Python 3.7.4
      
      (venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>pip freeze
      altgraph==0.16.1
      astor==0.8.0
      atomicwrites==1.3.0
      attrs==19.2.0
      bandit==1.6.2
      certifi==2019.9.11
      chardet==3.0.4
      Click==7.0
      colorama==0.3.9
      dictdiffer==0.8.0
      docutils==0.15.2
      entrypoints==0.3
      eradicate==1.0
      flake8==3.7.8
      flake8-annotations-complexity==0.0.2
      flake8-bandit==2.1.2
      flake8-broken-line==0.1.1
      flake8-bugbear==19.8.0
      flake8-builtins==1.4.1
      flake8-coding==1.3.2
      flake8-commas==2.0.0
      flake8-comprehensions==2.2.0
      flake8-debugger==3.1.1
      flake8-docstrings==1.5.0
      flake8-eradicate==0.2.2
      flake8-executable==2.0.3
      flake8-isort==2.7.0
      flake8-logging-format==0.6.0
      flake8-pep3101==1.2.1
      flake8-polyfill==1.0.2
      flake8-print==3.1.1
      flake8-quotes==2.1.0
      flake8-rst-docstrings==0.0.11
      flake8-string-format==0.2.3
      future==0.18.0
      gitdb2==2.0.6
      GitPython==3.0.3
      idna==2.8
      importlib-metadata==0.23
      isort==4.3.21
      jmespath==0.9.4
      mando==0.6.4
      marshmallow==3.2.1
      marshmallow-polyfield==5.7
      mccabe==0.6.1
      more-itertools==7.2.0
      nitpick==0.21.2
      packaging==19.2
      pbr==5.4.3
      pefile==2019.4.18
      pep8-naming==0.8.2
      pluggy==0.13.0
      py==1.8.0
      pycodestyle==2.5.0
      pydocstyle==4.0.1
      pyflakes==2.1.1
      Pygments==2.4.2
      PyInstaller==3.5
      pyparsing==2.4.2
      pytest==5.2.1
      python-slugify==3.0.6
      pywin32-ctypes==0.2.0
      PyYAML==5.1.2
      radon==2.4.0
      requests==2.22.0
      restructuredtext-lint==1.3.0
      ruamel.yaml==0.16.5
      ruamel.yaml.clib==0.2.0
      six==1.12.0
      smmap2==2.0.5
      snowballstemmer==2.0.0
      sortedcontainers==2.1.0
      stevedore==1.31.0
      testfixtures==6.10.0
      text-unidecode==1.3
      toml==0.10.0
      typing-extensions==3.7.4
      urllib3==1.25.6
      wcwidth==0.1.7
      wemake-python-styleguide==0.12.5
      zipp==0.6.0
      
    bug released 
    opened by Skrierz 8
  • Relative paths in [nitpick.styles].includes remote style should be resolved against the remote URL

    Relative paths in [nitpick.styles].includes remote style should be resolved against the remote URL

    Problem

    Defining a preset that reuses other rules is arduous because relative paths are not supported. E.g. hosting a series of nitpick rules at https://coding-standards.example.com/python/* and a preset that includes the rules at https://coding-standards.example.com/presets/python.toml requires that we repeat the base URL in every single entry:

    [nitpick.styles]
    include = [
      "https://coding-standards.example.com/python/black.toml",
      "https://coding-standards.example.com/python/absent",
      "https://coding-standards.example.com/python/bandit",
      "https://coding-standards.example.com/python/black",
      "https://coding-standards.example.com/python/flake8",
      "https://coding-standards.example.com/python/hooks",
      "https://coding-standards.example.com/python/isort",
      "https://coding-standards.example.com/python/mypy",
      "https://coding-standards.example.com/python/poetry",
    ]
    

    This makes it hard to re-home the files somewhere else and error prone. The problem is compounded when you use private github project URLs with a PAT and a tag reference; every link has to have the token reference and branch named:

    [nitpick.styles]
    include = [
      "gh://$GITHUB_TOKEN@org/coding-standards@v1/python/black.toml",
      "gh://$GITHUB_TOKEN@org/coding-standards@v1/python/absent",
      "gh://$GITHUB_TOKEN@org/coding-standards@v1/python/bandit",
      "gh://$GITHUB_TOKEN@org/coding-standards@v1/python/black",
      "gh://$GITHUB_TOKEN@org/coding-standards@v1/python/flake8",
      "gh://$GITHUB_TOKEN@org/coding-standards@v1/python/hooks",
      "gh://$GITHUB_TOKEN@org/coding-standards@v1/python/isort",
      "gh://$GITHUB_TOKEN@org/coding-standards@v1/python/mypy",
      "gh://$GITHUB_TOKEN@org/coding-standards@v1/python/poetry",
    ]
    

    If I want to test changes to the styles before publishing I can't, not without first having to rewrite every include to point to the staging version or local filesystem.

    Possible solution

    Include references should be resolved relative to a base URL for the style file. So a file located at https://coding-standards.example.com/presets/python.toml, with the contents:

    [nitpick.styles]
    include = [
      "../python/black.toml",
      "../python/absent",
      "../python/bandit",
      "../python/black",
      "../python/flake8",
      "../python/hooks",
      "../python/isort",
      "../python/mypy",
      "../python/poetry",
    ]
    

    results in the paths being resolved as relative against the https://coding-standards.example.com/presets/python.toml base URL for that file. It would work exactly the same for a Github URL; the base would be gh://$GITHUB_TOKEN@org/coding-standards@v1/presets/python.toml in that case.

    This would also allow me to point nitpick to a local filesystem copy of my styles-under-development or hosted with a simple python -m http.server web server, for example, and all the includes would automatically be taken from the same location.

    enhancement released 
    opened by mjpieters 7
  • nitpick@0.25 fails with ImportError

    [email protected] fails with ImportError

    Recent release introduced a bunch of failures on several of my projects:

    Run poetry run flake8 .
    multiprocessing.pool.RemoteTraceback: 
    """
    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/multiprocessing/pool.py", line 125, in worker
        result = (True, func(*args, **kwds))
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/flake8/checker.py", line 676, in _run_checks
        return checker.run_checks()
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/flake8/checker.py", line 589, in run_checks
        self.run_ast_checks()
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/flake8/checker.py", line 494, in run_ast_checks
        for (line_number, offset, text, _) in runner:
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/nitpick/flake8.py", line 35, in run
        for collected_fuss in self.collect_errors():
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/nitpick/flake8.py", line 59, in collect_errors
        yield from nit.run()
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/nitpick/core.py", line 63, in run
        yield from chain(
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/nitpick/project.py", line 193, in merge_styles
        style = Style(self, self.plugin_manager, offline)
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/nitpick/project.py", line 159, in plugin_manager
        plugin_manager.load_setuptools_entrypoints(PROJECT_NAME)
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/pluggy/manager.py", line 299, in load_setuptools_entrypoints
        plugin = ep.load()
      File "/opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/importlib/metadata.py", line 77, in load
        module = import_module(match.group('module'))
      File "/opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/importlib/__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 783, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/nitpick/plugins/ini.py", line 8, in <module>
        from configupdater import ConfigUpdater, Space
    ImportError: cannot import name 'Space' from 'configupdater' (/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/configupdater/__init__.py)
    """
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/bin/flake8", line 8, in <module>
        sys.exit(main())
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/flake8/main/cli.py", line 22, in main
        app.run(argv)
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/flake8/main/application.py", line 363, in run
        self._run(argv)
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/flake8/main/application.py", line 351, in _run
        self.run_checks()
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/flake8/main/application.py", line 264, in run_checks
        self.file_checker_manager.run()
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/flake8/checker.py", line 321, in run
        self.run_parallel()
      File "/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/flake8/checker.py", line 287, in run_parallel
        for ret in pool_map:
      File "/opt/hostedtoolcache/Python/3.8.8/x64/lib/python3.8/multiprocessing/pool.py", line 868, in next
        raise value
    ImportError: cannot import name 'Space' from 'configupdater' (/home/runner/work/docker-image-size-limit/docker-image-size-limit/.venv/lib/python3.8/site-packages/configupdater/__init__.py)
    

    CI log: https://github.com/wemake-services/docker-image-size-limit/pull/180/checks?check_run_id=2072676546 PR: https://github.com/wemake-services/docker-image-size-limit/pull/180 Config itself: https://github.com/wemake-services/docker-image-size-limit/blob/master/setup.cfg

    bug 
    opened by sobolevn 7
  • build(deps): bump certifi from 2021.10.8 to 2022.12.7

    build(deps): bump certifi from 2021.10.8 to 2022.12.7

    Bumps certifi from 2021.10.8 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Support GitHub Enterprise Server

    Support GitHub Enterprise Server

    Problem

    I want to use nitpick with a style file located in a private repository on a GitHub Enterprise Server to have a consistent style of my settings within my organization.

    Possible solution

    Currently, the GitHub URLs are hard coded in nitpick GitHub Fetcher implementation. The idea is to set an environment variable with the GitHub Enterprise Server URL or extend the URL of the remote style with the URL of the GitHub Enterprise Serer URL.

    I tried to just set the URL in https://github.com/andreoliwa/nitpick/blob/f0f5b878b40a971fe0d0ea287fefae4233e3c643/src/nitpick/style/fetchers/github.py#L16 on my local installation, but that did not solve my issue. I'm not familiar with the entire URL validation process and did not want to dig to deep into this issue.

    For more information, see the CONTRIBUTING guide.

    enhancement 
    opened by Wilhelmsson177 2
  • contains_json with `false` doesn't work

    contains_json with `false` doesn't work

    nitpick does not report any violations that json value has to be false.

    Current behavior

    I have a style file like below.

    # style.toml
    [".vscode/settings.json".contains_json]
    "python.linting.pylintEnabled" = "false"
    "python.linting.flake8Enabled" = "true"
    

    nitpick check works at flake8Enabled = true as expected. However, checking pylintEnabled = false always results "No violations found" regardless actual value is true or false.

    Expected behavior

    nitpick properly reports a violation by checking a falsy json value.

    Steps to reproduce

    1. create a style file like above mentioned.
    2. create .vscode/setting.json which contains "{"python.linting.pylintEnabled" = true}.
    3. run nitpick check

    Context

    Our team members use the MS VSCode as a python development environment. I'm trying to write a style of .vscode/settings.json, to apply the same setting to our projects.

    Your environment

    • nitpick version used: 0.32.0
    • Python version: 3.9.12
    • Operating System and version: macOS 12.2.1
    • Link to your project: None
    • Run the following commands and paste the output:
    $ pipenv shell
      ...
    $ which python3
    /Users/mrr/dev/python/workspaces/nitpick-json-test/.venv/bin/python3
    
    $ python3 -V
    Python 3.9.12
    
    $ pip freeze
    appdirs==1.4.4
    attrs==22.1.0
    autorepr==0.3.0
    cattrs==22.1.0
    certifi==2022.6.15
    charset-normalizer==2.1.1
    click==8.1.3
    ConfigUpdater==3.1.1
    dictdiffer==0.9.0
    dpath==2.0.6
    exceptiongroup==1.0.0rc9
    flake8==5.0.4
    flatten-dict==0.4.2
    furl==2.1.3
    identify==2.5.5
    idna==3.3
    jmespath==1.0.1
    loguru==0.6.0
    marshmallow==3.17.1
    marshmallow-polyfield==5.10
    mccabe==0.7.0
    more-itertools==8.14.0
    nitpick==0.32.0
    orderedmultidict==1.0.1
    packaging==21.3
    pluggy==1.0.0
    pycodestyle==2.9.1
    pyflakes==2.5.0
    pyparsing==3.0.9
    python-slugify==6.1.2
    requests==2.28.1
    requests-cache==0.9.6
    ruamel.yaml==0.17.21
    ruamel.yaml.clib==0.2.6
    six==1.16.0
    sortedcontainers==2.4.0
    StrEnum==0.4.8
    text-unidecode==1.3
    toml==0.10.2
    tomlkit==0.11.4
    url-normalize==1.4.3
    urllib3==1.26.12
    
    cat $(which flake8)
    #!/Users/mrr/dev/python/workspaces/nitpick-json-test/.venv/bin/python
    # -*- coding: utf-8 -*-
    import re
    import sys
    from flake8.main.cli import main
    if __name__ == '__main__':
        sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
        sys.exit(main())
    

    For more information, see the CONTRIBUTING guide.

    bug 
    opened by ryo-murai 1
  • [doc] Branch reference syntax is imperfect

    [doc] Branch reference syntax is imperfect

    The docs show-case examples with @some-branch in remote URLs followed by a file path with slashes. But what if a branch name itself has slashes in it?

    It is common to have branches like features/issue-number/branch-description or release/v1.0. Is it possible to still reference them w/o resorting to using commit SHAs? Would urlescaping of these slashes work?

    bug 
    opened by webknjaz 1
  • [docs] Explain how to make the linter know that a file is of INI format

    [docs] Explain how to make the linter know that a file is of INI format

    I've been staring at the docs that mention that one could lint INI-files here https://nitpick.readthedocs.io/en/latest/plugins.html#ini-files with a few hardcoded examples of such files. I tried applying it to .flake8 and .pylintrc and it worked. But when I did the same for .isort.cfg, nitpick just spit out this:

    nitpick-style.toml:1: NIP001  has an incorrect style. Invalid config:
    ".isort.cfg".settings: Unknown configuration. See https://nitpick.rtfd.io/en/latest/plugins.html#text-files.
    

    I wondered why it'd identify this file as just a text file when it's clearly parseable with cfgparser. Grepping for hardcoded file names recognized as INI didn't help but staring at https://github.com/andreoliwa/nitpick/blob/develop/src/nitpick/plugins/ini.py did. I was lucky to notice identify in the var names even though it wasn't directly imported in that module. This is because I happen to know what that project is.

    I quickly confirmed my suspicion with

    $ identify-cli .flake8
    ["file", "flake8", "ini", "non-executable", "text"]
    $ identify-cli .isort.cfg 
    ["file", "non-executable", "text"]
    

    So I've gone ahead and submitted this PR upstream at https://github.com/pre-commit/identify/pull/323.

    While that patch will address the immediate problem, I felt like this issue needed to be filed anyway because this situation reveals problems in nitpick itself too.

    I think that there are 2 possible action items (non-exclusive):

    • mention that identify is used in the docs and suggest the users to submit PRs there to add new file classifications
    • implement a config setting in nitpick itself allowing the end-users to specify that some specific file is of a specific (known to them) type and should be linted with a certain plugin

    I hope this story provides all the necessary details to be actionable :)

    bug 
    opened by webknjaz 2
Releases(v0.32.0)
Owner
Augusto W. Andreoli
An average Joe.
Augusto W. Andreoli
A tool to manage configuration files, build scripts etc. across multiple projects.

A tool to manage configuration files, build scripts etc. across multiple projects.

null 8 Dec 14, 2022
sync application configuration and settings across multiple multiplatform devices

sync application configuration and settings across multiple multiplatform devices ✨ Key Features • ⚗️ Installation • ?? How To Use • ?? FAQ • ??️ Setu

Souvik 6 Aug 25, 2022
Mdformat is an opinionated Markdown formatter that can be used to enforce a consistent style in Markdown files

Mdformat is an opinionated Markdown formatter that can be used to enforce a consistent style in Markdown files. Mdformat is a Unix-style command-line tool as well as a Python library.

Executable Books 180 Jan 6, 2023
MagTape is a Policy-as-Code tool for Kubernetes that allows for evaluating Kubernetes resources against a set of defined policies to inform and enforce best practice configurations.

MagTape is a Policy-as-Code tool for Kubernetes that allows for evaluating Kubernetes resources against a set of defined policies to inform and enforce best practice configurations. MagTape includes variable policy enforcement, notifications, and targeted metrics.

T-Mobile 143 Dec 27, 2022
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

null 18.6k Dec 30, 2022
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

null 18.6k Jan 2, 2023
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

null 18.7k Jan 8, 2023
Here I plotted data for the average test scores across schools and class sizes across school districts.

HW_02 Here I plotted data for the average test scores across schools and class sizes across school districts. Average Test Score by Race This graph re

null 7 Oct 27, 2021
Read configuration settings from python configuration files.

Maison Read configuration settings from python configuration files. Motivation When developing a python application, e.g a command-line tool, it can b

null 9 Jan 4, 2023
J. Brandon Walker 1 May 13, 2022
Simple function to plot multiple barplots in the same figure.

Simple function to plot multiple barplots in the same figure. Supports padding and custom color.

Matthias Jakobs 2 Feb 21, 2022
A method to generate speech across multiple speakers

VoiceLoop PyTorch implementation of the method described in the paper VoiceLoop: Voice Fitting and Synthesis via a Phonological Loop. VoiceLoop is a n

Facebook Archive 873 Dec 15, 2022
Cross-platform-profile-pic-changer - Script to change profile pictures across multiple platforms

cross-platform-profile-pic-changer script to change profile pictures across mult

null 4 Jan 17, 2022
A tiny Configuration File Parser for Python Projects

A tiny Configuration File Parser for Python Projects. Currently working on JSON Config Files only.

Tanmoy Sen Gupta 1 Feb 12, 2022
null 5 Oct 19, 2022
This is a repository for "100 days of code challenge" projects. You can reach all projects from beginner to professional which are written in Python.

100 Days of Code It's a challenge that aims to gain code practice and enhance programming knowledge. Day #1 Create a Band Name Generator It's actually

SelenNB 2 May 12, 2022
Beginner Projects A couple of beginner projects here

Beginner Projects A couple of beginner projects here, listed from easiest to hardest :) selector.py: simply a random selector to tell me who to faceti

Kylie 272 Jan 7, 2023
Python Projects - Few Python projects with Testing using Pytest

Python_Projects Few Python projects : Fast_API_Docker_PyTest- Just a simple auto

Tal Mogendorff 1 Jan 22, 2022
Official PyTorch implementation of MX-Font (Multiple Heads are Better than One: Few-shot Font Generation with Multiple Localized Experts)

Introduction Pytorch implementation of Multiple Heads are Better than One: Few-shot Font Generation with Multiple Localized Expert. | paper Song Park1

Clova AI Research 97 Dec 23, 2022
Create Multiple CF entry for multiple websites

AWS-CloudFront Problem: Deploy multiple CloudFront for account with multiple domains. Functionality: Running this script in loop and deploy CloudFront

Giten Mitra 5 Nov 18, 2022