Giter VIP home page Giter VIP logo

autopep8's People

Contributors

cclauss avatar haito avatar ofir123 avatar peter-evans avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

autopep8's Issues

Action fails on "Commit autopep8 changes"

We have often got this failure and are unable to debug it:

image

Our workflow:

  1. Submit PR
  2. Run Autopep8 action
  3. Immediately commit code to the same branch/PR

The action code is attached below for reference:

name: autopep8
on: pull_request
jobs:
  autopep8:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
      - name: autopep8
        id: autopep8
        uses: peter-evans/[email protected]
        with:
          args: --exit-code --recursive --in-place --aggressive --aggressive .
      - name: Commit autopep8 changes
        if: steps.autopep8.outputs.exit-code == 2
        run: |
          git config --global user.name 'Redacted'
          git config --global user.email '[email protected]'
          git remote set-url origin https://x-access-token:${{ secrets.self_lint }}@github.com/$GITHUB_REPOSITORY
          git checkout $GITHUB_HEAD_REF
          git commit -am "self: lint fix"
          git push

Decorators spearated when brackets are not closed

I'm using autopep8 in emacs to write my python-code and lately I found some wrong behaviour of one of the auto-format-features:

Given this wrong code (note the not correctly closed brackets):

def doStuff(self, s_database):
    return ("ASDF"

@staticmethod
def doOtherStuff(self, param):
    doSomething()

The auto-correct will trigger this wrong behaviour, creating another syntax-error:

def doStuff(self, s_database):
    return ("ASDF"

@ staticmethod
def doOtherStuff(self, param):
    doSomething()

Here's my Elpy-Config:

Emacs.............: 26.3
Elpy..............: 1.35.0
Virtualenv........: None
Interactive Python: ipython3 7.13.0 (/usr/bin/ipython3)
RPC virtualenv....: rpc-venv (/home/qohelet/.emacs.d/elpy/rpc-venv)
 Python...........: python3 3.8.5 (/home/qohelet/.emacs.d/elpy/rpc-venv/bin/python3)
 Jedi.............: 0.18.0
 Rope.............: 0.18.0
 Autopep8.........: 1.5.5 (1.5.6 available)
 Yapf.............: 0.30.0 (0.31.0 available)
 Black............: 20.8b1
Syntax checker....: flake8 (/home/qohelet/.local/bin/flake8)

Restore git credentials fail

https://github.com/Maagan-Michael/invitease/runs/6257049794?check_suite_focus=true

This is the from the logs:

Restore persisted git credentials
  /usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader ^AUTHORIZATION:
  http.https://github.com/.extraheader
  /usr/bin/git config --local --get-regexp http.https://github.com/.extraheader ^AUTHORIZATION:
  http.https://github.com/.extraheader AUTHORIZATION: basic ***
  /usr/bin/git config --local --unset http.https://github.com/.extraheader ^AUTHORIZATION:
  Unset config key 'http.https://github.com/.extraheader'
  /usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
  Persisted git credentials restored

Suggest push to repository action in README

Here's the workflow I've been thinking about introducing to my repositories:

  1. Someone opens a PR.
  2. This action is run.
  3. We push the correctly formatted code to their branch if the branch isn't their master branch.

The github-push-action can assist us in doing so.
Would you like me to try and let you know if that workflow works?

The exclude option looks ineffective

Maybe I miss the proper syntax, but this next one wont exclude any subdirectory

uses: peter-evans/autopep8@v1
with:
  args: --recursive --diff --aggressive --aggressive --exclude="vendor" .

vendor is a subdirectory containing external thirdParty python sources. Some of them are not pep8 conformant. I don't want to know or fix it.

[QUESTION] What am I doing wrong here?

My Workflow:

name: autopep8
on: pull_request
jobs:
  autopep8:
    # Check if the PR is not raised by this workflow and is not from a fork
    if: startsWith(github.head_ref, 'autopep8-patches') == false && github.event.pull_request.head.repo.full_name == github.repository
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: autopep8
        id: autopep8
        uses: peter-evans/autopep8@v1
        with:
          args: --exit-code --recursive --in-place --aggressive --aggressive .
      - name: Set autopep8 branch name
        id: vars
        run: echo ::set-output name=branch-name::"autopep8-patches/$GITHUB_HEAD_REF"
      - name: Create Pull Request
        if: steps.autopep8.outputs.exit-code == 2
        uses: peter-evans/create-pull-request@v3
        with:
          commit-message: autopep8 action fixes
          title: Fixes by autopep8 action
          body: This is an auto-generated PR with fixes by autopep8.
          labels: autopep8
          branch: ${{ steps.vars.outputs.branch-name }}
      - name: Fail if autopep8 made changes
        if: steps.autopep8.outputs.exit-code == 2
        run: exit 1

Error: When the repository is checked out on a commit instead of a branch, the 'base' input must be supplied.

Remove print()-Statements

Would it be possible, to implement a feature to remove print()-Statements?
I use a 'dev'-branch, that includes a lot of print()-Statements, that are only used for debugging.
They are useless to have in the 'master' branch.

Push the formatting changes to the fork on:pull_request

Hi ๐Ÿ‘‹
thanks for the great job you did on this action ,

I was trying to commit the formatted files into a PR made from a fork on a private repository (where this feature of running workflows from forks is enabled).
So I used this action

    # push the formatting changes to the PR itself
      - name: Commit autopep8 changes
        if: steps.autopep8.outputs.exit-code == 2
        run: |
          git config --global user.name 'Peter Evans'
          git config --global user.email '[email protected]'
          git commit -am "Automated autopep8 fixes"
          git push

but it seems that it's trying to push to the base repo not the fork itself.
and I got this error


remote: Repository not found.
fatal: repository 'https://github.com/<org_name>/<repo_name>/' not found
Error: Process completed with exit code 128.

Knowing that there are couple of developers who forked this repo and want to run the formatting action when they open a PR to the base repo ,Is there any way to address my use case please ?

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.