Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure vscode pycodestyle linter #34425

Closed
DavidAyotte opened this issue Aug 24, 2022 · 23 comments
Closed

configure vscode pycodestyle linter #34425

DavidAyotte opened this issue Aug 24, 2022 · 23 comments

Comments

@DavidAyotte
Copy link
Member

The goal of this ticket is to configure the vscode pycodestyle linter to check against Sage's minimal style conventions:

  • E111: indentation is not a multiple of four
  • E306: expected 1 blank line before a nested definition, found 0
  • E401: multiple imports on one line
  • E701: multiple statements on one line (colon)
  • E702: multiple statements on one line (semicolon)
  • E703: statement ends with a semicolon
  • E711: comparison to None should be ‘if cond is None:’
  • E712: comparison to True should be ‘if cond is True:’ or ‘if cond:’
  • E713: test for membership should be 'not in'
  • E721: do not compare types, use isinstance()
  • E722: do not use bare except, specify exception instead
  • W605: invalid escape sequence ‘x’

See https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes

Depends on #34352

CC: @fchapoton @tobiasdiez

Component: misc

Keywords: vscode pycodestyle pep8

Author: David Ayotte

Branch/Commit: 14b7780

Reviewer: Matthias Koeppe

Issue created by migration from https://trac.sagemath.org/ticket/34425

@DavidAyotte DavidAyotte added this to the sage-9.7 milestone Aug 24, 2022
@DavidAyotte
Copy link
Member Author

Dependencies: 34352

@DavidAyotte
Copy link
Member Author

Changed dependencies from 34352 to #34352

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 24, 2022

comment:4

Also see src/doc/en/developer/tools.rst

@DavidAyotte
Copy link
Member Author

@DavidAyotte
Copy link
Member Author

Commit: c5755d8

@DavidAyotte
Copy link
Member Author

comment:6

The linter now only check against the style listed above.


New commits:

3a58015settings.json: add missing comma
c5755d8.vscode/settings.json: add pycodestyle arguments

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 25, 2022

comment:7

Could you add comments to the files that developers should keep this in sync

And also update src/doc/en/developer/tools.rst regarding this config file

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 25, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

0938385.vscode/settings.json: add comment
77a761asrc/doc/en/developer/tools.rst: update info on vscode pycodestyle linter

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 25, 2022

Changed commit from c5755d8 to 77a761a

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 25, 2022

comment:9

Also add a comment to src/tox.ini please

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 25, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

ec65ffesrc/tox.ini: add general comment

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 25, 2022

Changed commit from 77a761a to ec65ffe

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 25, 2022

comment:11

I meant a cross-reference from the section testenv:pycodestyle-minimal to the .vscode/settings.json

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 25, 2022

Changed commit from ec65ffe to 2be1535

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 25, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

2be1535.vscode/settings.json, src/tox.ini: add comments cross-referencing the two files

@DavidAyotte
Copy link
Member Author

comment:13

I think I finally got want you wanted, I hope it's okay! Don't hesitate to tell me if it is not.

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 25, 2022

comment:14

Thanks! Looking great

But ./sage -docbuild en/developer html gives

OSError: /Users/mkoeppe/s/sage/sage-rebasing/src/doc/en/developer/tools.rst:205: WARNING: Bullet list ends without a blank line; unexpected unindent.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 25, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

14b7780src/doc/en/developer/tools.rst: add missing blank line

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Aug 25, 2022

Changed commit from 2be1535 to 14b7780

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 25, 2022

Reviewer: Matthias Koeppe

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 25, 2022

comment:16

Perfect.

@slel

This comment has been minimized.

@vbraun
Copy link
Member

vbraun commented Aug 30, 2022

Changed branch from u/gh-DavidAyotte/configure_vscode_pycodestyle_linter to 14b7780

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants