Skip to content

Ruff reported problems #47

@zvr

Description

@zvr

Running uv tool run ruff check in the triplestores directory, produces the following:

src/triplestore/backends/allegrograph.py:
  137:119 S113 Probable use of `requests` call with timeout set to `None`
  200:118 S113 Probable use of `requests` call with timeout set to `None`
  202:36  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  240:122 S113 Probable use of `requests` call with timeout set to `None`
  242:40  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  254:129 S113 Probable use of `requests` call with timeout set to `None`
  256:40  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  294:121 S113 Probable use of `requests` call with timeout set to `None`
  300:9   DOC501 Raised exception `RuntimeError` missing from docstring

src/triplestore/backends/blazegraph.py:
   81:104 S113 Probable use of `requests` call with timeout set to `None`
  150:106 S113 Probable use of `requests` call with timeout set to `None`
  151:40  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  163:113 S113 Probable use of `requests` call with timeout set to `None`
  164:40  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  195:102 S113 Probable use of `requests` call with timeout set to `None`
  196:36  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  228:93  S113 Probable use of `requests` call with timeout set to `None`
  234:9   DOC501 Raised exception `RuntimeError` missing from docstring

src/triplestore/backends/graphdb.py:
   33:9   DOC502 Raised exceptions are not explicitly raised: `ValueError`, `RuntimeError`
   70:9   DOC501 Raised exception `FileNotFoundError` missing from docstring
   90:124 S113 Probable use of `requests` call with timeout set to `None`
  153:118 S113 Probable use of `requests` call with timeout set to `None`
  155:36  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  190:122 S113 Probable use of `requests` call with timeout set to `None`
  191:40  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  202:129 S113 Probable use of `requests` call with timeout set to `None`
  203:40  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  223:9   SIM108 Use ternary operator `sparql = f"CLEAR GRAPH <{self.graph_uri}>" if getattr(self, "graph_uri", None) else "CLEAR DEFAULT"` instead of `if`-`else`-block
  242:109 S113 Probable use of `requests` call with timeout set to `None`
  261:40  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  329:32  PLR2004 Magic value used in comparison, consider replacing `403` with a constant variable

src/triplestore/backends/jena.py:
   72:9   DOC501 Raised exception `FileNotFoundError` missing from docstring
   93:18  SIM115 Use a context manager for opening files
  113:13  SIM105 Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass`
  115:13  S110 `try`-`except`-`pass` detected, consider logging the exception
  115:20  BLE001 Do not catch blind exception: `Exception`
  165:123 S113 Probable use of `requests` call with timeout set to `None`
  167:36  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  209:127 S113 Probable use of `requests` call with timeout set to `None`
  210:40  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  222:134 S113 Probable use of `requests` call with timeout set to `None`
  223:40  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  230:113 S113 Probable use of `requests` call with timeout set to `None`
  263:109 S113 Probable use of `requests` call with timeout set to `None`
  312:36  PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  319:9   PLR6301 Method `stop_server` could be a function, class method, or static method

src/triplestore/backends/jena_utils.py:
    7:8  S404 `subprocess` module is possibly insecure
   17:5  DOC201 `return` is not documented in docstring
   26:5  DOC201 `return` is not documented in docstring
   45:5  DOC201 `return` is not documented in docstring
   54:5  SIM108 Use ternary operator `base = Path(fb).expanduser().resolve() if fb else Path.home() / "fuseki" / "base"` instead of `if`-`else`-block
   63:5  DOC201 `return` is not documented in docstring
   63:5  DOC501 Raised exception `FileNotFoundError` missing from docstring
  105:53 FBT001 Boolean-typed positional argument in function definition
  105:53 FBT002 Boolean default positional argument in function definition
  106:5  DOC501 Raised exception `RuntimeError` missing from docstring
  106:5  DOC502 Raised exception is not explicitly raised: `FileNotFoundError if 'fuseki-server' cannot be located.`
  152:9  S603 `subprocess` call: check for execution of untrusted input
  154:9  S603 `subprocess` call: check for execution of untrusted input
  166:40 PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable
  167:17 T201 `print` found
  203:9  PERF203 `try`-`except` within a loop incurs performance overhead
  210:1  E117 Over-indented

src/triplestore/backends/oxigraph.py:
  46:9 DOC501 Raised exception `FileNotFoundError` missing from docstring

src/triplestore/exceptions.py:
  17:7 N818 Exception name `TriplestoreMissingConfigValue` should be named with an Error suffix

src/triplestore/registration.py:
  28:12 PLW0603 Using the global statement to update `DISCOVERED` is discouraged

src/triplestore/triplestore.py:
  12:5  N802 Function name `Triplestore` should be lowercase
  47:27 PLC1901 `backend.strip() == ""` can be simplified to `not backend.strip()` as an empty string is falsey

src/triplestore/utils.py:
   7:8  S404 `subprocess` module is possibly insecure
  40:45 S607 Starting a process with a partial executable path
  58:5  DOC501 Raised exception `TriplestoreMissingConfigValue` missing from docstring
  58:5  DOC502 Raised exception is not explicitly raised: `ValueError`

Found 72 errors.

Not all of them are real errors (e.g. it's fine for Triplestore to start with an uppercase letter), but most of them should be dealt with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions