Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S Solaar
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 10
    • Issues 10
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pwr-Solaar
  • Solaar
  • Merge requests
  • !835

Code quality (formating and flake8)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/FFY00/formating into master Jul 02, 2020
  • Overview 6
  • Commits 13
  • Pipelines 0
  • Changes 85

Created by: FFY00

Okay, this has been a long time coming. The current code style is a mess, not even the indentation is consistent.

This PR introduces the following tools:

  • yapf (code formater)
  • isort (import sorter)
  • flake8 (various code quality checks)
  • pre-commit (misc checks, runs the tools listed above)

It also introduces a pre-commit config. pre-commit is used to run all the tests, it can be run standalone (pre-commit run or pre-commit run --all-files, I have this aliased to pca in my system) and it can also install a git hook to run everything when commiting. By default, it only runs the tools against the change files, this can be changed by passing the --all-files flag. To install the git hook, simply run pre-commit install. More info can be found here: https://pre-commit.com.

I also added a github action workflow to run all the checks.

I opted for yapf instead of black as I think black is very strict and has made some questionable choices when it comes to the code style they enforce.

@pfps what do you think?

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/FFY00/formating