Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
########################################## rstfmt: a formatter for reStructuredText ##########################################
Not to be confused with rustfmt_.
Description
rstfmt is a tool for automatically formatting reStructuredText_ files in a consistent way.
Like Black_ and gofmt_, the motivation is to provide a format that is reasonable and minimally configurable to prevent teams from wasting time on style discussions (or individuals on manually doing formatting, for that matter).
Currently, rstfmt is in an early stage of development. Not all reST constructs are covered and the interface or formatting may change at any time without warning.
To get a feel for the output of rstfmt, see the sample file <sample.rst>
__.
Usage
.. code:: sh
pip install git+https://github.com/dzhu/rstfmt
pip install rstfmt
rstfmt
rstfmt --check ...
rstfmt --diff ...
rstfmt ...
rst
or txt
extension inside a directory.rstfmt ... rstfmt --ext txt ...
rstfmt -w
Like Black's blackd_, there is also a daemon that provides formatting via HTTP requests to avoid the cost of starting and importing everything on every run.
.. code:: sh
pip install 'git+https://github.com/dzhu/rstfmt#egg=rstfmt[d]' pip install 'rstfmt[d]'
rstfmtd --bind-host= --bind-port=
curl http://locahost:5219 --data-binary @
curl -H 'X-Line-Length: 72' http://locahost:5219 --data-binary @
curl -fsS http://locahost:5219 --data-binary @/dev/stdin
The default behavior of reading from stdin and writing to stdout should integrate well with other systems, such as on-save hooks in editors. For example, here's a configuration for reformatter.el_, including both standalone and daemon modes:
.. code:: lisp
;; Run the standalone tool. (reformatter-define rstfmt :program "rstfmt") (add-hook 'rst-mode-hook #'rstfmt-on-save-mode)
;; Query the daemon. (reformatter-define client-rstfmt :program "curl" :args '("-fsS" "http://localhost:5219" "--data-binary" "@/dev/stdin")) (add-hook 'rst-mode-hook #'client-rstfmt-on-save-mode)
.. _black: https://github.com/psf/black
.. _blackd: https://github.com/psf/black#blackd
.. _docutils: https://docutils.sourceforge.io/
.. _gofmt: https://blog.golang.org/gofmt
.. _pandoc: https://pandoc.org/
.. _reformatter.el: https://github.com/purcell/reformatter.el
.. _restructuredtext: https://docutils.sourceforge.io/docs/user/rst/quickstart.html
.. _rustfmt: https://github.com/rust-lang/rustfmt
FAQs
A formatter for reStructuredText
We found that rstfmt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.