Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Respect My Net Respect My Net
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 15
    • Issues 15
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • La Quadrature du Net
  • Respect My NetRespect My Net
  • Issues
  • #65
Closed
Open
Created Apr 24, 2017 by jcsaaddupuy@jcsaaddupuyContributor

improve coding style

flake8 reports a lot of coding style violations

flake8 | wc -l                                                                                                                                                                                                                                         
366

While some can be safely ignored (E501 line too long, E128 continuation line under-indented for visual indent, ...), others are more dangerous :

# indentation problem : 
# E111 indentation is not a multiple of four
flake8 | grep E111 | wc -l
13

flake8 does not report the pokemon exception handling, but swallowing all exceptions is not a good practice (and can be dangerous, as will handle any exception, like, for example, undefined variable (NameError))

  • bt.py#L27 (should except KeyError or at least Exception)
  • bt.py#L34 (should except KeyError or at least Exception)
  • bt.py#L43 (should except KeyError or at least Exception)
  • views.py#L60 (should except Violation.DoesNotExists or at least Exception)
  • views.py#L84 (should except Violation.DoesNotExists or at least Exception)

Other result from flake8 can help to keep the codebase clean (ex : unused imports or common pep8 violations)

# unused imports
flake8 | grep F401 | wc -l
35

Note : tools like autopep8 or yapf can help with common pep8 errors automagically.

I propose myself to do the dirty job, but this kind of merge request is likely to generate conflicts :)

Assignee
Assign to
Time tracking