From 170129feecab95f8452da0cb0a28961693b2a7ba Mon Sep 17 00:00:00 2001 From: Austin Bennett Date: Mon, 31 Aug 2026 19:23:01 -0500 Subject: [PATCH] Fix the Lint CI workflow (broken since v0.1.2) clang-format job: the flatpak CI image has no ECM on the host, so the configure step that generated .clang-format could never run. Commit the ECM-generated .clang-format instead (it is MIT, LICENSES/MIT.txt added), drop the container, pin clang-format 22.1.8 from PyPI to match the version the tree is formatted with, and reformat the sources to match. REUSE job: add the missing CC0-1.0 license text, a copyright line for the metainfo, REUSE.toml coverage for README/CONTRIBUTING/.gitignore, and REUSE-Ignore markers around CONTRIBUTING.md's SPDX example so the parser stops reading prose as a license declaration. reuse lint now passes locally (54/54 files). Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_019FXfh48mASRsE1WEhy9jcM --- .clang-format | 95 +++++++++++++++ .github/workflows/lint.yml | 11 +- .gitignore | 2 - CONTRIBUTING.md | 2 + LICENSES/CC0-1.0.txt | 121 +++++++++++++++++++ LICENSES/MIT.txt | 18 +++ REUSE.toml | 9 ++ autotests/jobsdatabasetest.cpp | 2 +- io.github.toservetheking.Kareer.metainfo.xml | 1 + src/clicommands.cpp | 25 ++-- src/jobfieldcatalog.cpp | 9 +- src/jobfieldcatalog.h | 2 +- src/jobsdatabase.cpp | 6 +- src/jobstage.cpp | 3 +- src/sankeymodel.cpp | 4 +- 15 files changed, 282 insertions(+), 28 deletions(-) create mode 100644 .clang-format create mode 100644 LICENSES/CC0-1.0.txt create mode 100644 LICENSES/MIT.txt diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..9b5ae0a --- /dev/null +++ b/.clang-format @@ -0,0 +1,95 @@ +--- +# SPDX-FileCopyrightText: 2019 Christoph Cullmann +# SPDX-FileCopyrightText: 2019 Gernot Gebhard +# +# SPDX-License-Identifier: MIT + +# This file got automatically created by ECM, do not edit +# See https://clang.llvm.org/docs/ClangFormatStyleOptions.html for the config options +# and https://community.kde.org/Policies/Frameworks_Coding_Style#Clang-format_automatic_code_formatting +# for clang-format tips & tricks +--- +Language: JavaScript +DisableFormat: true +--- +Language: Json +DisableFormat: false +IndentWidth: 4 +--- + +# Style for C++ +Language: Cpp + +# base is WebKit coding style: https://webkit.org/code-style-guidelines/ +# below are only things set that diverge from this style! +BasedOnStyle: WebKit + +# enforce C++11 (e.g. for std::vector> +Standard: Cpp11 + +# 4 spaces indent +TabWidth: 4 + +# 2 * 80 wide lines +ColumnLimit: 160 + +# sort includes inside line separated groups +SortIncludes: true + +# break before braces on function, namespace and class definitions. +BreakBeforeBraces: Linux + +# CrlInstruction *a; +PointerAlignment: Right + +# horizontally aligns arguments after an open bracket. +AlignAfterOpenBracket: Align + +# don't move all parameters to new line +AllowAllParametersOfDeclarationOnNextLine: false + +# no single line functions +AllowShortFunctionsOnASingleLine: None + +# no single line enums +AllowShortEnumsOnASingleLine: false + +# always break before you encounter multi line strings +AlwaysBreakBeforeMultilineStrings: true + +# don't move arguments to own lines if they are not all on the same +BinPackArguments: false + +# don't move parameters to own lines if they are not all on the same +BinPackParameters: false + +# In case we have an if statement with multiple lines the operator should be at the beginning of the line +# but we do not want to break assignments +BreakBeforeBinaryOperators: NonAssignment + +# format C++11 braced lists like function calls +Cpp11BracedListStyle: true + +# do not put a space before C++11 braced lists +SpaceBeforeCpp11BracedList: false + +# remove empty lines +KeepEmptyLinesAtTheStartOfBlocks: false + +# no namespace indentation to keep indent level low +NamespaceIndentation: None + +# we use template< without space. +SpaceAfterTemplateKeyword: false + +# Always break after template declaration +AlwaysBreakTemplateDeclarations: true + +# macros for which the opening brace stays attached. +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE , wl_resource_for_each, wl_resource_for_each_safe ] + +# keep lambda formatting multi-line if not empty +AllowShortLambdasOnASingleLine: Empty + +# We do not want clang-format to put all arguments on a new line +AllowAllArgumentsOnNextLine: false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 00e40c8..cc4d2d8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,15 +22,16 @@ jobs: clang-format: name: clang-format runs-on: ubuntu-latest - container: - image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.10 - options: --privileged steps: - name: Checkout uses: actions/checkout@v4 - - name: Configure (generates the KDE .clang-format style) - run: cmake -B build -G Ninja -DBUILD_TESTING=OFF + # The .clang-format at the repo root is the one ECM's KDEClangFormat + # generates at configure time, committed so this check needs no KDE + # stack. Pinned to the clang-format major used to format the tree - + # output drifts between major versions. + - name: Install clang-format + run: pipx install clang-format==22.1.8 - name: Check formatting run: | diff --git a/.gitignore b/.gitignore index fccf8d6..c8bd001 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,3 @@ # Editor / misc *.user *.autosave -# Generated by ECM's KDEClangFormat module -/.clang-format diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9659795..57d064a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,10 +30,12 @@ release builds. ## Conventions + - Every source file starts with `SPDX-License-Identifier: GPL-3.0-or-later` (in whatever comment syntax fits the file type). Files that can't carry an inline header — `.desktop`, `keys/*.asc` — are covered instead by `REUSE.toml`. + - `src/` is intentionally flat: one class per concern, no `models/`, `controllers/`, or `viewmodels/` subfolders. - C++ backend classes are exposed to QML via `QML_ELEMENT`; QML views are diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/LICENSES/CC0-1.0.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000..d817195 --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,18 @@ +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO +EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/REUSE.toml b/REUSE.toml index 6a2a42b..6a47f78 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -11,3 +11,12 @@ path = [ ] SPDX-License-Identifier = "GPL-3.0-or-later" SPDX-FileCopyrightText = "ToServeTheKing " + +[[annotations]] +path = [ + "README.md", + "CONTRIBUTING.md", + ".gitignore", +] +SPDX-License-Identifier = "CC0-1.0" +SPDX-FileCopyrightText = "ToServeTheKing " diff --git a/autotests/jobsdatabasetest.cpp b/autotests/jobsdatabasetest.cpp index 63b6f31..6b5f402 100644 --- a/autotests/jobsdatabasetest.cpp +++ b/autotests/jobsdatabasetest.cpp @@ -4,8 +4,8 @@ SPDX-License-Identifier: GPL-3.0-or-later */ -#include "job.h" #include "jobsdatabase.h" +#include "job.h" #include #include diff --git a/io.github.toservetheking.Kareer.metainfo.xml b/io.github.toservetheking.Kareer.metainfo.xml index 31ad41b..eec8cd0 100644 --- a/io.github.toservetheking.Kareer.metainfo.xml +++ b/io.github.toservetheking.Kareer.metainfo.xml @@ -1,4 +1,5 @@ + io.github.toservetheking.Kareer diff --git a/src/clicommands.cpp b/src/clicommands.cpp index e61240c..31073b4 100644 --- a/src/clicommands.cpp +++ b/src/clicommands.cpp @@ -553,17 +553,10 @@ int runStages(const QString &program, const QStringList &args) int runHelp() { QTextStream out(stdout); - out << u"Usage: kareer [options]\n\n"_s - << u"Commands:\n"_s - << u" add Add a new job application\n"_s - << u" list List job applications\n"_s - << u" show Show one job application\n"_s - << u" update Update fields on an existing application\n"_s - << u" stage Move an application to a new stage\n"_s - << u" delete Delete an application\n"_s - << u" stats Summary statistics\n"_s - << u" stages List the canonical pipeline stages\n\n"_s - << u"Run 'kareer --help' for the options of a specific command.\n"_s + out << u"Usage: kareer [options]\n\n"_s << u"Commands:\n"_s << u" add Add a new job application\n"_s + << u" list List job applications\n"_s << u" show Show one job application\n"_s << u" update Update fields on an existing application\n"_s + << u" stage Move an application to a new stage\n"_s << u" delete Delete an application\n"_s << u" stats Summary statistics\n"_s + << u" stages List the canonical pipeline stages\n\n"_s << u"Run 'kareer --help' for the options of a specific command.\n"_s << u"Running kareer with no command (or an unrecognized one) starts the GUI.\n"_s; return 0; } @@ -573,7 +566,15 @@ int runHelp() bool Cli::isSubcommand(const QString &arg) { static const QSet subcommands{ - u"add"_s, u"list"_s, u"show"_s, u"update"_s, u"stage"_s, u"delete"_s, u"stats"_s, u"stages"_s, u"help"_s, + u"add"_s, + u"list"_s, + u"show"_s, + u"update"_s, + u"stage"_s, + u"delete"_s, + u"stats"_s, + u"stages"_s, + u"help"_s, }; return subcommands.contains(arg); } diff --git a/src/jobfieldcatalog.cpp b/src/jobfieldcatalog.cpp index 69dda9c..9e836c6 100644 --- a/src/jobfieldcatalog.cpp +++ b/src/jobfieldcatalog.cpp @@ -28,7 +28,14 @@ QList fields() {u"company"_s, u"company"_s, QStringLiteral("Company:"), TextRow, {}, {}, 0, 0}, {u"title"_s, u"company"_s, QStringLiteral("Job Title:"), TextRow, {}, {}, 0, 0}, {u"location"_s, u"company"_s, QStringLiteral("Location:"), TextRow, {}, {}, 0, 0}, - {u"remoteType"_s, u"company"_s, QStringLiteral("Remote Type:"), ComboRow, {QStringLiteral("Unspecified"), QStringLiteral("Onsite"), QStringLiteral("Hybrid"), QStringLiteral("Remote")}, {}, 0, 0}, + {u"remoteType"_s, + u"company"_s, + QStringLiteral("Remote Type:"), + ComboRow, + {QStringLiteral("Unspecified"), QStringLiteral("Onsite"), QStringLiteral("Hybrid"), QStringLiteral("Remote")}, + {}, + 0, + 0}, {u"stage"_s, u"pipeline"_s, QStringLiteral("Stage:"), ComboRow, JobStage::canonicalStages(), {}, 0, 0}, {u"dateApplied"_s, u"pipeline"_s, QStringLiteral("Date Applied:"), DateRow, {}, {}, 0, 0}, diff --git a/src/jobfieldcatalog.h b/src/jobfieldcatalog.h index f2a5156..343dff1 100644 --- a/src/jobfieldcatalog.h +++ b/src/jobfieldcatalog.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include /** * The static structure of the job edit form: which categories exist, and diff --git a/src/jobsdatabase.cpp b/src/jobsdatabase.cpp index cfd6b77..4ed6912 100644 --- a/src/jobsdatabase.cpp +++ b/src/jobsdatabase.cpp @@ -230,7 +230,8 @@ bool JobsDatabase::addJob(Job &job) job.updatedAt = now; QSqlQuery query(db); - query.prepare(uR"( + query.prepare( + uR"( INSERT INTO jobs (company, title, location, remote_type, source, url, date_applied, salary_min, salary_max, salary_expectation, currency, notes, contact, stage, created_at, updated_at) @@ -278,7 +279,8 @@ bool JobsDatabase::updateJob(const Job &job) { QSqlDatabase db = QSqlDatabase::database(m_connectionName); QSqlQuery query(db); - query.prepare(uR"( + query.prepare( + uR"( UPDATE jobs SET company = :company, title = :title, location = :location, remote_type = :remote_type, source = :source, url = :url, date_applied = :date_applied, salary_min = :salary_min, diff --git a/src/jobstage.cpp b/src/jobstage.cpp index ee36f1b..5eef8a0 100644 --- a/src/jobstage.cpp +++ b/src/jobstage.cpp @@ -104,8 +104,7 @@ QColor color(const QString &stage) bool isTerminal(const QString &stage) { - return stage == QLatin1String("Accepted") || stage == QLatin1String("Rejected") || stage == QLatin1String("Withdrawn") - || stage == QLatin1String("Ghosted"); + return stage == QLatin1String("Accepted") || stage == QLatin1String("Rejected") || stage == QLatin1String("Withdrawn") || stage == QLatin1String("Ghosted"); } } diff --git a/src/sankeymodel.cpp b/src/sankeymodel.cpp index 8932b9c..cf42508 100644 --- a/src/sankeymodel.cpp +++ b/src/sankeymodel.cpp @@ -344,8 +344,8 @@ void SankeyModel::relayout(qreal width, qreal height, qreal nodeWidth, qreal pad const qreal x1 = toNode.x; const qreal midX = (x0 + x1) / 2.0; - const QString path = u"M"_s + point(x0, y0Top) + u" C"_s + point(midX, y0Top) + u" "_s + point(midX, y1Top) + u" "_s + point(x1, y1Top) - + u" L"_s + point(x1, y1Bottom) + u" C"_s + point(midX, y1Bottom) + u" "_s + point(midX, y0Bottom) + u" "_s + point(x0, y0Bottom) + u" Z"_s; + const QString path = u"M"_s + point(x0, y0Top) + u" C"_s + point(midX, y0Top) + u" "_s + point(midX, y1Top) + u" "_s + point(x1, y1Top) + u" L"_s + + point(x1, y1Bottom) + u" C"_s + point(midX, y1Bottom) + u" "_s + point(midX, y0Bottom) + u" "_s + point(x0, y0Bottom) + u" Z"_s; QColor linkColor = JobStage::color(from); linkColor.setAlphaF(0.5f);