Skip to content

Commit e43253c

Browse files
committed
Merge branch 'fix-linting-ci' of https://github.com/invertase/firebase-functions-python2 into function-naming
2 parents c83e425 + b9d6a0d commit e43253c

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

.github/workflows/ci.yaml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ jobs:
2222
python-version: ${{ matrix.python }}
2323
- name: Install dependencies
2424
run: |
25-
python setup.py install
26-
python -m pip install --upgrade pip
27-
pip install -r requirements.txt
25+
python3.10 -m venv venv
26+
source venv/bin/activate
27+
pip3 install --upgrade pip
28+
python3.10 -m pip install -r requirements.txt
29+
python3.10 setup.py install
2830
- name: Test with pytest & coverage
29-
run: python -m pytest --cov=src --cov-report term --cov-report html --cov-report xml
31+
run: |
32+
source venv/bin/activate
33+
python3.10 -m pytest --cov=src --cov-report term --cov-report html --cov-report xml -vv
3034
# TODO requires activation for this repository on codecov website first.
3135
# - name: Upload coverage to Codecov
3236
# uses: codecov/codecov-action@v3
@@ -41,9 +45,16 @@ jobs:
4145
python-version: "3.10"
4246
- name: Install dependencies
4347
run: |
44-
python -m pip install --upgrade pip
45-
pip install -r requirements.txt
48+
python3.10 -m venv venv
49+
source venv/bin/activate
50+
pip3 install --upgrade pip
51+
python3.10 -m pip install -r requirements.txt
52+
python3.10 setup.py install
4653
- name: Lint with pylint
47-
run: pylint $(git ls-files '*.py')
54+
run: |
55+
source venv/bin/activate
56+
python3.10 -m pylint $(git ls-files '*.py')
4857
- name: Lint with mypy
49-
run: python -m mypy .
58+
run: |
59+
source venv/bin/activate
60+
python3.10 -m mypy .

.pylintrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,6 @@ valid-metaclass-classmethod-first-arg=mcs
424424

425425
# Exceptions that will emit a warning when being caught. Defaults to
426426
# "Exception"
427-
overgeneral-exceptions=StandardError,
428-
Exception,
429-
BaseException
427+
overgeneral-exceptions=builtins.StandardError,
428+
builtins.Exception,
429+
builtins.BaseException

src/firebase_functions/private/serving.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def get_functions():
3737
module = importlib.util.module_from_spec(spec)
3838
spec.loader.exec_module(module)
3939
else:
40-
raise Exception(
40+
raise FileNotFoundError(
4141
"Firebase Functions for Python could not find the main.py file in your project."
4242
)
4343
functions = inspect.getmembers(module, inspect.isfunction)

src/firebase_functions/pubsub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def json(self) -> _typing.Optional[T]:
6767
else:
6868
return None
6969
except Exception as error:
70-
raise Exception(
70+
raise ValueError(
7171
f"Unable to parse Pub/Sub message data as JSON: {error}"
7272
) from error
7373

0 commit comments

Comments
 (0)