Skip to content

Commit

Permalink
Build: add pre-commit for flake8
Browse files Browse the repository at this point in the history
I add to disable some warning, a few of them should be enable later but
they require a lot of change. Most of them are from star import...

A few unused import are infact used, I will resolve this in another PR
  • Loading branch information
kinnou02 committed May 22, 2019
1 parent 52b7550 commit 5d0fb5a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 15 deletions.
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[flake8]
max-line-length=113
exclude=.git,__pycache__,source/third_party,debug,release,source/sql/,*_pb2.py,build
select = C,F,B,B950
ignore = F405,F401,F841,F811,F403
#F405: name may be undefined, or defined from star imports: module
#F401: imported but unused
#F841: local variable is assigned to but never used
#F811: redefinition of unused
#F403: import * used; unable to detect undefined names
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: trailing-whitespace
- id: check-ast
- id: check-merge-conflict
#- id: flake8
- id: flake8
- repo: https://github.com/CanalTP/navitia-pre-commit
rev: master
hooks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class DateTimeDictField(Field, DateTimeType):

def to_value(self, value):
return timestamp_to_str(value) if value else None
super(DateTimeDictField, self).__init__(schema_type=str, schema_metadata=schema_metadata, **kwargs)


class PeriodSerializer(PbNestedSerializer):
Expand Down
1 change: 1 addition & 0 deletions source/jormungandr/jormungandr/resources_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from jormungandr.interfaces.argument import ArgumentDoc
from jormungandr.interfaces.v1.serializer.jsonschema.serializer import SwaggerOptionPathSerializer
from jormungandr.interfaces.v1.swagger_schema import make_schema
from datetime import datetime
from navitiacommon.parser_args_type import BooleanType


Expand Down
1 change: 1 addition & 0 deletions source/jormungandr/requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ jsonschema==2.6.0
pytest-timeout==1.3.3
mypy==0.670; python_version > '3.0'
mypy-extensions==0.4.1; python_version > '3.0'
flake8==3.5.0
1 change: 1 addition & 0 deletions source/navitiacommon/navitiacommon/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import zipfile
import os
import glob
import logging

street_source_types = ['OSM']
address_source_types = ['BANO', 'OSM']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ def downgrade():
op.drop_column('stop_time', 'order', schema='navitia')
op.create_table(
'journey_pattern',
sa.Column('id', BIGINT(), primary_key=True, nullable=False),
sa.Column('route_id', BIGINT(), primary_key=False, nullable=False),
sa.Column('physical_mode_id', BIGINT(), primary_key=False, nullable=False),
sa.Column('uri', TEXT(), primary_key=False, nullable=False),
sa.Column('name', TEXT(), primary_key=False, nullable=False),
sa.Column('is_frequence', BOOLEAN(), primary_key=False, nullable=False),
sa.Column('id', sa.BIGINT(), primary_key=True, nullable=False),
sa.Column('route_id', sa.BIGINT(), primary_key=False, nullable=False),
sa.Column('physical_mode_id', sa.BIGINT(), primary_key=False, nullable=False),
sa.Column('uri', sa.TEXT(), primary_key=False, nullable=False),
sa.Column('name', sa.TEXT(), primary_key=False, nullable=False),
sa.Column('is_frequence', sa.BOOLEAN(), primary_key=False, nullable=False),
sa.ForeignKeyConstraint(['route_id'], [u'navitia.route.id'], name=u'journey_pattern_route_id_fkey'),
sa.ForeignKeyConstraint(
['physical_mode_id'], [u'navitia.physical_mode.id'], name=u'journey_pattern_physical_mode_id_fkey'
Expand All @@ -71,15 +71,15 @@ def downgrade():
)
op.create_table(
'journey_pattern_point',
sa.Column('id', BIGINT(), primary_key=True, nullable=False),
sa.Column('journey_pattern_id', BIGINT(), primary_key=False, nullable=False),
sa.Column('name', TEXT(), primary_key=False, nullable=False),
sa.Column('uri', TEXT(), primary_key=False, nullable=False),
sa.Column('order', INTEGER(), primary_key=False, nullable=False),
sa.Column('stop_point_id', BIGINT(), primary_key=False, nullable=False),
sa.Column('id', sa.BIGINT(), primary_key=True, nullable=False),
sa.Column('journey_pattern_id', sa.BIGINT(), primary_key=False, nullable=False),
sa.Column('name', sa.TEXT(), primary_key=False, nullable=False),
sa.Column('uri', sa.TEXT(), primary_key=False, nullable=False),
sa.Column('order', sa.INTEGER(), primary_key=False, nullable=False),
sa.Column('stop_point_id', sa.BIGINT(), primary_key=False, nullable=False),
sa.Column(
'shape_from_prev',
Geography(geometry_type='LINESTRING', srid=4326, spatial_index=False),
ga.Geography(geometry_type='LINESTRING', srid=4326, spatial_index=False),
primary_key=False,
),
sa.ForeignKeyConstraint(
Expand Down

0 comments on commit 5d0fb5a

Please sign in to comment.