pacti-org / pacti

A package for compositional system analysis and design
https://www.pacti.org
BSD 3-Clause "New" or "Revised" License
19 stars 5 forks source link

[BUG] Code quality of parser #321

Closed iincer closed 1 year ago

iincer commented 1 year ago

Describe the bug There are some linting bugs after the changes we made to the parser.

To Reproduce make check-types make check-quality

Expected behavior Linting should be error-free.

Actual behavior

Typing

$ make check-types
pdm run duty check-types
✗ Type-checking (1)
  > mypy --strict --allow-any-generics --implicit-reexport --allow-untyped-calls --config-file=config/mypy.ini src tests
  tests\case_studies\space_mission\space_mission_power.py:227: error: Name "scenario_sequence" is not defined  [name-defined]
  tests\case_studies\space_mission\space_mission_power.py:241: error: Name "scenario_sequence" is not defined  [name-defined]
  tests\case_studies\space_mission\space_mission_power.py:246: error: Name "scenario_sequence" is not defined  [name-defined]
  tests\case_studies\space_mission\space_mission_power.py:254: error: Name "scenario_sequence" is not defined  [name-defined]
  Found 4 errors in 1 file (checked 31 source files)

make: *** [check-types] Error 1

Quality

$ make check-quality
pdm run duty check-quality 
✗ Checking code quality (1)
  > flake8 --config=config/flake8.ini src tests
  src\pacti\terms\polyhedra\serializer.py:203:1: D202 No blank lines allowed after function docstring
  src\pacti\terms\polyhedra\serializer.py:240:1: DAR101 Missing parameter(s) in Docstring: - str_rep
  src\pacti\terms\polyhedra\serializer.py:272:1: DAR101 Missing parameter(s) in Docstring: - str_rep
  src\pacti\terms\polyhedra\serializer.py:304:5: B011 Do not call assert False since python -O removes these calls. Instead callers should raise 
AssertionError().
  src\pacti\terms\polyhedra\serializer.py:304:5: PT015 assertion always fails, replace with pytest.fail()
  src\pacti\terms\polyhedra\serializer.py:304:12: WPS444 Found incorrect keyword condition
  src\pacti\terms\polyhedra\serializer.py:317:1: DAR402 Excess exception(s) in Raises section: +r PolyhedralSyntaxConvexException
  src\pacti\terms\polyhedra\serializer.py:332:5: B011 Do not call assert False since python -O removes these calls. Instead callers should raise 
AssertionError().
  src\pacti\terms\polyhedra\serializer.py:332:5: PT015 assertion always fails, replace with pytest.fail()
  src\pacti\terms\polyhedra\serializer.py:332:12: WPS444 Found incorrect keyword condition
  src\pacti\terms\polyhedra\syntax\data.py:1:1: D100 Missing docstring in public module
  src\pacti\terms\polyhedra\syntax\data.py:26:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:26:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:26:1: D411 Missing blank line before section
  src\pacti\terms\polyhedra\syntax\data.py:39:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:39:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:51:1: DAR101 Missing parameter(s) in Docstring: - other
  src\pacti\terms\polyhedra\syntax\data.py:51:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:51:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:51:1: D411 Missing blank line before section
  src\pacti\terms\polyhedra\syntax\data.py:72:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:72:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:72:1: D411 Missing blank line before section
  src\pacti\terms\polyhedra\syntax\data.py:112:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:112:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:112:1: D411 Missing blank line before section
  src\pacti\terms\polyhedra\syntax\data.py:122:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:122:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:122:1: D411 Missing blank line before section
  src\pacti\terms\polyhedra\syntax\data.py:132:1: DAR101 Missing parameter(s) in Docstring: - other
  src\pacti\terms\polyhedra\syntax\data.py:132:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:132:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:132:1: D411 Missing blank line before section
  src\pacti\terms\polyhedra\syntax\data.py:144:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:144:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:144:1: D411 Missing blank line before section
  src\pacti\terms\polyhedra\syntax\data.py:226:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:226:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:226:1: D411 Missing blank line before section
  src\pacti\terms\polyhedra\syntax\data.py:255:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:255:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:265:1: DAR101 Missing parameter(s) in Docstring: - other
  src\pacti\terms\polyhedra\syntax\data.py:265:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:265:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:265:1: D411 Missing blank line before section
  src\pacti\terms\polyhedra\syntax\data.py:278:1: DAR201 Missing "Returns" in Docstring: - return
  src\pacti\terms\polyhedra\syntax\data.py:278:1: D205 1 blank line required between summary line and description
  src\pacti\terms\polyhedra\syntax\data.py:278:1: D411 Missing blank line before section
  src\pacti\terms\polyhedra\syntax\data.py:285:9: WPS531 Found simplifiable returning `if` condition in a function
  src\pacti\terms\polyhedra\syntax\data.py:312:9: WPS601 Found shadowed class attribute: operator
  src\pacti\terms\polyhedra\syntax\grammar.py:8:1: WPS450 Found protected object import: _combine_or_append
  src\pacti\terms\polyhedra\syntax\grammar.py:8:1: WPS235 Found too many imported names from a module: 9 > 8
  src\pacti\terms\polyhedra\syntax\grammar.py:31:21: WPS530 Found implicit negative index
  src\pacti\terms\polyhedra\syntax\grammar.py:98:10: WPS530 Found implicit negative index
  src\pacti\terms\polyhedra\syntax\grammar.py:118:17: WPS530 Found implicit negative index
  src\pacti\terms\polyhedra\syntax\grammar.py:191:11: WPS530 Found implicit negative index
  src\pacti\terms\polyhedra\syntax\grammar.py:204:1: WPS231 Found function with too much cognitive complexity: 16 > 12
  src\pacti\terms\polyhedra\syntax\grammar.py:262:12: WPS514 Found implicit `in` condition
  src\pacti\terms\polyhedra\syntax\grammar.py:398:5: WPS348 Found a line that starts with a dot
  src\pacti\terms\polyhedra\syntax\grammar.py:399:5: WPS348 Found a line that starts with a dot
  src\pacti\terms\polyhedra\syntax\grammar.py:405:5: WPS348 Found a line that starts with a dot
  src\pacti\terms\polyhedra\syntax\grammar.py:406:5: WPS348 Found a line that starts with a dot
  src\pacti\terms\polyhedra\syntax\grammar.py:412:5: WPS348 Found a line that starts with a dot
  src\pacti\terms\polyhedra\syntax\grammar.py:413:5: WPS348 Found a line that starts with a dot
  src\pacti\terms\polyhedra\syntax\grammar.py:419:5: WPS348 Found a line that starts with a dot
  src\pacti\terms\polyhedra\syntax\grammar.py:420:5: WPS348 Found a line that starts with a dot
  src\pacti\terms\polyhedra\syntax\grammar.py:426:5: WPS348 Found a line that starts with a dot
  src\pacti\terms\polyhedra\syntax\grammar.py:427:5: WPS348 Found a line that starts with a dot

make: *** [check-quality] Error 1