plone / plone.recipe.codeanalysis

provides static code analysis for Buildout-based Python projects, including flake8, JSHint, CSS Lint, and other code checks
https://pypi.org/project/plone.recipe.codeanalysis/
11 stars 8 forks source link

Document recomended Flake8 extensions #184

Closed hvelarde closed 8 years ago

hvelarde commented 8 years ago

I think is pretty important to dedicate a section on the documentation to mention which are the recommended Flake8 extensions plugins, what do they do and which original option the supersede.

gforcada commented 8 years ago

I thought I documented them somewhere before, seems I was wrong...

Anyway, at least from IMHO the [recommended] extra should cover all and only http://docs.plone.org/develop/styleguide/index.html

i.e. as i dubbed on my talk in last year's conference: my style guide is plone.recipe.codeanalysis [recommended].

A flake8 plugin should only go in if it implements a specific point/section of our style guide. The same way we should make sure that whenever the style guide is updated a ticket is opened here to either search or create a new flake8 plugin that implements those changes.

hvelarde commented 8 years ago

the main problem here is the lack of migration information from people coming from older versions of plone.recipe.codeanalysis; IMO, the package should emit a warning message when a user wants to use an old features that are is longer in place, but is implemented using an extension.

gforcada commented 8 years ago

Yeah, that was a mistake we (mostly me probably) made, pull requests/tickets about specifics would be good though.

hvelarde commented 8 years ago

also, the isort thing is not pretty intuitive; I installed it and now I don't know what to do, do I have to install isort also?

# git commit -am "Refactor"
Check clean lines....................[ OK ] in 0.051s
Flake8..........................[ FAILURE ] in 0.575s
/home/hvelarde/collective/fingerpointing/src/collective/fingerpointing/__init__.py:0:1: I001 isort found changes, run it on the file
/home/hvelarde/collective/fingerpointing/src/collective/fingerpointing/controlpanel.py:0:1: I001 isort found changes, run it on the file
/home/hvelarde/collective/fingerpointing/src/collective/fingerpointing/interfaces.py:0:1: I001 isort found changes, run it on the file
/home/hvelarde/collective/fingerpointing/src/collective/fingerpointing/logger.py:0:1: I001 isort found changes, run it on the file
/home/hvelarde/collective/fingerpointing/src/collective/fingerpointing/testing.py:0:1: I001 isort found changes, run it on the file
/home/hvelarde/collective/fingerpointing/src/collective/fingerpointing/Extensions/Install.py:0:1: I001 isort found changes, run it on the file
The command "bin/code-analysis" exited with 1 in 0.593s.
gforcada commented 8 years ago

the problem with isort is that it only returns a boolean result, either the file is ok or not, so not much can be done.

On the bright side, just install isort, add a configuration file and you are just one command away to fix the sorting. See https://github.com/plone/jenkins.plone.org/blob/master/docs/source/run-qa-on-package.rst as an example (although there is way more than just fixing isort).

hvelarde commented 8 years ago

thanks! the problem was an extra line after imports