Giter Club home page Giter Club logo

Comments (10)

brimoor avatar brimoor commented on August 12, 2024 1

haha slipped my mind ;-)

from eta.

brimoor avatar brimoor commented on August 12, 2024

Most of Google's Python style is covered by the pep8 and pylint linters:

pip install pep8

pip install pylint
pylint --generate-rcfile > ~/.pylintrc

Customize ~/.pylintrc by setting the following values:

reports=no
max-line-length=80
output-format=colorized

To lint a file:

pep8 <file>
pylint <file>

Almost all of pep8's output is useful, and most of pylint's output is useful.

All the common editors (emacs, sublime text, pydev) can be setup to automatically run pep8/pylint on files.

from eta.

brimoor avatar brimoor commented on August 12, 2024

So my proposal here is that we:

(a) always try to follow the rules here (we may add new conventions over time)
https://github.com/voxel51/eta/blob/develop/core_dev_guide.md

(b) be otherwise familiar with the underlying Google Python style to guide our "subconscious" development practices:
https://google.github.io/styleguide/pyguide.html

(c) be diligent about running pep8 and pylint on our source and obeying all reasonable recommendations

Then we can avoid talking about Python style in code chats!

from eta.

jasoncorso avatar jasoncorso commented on August 12, 2024

from eta.

jasoncorso avatar jasoncorso commented on August 12, 2024

Side note: it is terribly unfortunate that vim is not listed in your list of common editors, be it the most commonly used editor since the dawn of unix.

from eta.

jasoncorso avatar jasoncorso commented on August 12, 2024

both pep8 and pylint issue errors/warnings when a sys.path.insert is before an import. we need to handle that to not always output such a warning for our code.

from eta.

jasoncorso avatar jasoncorso commented on August 12, 2024

Also, I think we can set these up to be run on a git commit (even locally) and disallow a commit if there are any errors we care about. May get annoying, but I think this is the only way.

from eta.

jasoncorso avatar jasoncorso commented on August 12, 2024

Furthermore, for those vim'rs among us. This will strip trailing whitespaces on write.

fun! <SID>StripTrailingWhitespaces()
    let l = line(".")
    let c = col(".")
    let _s = @/
    %s/\s\+$//e
    call cursor(l, c)
    let @/ = _s
endfun

autocmd FileType c,cc,cpp,java,python autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()

This should be in your .vimrc.

I am considering making a vim-plugin to support Voxel51 formatting...

from eta.

jasoncorso avatar jasoncorso commented on August 12, 2024

Some more comments on configuring your pep8 and pylint configuration to meet our guidelines (this should be incorporated into the project files somehow).
For pylint, you can disable the single character variable warning by adding "C0103" to your disable line in the ~/.pylintrc

For pep8, if you make a configuration file (~/.config/pep8) that has the content

[pep8]
ignore=E402

Then you will not see the annoying error about the imports not at the beginning of the file.

from eta.

brimoor avatar brimoor commented on August 12, 2024

Custom ETA linting configurations now exist as of #25

from eta.

Related Issues (20)

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.