https://pantsbuild.org/ logo
#general
Title
# general
f

fresh-architect-74417

04/10/2019, 10:28 PM
Does pants project follow any Python style guide?
h

hundreds-father-404

04/10/2019, 10:28 PM
Sort of. It’s not very fleshed out. https://www.pantsbuild.org/styleguide.html
f

fresh-architect-74417

04/10/2019, 10:32 PM
The last commit for the pylint was 7 years ago.
h

hundreds-father-404

04/10/2019, 10:38 PM
Good find! We do have a couple of other ways we enforce style by running
./pants fmt ::
, which for example calls isort. But I think there are opportunities to make the style more consistent, through a mix of more tooling like auto-formatters and expanding our style guide
Is there anything in particular you’d like to see added or would like to see improved with style guide / linting / formatting? Or more of a general observation?
f

fresh-architect-74417

04/10/2019, 10:41 PM
I feel some of the codes are really hard to read. For instance, this part https://github.com/pantsbuild/pants/blob/272b0a5/src/python/pants/build_graph/build_file_parser.py#L74-L88 is too many level of nesting for such a simple function.
👍 1
It should be broken into smaller parts.
I can share the pylintrc I wrote for my company
Not sure if it going to be usable here.
h

hundreds-father-404

04/10/2019, 10:42 PM
There are parts that I think we could probably incorporate! That’d be great.
We’re also hoping MyPy / type hints will make the code base a bit easier to read
a

aloof-angle-91616

04/10/2019, 10:50 PM
+1 to all of that, plus the v2 engine allows flattening out deeply nested logic via dependency injection
h

hundreds-father-404

04/10/2019, 10:51 PM
“allows flattening out deeply nested logic via dependency injection” tbh, dependency injection sounds a bit scarier to me than deeply nested logic
a

aloof-angle-91616

04/10/2019, 10:52 PM
in the native backend it's used so that the logic of creating a compiler and linker setup that works on every system is contained in
native_toolchain.py
and that is a massive win imho
b

bitter-piano-88933

04/11/2019, 9:55 PM
I'm always weary of pylint, I prefer the softer defaults of flake8
4 Views