diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..cca280d6 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: (c) TagStudio Contributors +# SPDX-License-Identifier: MIT + +# EditorConfig https://editorconfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +insert_final_newline = true +max_line_length = 100 +trim_trailing_whitespace = true + +[*.{css,json,md}] +indent_size = 4 + +[*.{yaml,yml}] +indent_size = 2 diff --git a/.prettierrc.toml b/.prettierrc.toml new file mode 100644 index 00000000..8b4b3be7 --- /dev/null +++ b/.prettierrc.toml @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: (c) TagStudio Contributors +# SPDX-License-Identifier: MIT + +# Prettier https://prettier.io/ + +bracketSameLine = false +bracketSpacing = true +objectWrap = "preserve" +quoteProps = "as-needed" +singleQuote = false diff --git a/docs/style.md b/docs/style.md index 2763f642..c1040821 100644 --- a/docs/style.md +++ b/docs/style.md @@ -23,6 +23,9 @@ Most of the style guidelines can be checked, fixed, and enforced via Ruff. Older - When writing text for window titles or form titles, use "[Title Case](https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case)" capitalization. Your IDE may have a command to format this for you automatically, although some may incorrectly capitalize short prepositions. In a pinch you can use a website such as [capitalizemytitle.com](https://capitalizemytitle.com/) to check. - If it wasn't mentioned above, then stick to [**PEP-8**](https://peps.python.org/pep-0008/)! +### Formatter Configs +TagStudio provides an [EditorConfig](https://editorconfig.org/#example-file) file ([`.editorconfig`](../.editorconfig)) along with a [Prettier](https://prettier.io/) config file ([`.prettierrc.toml`](../.prettierrc.toml)) for formatting files other than .py files (Markdown, JSON, YAML, HTML, CSS, etc.). If editing these types of files it's recommended that you use a formatter that supports EditorConfig or has its settings matched to the EditorConfig and Prettier configs. Lastly, please pay attention to the `prettier-ignore` flags in present in some files if you are not using Prettier, as formatting these sections will break formatting used elsewhere such as the [MkDocs site](https://docs.tagstud.io/). + ## Qt As of writing this section, the QT part of the code base is quite unstructured and the View and Controller parts are completely intermixed[^1]. This makes maintenance, fixes and general understanding of the code base quite challenging, because the interesting parts you are looking for are entangled in a bunch of repetitive UI setup code. To address this we are aiming to more strictly separate the view and controller aspects of the QT frontend.