Skip to content

Commit 9e25854

Browse files
committed
Move flake8 config to top level, add a separate CI action for linting
1 parent ce0e665 commit 9e25854

File tree

11 files changed

+36
-60
lines changed

11 files changed

+36
-60
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[flake8]
2+
exclude=.tox
23
max-line-length=120

.github/workflows/fluent.runtime.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,3 @@ jobs:
4343
python -m pip install .
4444
- run: ./runtests.py
4545
working-directory: ./fluent.runtime
46-
lint:
47-
runs-on: ubuntu-latest
48-
steps:
49-
- uses: actions/checkout@v4
50-
- uses: actions/setup-python@v5
51-
with:
52-
python-version: 3.9
53-
- name: Install dependencies
54-
working-directory: ./fluent.runtime
55-
run: |
56-
python -m pip install wheel
57-
python -m pip install --upgrade pip
58-
python -m pip install .
59-
python -m pip install flake8==6 mypy==1 types-babel types-pytz
60-
- name: Install latest fluent.syntax
61-
working-directory: ./fluent.syntax
62-
run: python -m pip install .
63-
- run: python -m flake8
64-
working-directory: ./fluent.runtime
65-
- run: python -m mypy fluent/
66-
working-directory: ./fluent.runtime

.github/workflows/fluent.syntax.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,3 @@ jobs:
3838
python -m pip install .
3939
- run: ./runtests.py
4040
working-directory: ./fluent.syntax
41-
lint:
42-
runs-on: ubuntu-latest
43-
steps:
44-
- uses: actions/checkout@v4
45-
- uses: actions/setup-python@v5
46-
with:
47-
python-version: 3.9
48-
- name: Install dependencies
49-
working-directory: ./fluent.syntax
50-
run: |
51-
python -m pip install --upgrade pip
52-
python -m pip install .
53-
python -m pip install flake8==6 mypy==1
54-
- run: python -m flake8
55-
working-directory: ./fluent.syntax
56-
- run: python -m mypy fluent/
57-
working-directory: ./fluent.syntax

.github/workflows/lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: 3.9
17+
- run: python -m pip install flake8==6 mypy==1 types-babel types-pytz
18+
- run: python -m pip install ./fluent.syntax ./fluent.runtime
19+
- run: python -m flake8
20+
- run: python -m mypy fluent.syntax/fluent fluent.runtime/fluent

docs/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@
3434
# Add any paths that contain templates here, relative to this directory.
3535
templates_path = ['_templates']
3636

37+
3738
# Add src_dir/docs/_templates in a hook as we only have the src_dir then.
3839
def setup(app):
3940
app.connect('config-inited', add_templates)
4041

42+
4143
def add_templates(app, config):
4244
config.templates_path.insert(0, f'{app.srcdir}/_templates')
4345

46+
4447
# List of patterns, relative to source directory, that match files and
4548
# directories to ignore when looking for source files.
4649
# This pattern also affects html_static_path and html_extra_path.

fluent.pygments/setup.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ version=2.0
44
[bdist_wheel]
55
universal=1
66

7-
[flake8]
8-
exclude=.tox
9-
max-line-length=120
10-
117
[isort]
128
line_length=120
139
skip_glob=.tox

fluent.runtime/setup.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ version=0.4.0
44
[bdist_wheel]
55
universal=1
66

7-
[flake8]
8-
exclude=.tox
9-
max-line-length=120
10-
117
[isort]
128
line_length=120
139
skip_glob=.tox

fluent.syntax/setup.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ version=0.19.0
44
[bdist_wheel]
55
universal=1
66

7-
[flake8]
8-
exclude=.tox
9-
max-line-length=120
10-
117
[isort]
128
line_length=120
139
skip_glob=.tox

tools/fluentfmt.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/python
22

33
import sys
4-
5-
sys.path.append('./')
64
import codecs
75
from fluent.syntax import parse, serialize
86

7+
sys.path.append("./")
8+
99

1010
def read_file(path):
11-
with codecs.open(path, 'r', encoding='utf-8') as file:
11+
with codecs.open(path, "r", encoding="utf-8") as file:
1212
text = file.read()
1313
return text
1414

@@ -17,7 +17,8 @@ def pretty_print(fileType, data):
1717
ast = parse(data)
1818
print(serialize(ast))
1919

20+
2021
if __name__ == "__main__":
21-
file_type = 'ftl'
22+
file_type = "ftl"
2223
f = read_file(sys.argv[1])
2324
pretty_print(file_type, f)

tools/parse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/python
22

33
import sys
4-
5-
sys.path.append('./')
64
import codecs
75
from fluent.syntax import parse
86
import json
97

8+
sys.path.append('./')
9+
1010

1111
def read_file(path):
1212
with codecs.open(path, 'r', encoding='utf-8') as file:

tools/serialize.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22

33
import sys
44
import json
5-
6-
sys.path.append('./')
75
import codecs
86
from fluent.syntax import ast, serialize
97

8+
sys.path.append("./")
9+
1010

1111
def read_json(path):
12-
with codecs.open(path, 'r', encoding='utf-8') as file:
12+
with codecs.open(path, "r", encoding="utf-8") as file:
1313
return json.load(file)
1414

1515

1616
def pretty_print(fileType, data):
1717
resource = ast.from_json(data)
1818
print(serialize(resource))
1919

20+
2021
if __name__ == "__main__":
21-
file_type = 'ftl'
22+
file_type = "ftl"
2223
f = read_json(sys.argv[1])
2324
pretty_print(file_type, f)

0 commit comments

Comments
 (0)