GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — requirements-txt-fixer doesn't support comments with indent · Issue #548 · pre-commit/pre-commit-hooks

requirements-txt-fixer doesn't support comments with indent #548

New issue
Copy link
New issue
Copy link
Closed
Closed
requirements-txt-fixer doesn't support comments with indent#548
Copy link

Description

@greshilov
greshilov
opened on Jan 17, 2021
Issue body actions

Consider following example requirements.txt file:

# This comment is fine
a==0.0.1
    #   This comment is not fine
b==0.0.2
# This comment is fine too

Script requirements_txt_fixer.py will fail with AssertionError on line # This comment is not fine.

Activity

  1. asottile commented on Jan 17, 2021

    @asottile
    asottile
    on Jan 17, 2021
    Member
    More actions

    I kind of agree with the assertion error -- why is that indented?

  2. greshilov commented on Jan 17, 2021

    @greshilov
    greshilov
    on Jan 17, 2021
    ContributorAuthor
    More actions

    I kind of agree with the assertion error -- why is that indented?

    it doesn't violate the rules. For example pip-compile tool from pip-tools package generates files with following structure:

    #
    # This file is autogenerated by pip-compile
    # To update, run:
    #
    #    pip-compile --allow-unsafe requirements/dev.in
    #
    aiodns==2.0.0 ; sys_platform == "linux" or sys_platform == "darwin" and python_version >= "3.7"
        # via -r requirements/base.txt
    aiohttp-theme==0.1.6
        # via
        #   flake8-pyi
        #   pytest
    babel==2.9.0
    ...
    
  3. asottile commented on Jan 17, 2021

    @asottile
    asottile
    on Jan 17, 2021
    Member
    More actions

    if you're using pip-tools there's no reason to use this hook (as it sorts)

  4. greshilov commented on Jan 17, 2021

    @greshilov
    greshilov
    on Jan 17, 2021
    ContributorAuthor
    More actions

    if you're using pip-tools there's no reason to use this hook (as it sorts)

    Agree.
    But it shows that some developers may use indents before comments (it's just a matter of taste).

    pip itself is ok with indented comments, so why this tool is not?

  5. asottile commented on Jan 17, 2021

    @asottile
    asottile
    on Jan 17, 2021
    Member
    More actions

    pip itself is ok with indented comments, so why this tool is not?

    pip is also ok with unsorted requirements files -- this tool implements a very specific style decision

  6. asottile
    closed this as completedon Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.