GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Failed Conditions
Pull Request — master (#17)
by Yngve
04:14
created

tests.pyre_strict_test   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 21
dl 0
loc 43
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B PyreStrictTest.test_strict_all_python_files() 0 26 7
1
# pyre-strict
2
3
"""
4
We use Pyre Check to prevent type errors. However, for Pyre Check to fail if
5
type declarations aren't "perfect", all files need to start with a "pyre-strict"
6
comment. This test checks that all Python files start with such a comment.
7
"""
8
9
import unittest
10
import os
11
12
13
class PyreStrictTest(unittest.TestCase):
14
    """
15
    Check that all relevant Python files have Pyre set to strict mode.
16
    """
17
    def test_strict_all_python_files(self) -> None:
18
        """
19
        Check that all relevant Python files have Pyre set to strict mode.
20
        """
21
        for directory, _directories, files in os.walk('.'):
22
            for file in files:
23
                if not file.endswith('.py'):
24
                    continue
25
26
                path = os.path.join(directory, file)
27
28
                if './lib/' in path:
29
                    # Prevent false positive in Scrutinizer.
30
                    continue
31
32
                if './bin/activate_this.py' in path:
33
                    # Prevent false positive in Scrutinizer.
34
                    continue
35
36
                with open(path) as current_file:
37
                    first_line: str = current_file.readline()
38
39
                    self.assertEqual(
40
                        first_line,
41
                        '# pyre-strict\n',
42
                        path + ' is not set to Pyre strict mode.',
43
                    )
44