{"id":13861683,"url":"https://github.com/karlotness/flymake-quickdef","last_synced_at":"2026-01-16T10:51:50.177Z","repository":{"id":104004468,"uuid":"198020537","full_name":"karlotness/flymake-quickdef","owner":"karlotness","description":"Quickly define a new Flymake backend","archived":false,"fork":false,"pushed_at":"2020-03-08T23:44:12.000Z","size":59,"stargazers_count":19,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-05T06:03:47.797Z","etag":null,"topics":["emacs","flymake"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karlotness.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-07-21T06:23:08.000Z","updated_at":"2024-05-20T13:46:52.000Z","dependencies_parsed_at":"2023-07-04T17:38:31.831Z","dependency_job_id":null,"html_url":"https://github.com/karlotness/flymake-quickdef","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlotness%2Fflymake-quickdef","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlotness%2Fflymake-quickdef/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlotness%2Fflymake-quickdef/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlotness%2Fflymake-quickdef/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karlotness","download_url":"https://codeload.github.com/karlotness/flymake-quickdef/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225968853,"owners_count":17553147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","flymake"],"created_at":"2024-08-05T06:01:27.916Z","updated_at":"2026-01-16T10:51:46.286Z","avatar_url":"https://github.com/karlotness.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"# Flymake-Quickdef\n[![MELPA](https://melpa.org/packages/flymake-quickdef-badge.svg)](https://melpa.org/#/flymake-quickdef)\n[![MELPA Stable](https://stable.melpa.org/packages/flymake-quickdef-badge.svg)](https://stable.melpa.org/#/flymake-quickdef)\n\nQuickly define a new [Flymake][flymake] backend\n\nThis package mainly defines `flymake-quickdef-backend`, a macro which\nhelps remove some of the boilerplate code from defining new Flymake\nbackend functions. The macro defines a function that is suitable to\nregister with Flymake and is similar in implementation to the\n[example][example] in the Flymake manual.\n\nNew backend functions using the macro provide, minimally:\n\n1. A Lisp form producing command line arguments for a program\n2. A regular expression to search the process output\n3. A Lisp form to convert the regex matches into Flymake diagnostics\n\nThe process of spawning the process and maintaining temporary files\nand buffers is generated by the macro. The macro definitions work\nsimilarly to [Flycheck's macro][fly-checker]. This makes it easier to\ndefine Flymake diagnostics using external linters and other programs.\n\n## Usage\nBelow is an example Flymake backend produced using the macro. It uses\n[Bandit][bandit] to check Python source code and shows an example of\nusing a tool which requires a temporary file. The macro handles\ncreating the temporary file to reflect the (possibly unsaved) state of\nthe buffer, running the external process, and cleaning up.\n\n```elisp\n(require 'flymake-quickdef)\n\n(flymake-quickdef-backend flymake-check-bandit\n  :pre-let ((bandit-exec (executable-find \"bandit\")))\n  :pre-check (unless bandit-exec (error \"Cannot find bandit executable\"))\n  :write-type 'file\n  :proc-form (list bandit-exec \"--format\" \"custom\" \"--msg-template\" \"diag:{line} {severity} {test_id}: {msg}\" fmqd-temp-file)\n  :search-regexp \"^diag:\\\\([[:digit:]]+\\\\) \\\\(HIGH\\\\|LOW\\\\|MEDIUM\\\\|UNDEFINED\\\\) \\\\([[:alpha:]][[:digit:]]+\\\\): \\\\(.*\\\\)$\"\n  :prep-diagnostic\n  (let* ((lnum (string-to-number (match-string 1)))\n         (severity (match-string 2))\n         (code (match-string 3))\n         (text (match-string 4))\n         (pos (flymake-diag-region fmqd-source lnum))\n         (beg (car pos))\n         (end (cdr pos))\n         (type (cond\n                ((string= severity \"HIGH\") :error)\n                ((string= severity \"MEDIUM\") :warning)\n                (t :note)))\n         (msg (format \"%s (%s)\" text code)))\n    (list fmqd-source beg end type msg)))\n```\n\nOnce the backend is defined, just arrange for it to be added to\n`flymake-diagnostic-functions`, for example in a mode hook.\n\nNote: if you use `flymake-quickdef-backend` in a package, always\nunconditionally `(require 'flymake-quickdef)`, like in the example\n(*not* just at compile time). This will ensure that supporting\ndefinitions, like global variables, are made when the backend\nfunctions run.\n\n## License\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nGeneral Public License for more details.\n\nPlease see [LICENSE.txt](LICENSE.txt) for a copy of the license.\n\n[flymake]: https://www.gnu.org/software/emacs/manual/html_node/flymake/index.html\n[example]: https://www.gnu.org/software/emacs/manual/html_node/flymake/An-annotated-example-backend.html\n[fly-checker]: https://www.flycheck.org/en/latest/developer/developing.html#writing-the-checker\n[bandit]: https://github.com/PyCQA/bandit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarlotness%2Fflymake-quickdef","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarlotness%2Fflymake-quickdef","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarlotness%2Fflymake-quickdef/lists"}