masa-finance / masa-bittensor

Bittensor Subnet Config
https://masa.ai
MIT License
0 stars 0 forks source link

Setup Black formatting and Flake8 linting #105

Closed juanmanso closed 3 days ago

juanmanso commented 1 week ago

Description

To start sanitising our code and putting it in shape, we will add some formatting and linting tools.

Linters analyze source code to flag programming errors, bugs, stylistic errors, and suspicious constructs. The most common ones for Python are pylint and the linter aggregators flake8, pylama, and prospector. There are also multi-language linter frameworks such as pre-commit and coala. We'll use Flake8 due to familiarity and this Reddit comment which gives a good point for Flake8 vs Pylint

The next addition to our toolbox is Black, the uncompromising Python code formatter. One of its greatest features is its lack of configurability. Blackened code looks the same regardless of the project you’re reading.

Acceptance criteria

Related issues

juanmanso commented 1 week ago

Suggested flake8 configuration (.flake8 file)

[flake8]
select = ANN,B,B9,BLK,C,D,DAR,E,F,I,S,W
ignore = E203,E501,W503
application-import-names = template, neurons
docstring-convention = google
import-order-style = google
max-complexity = 10
max-line-length = 88

Inspired by on this .flake8 file

juanmanso commented 1 week ago

Suggested implementation: