From 7ac89425735768dffc2d7c6d79eaaf7b9103d943 Mon Sep 17 00:00:00 2001 From: Konrad Weihmann Date: Mon, 25 Apr 2022 18:20:17 +0200 Subject: [PATCH] remove proselint module Relates to #8749 Signed-off-by: Konrad Weihmann --- README.md | 2 - classes/sca-blacklist.bbclass | 1 - classes/sca-global.bbclass | 1 - classes/sca-on-image.bbclass | 1 - classes/sca-on-recipe.bbclass | 1 - classes/sca-proselint-core.bbclass | 120 ------------------ classes/sca-proselint-image.bbclass | 14 -- classes/sca-proselint-recipe.bbclass | 15 --- docs/conf/module/proselint.md | 61 --------- .../code-from-elsewhere/cspell_2.0.3.bb | 2 - files/module_list.csv | 1 - .../files/fatal | 0 .../files/suppress | 0 .../sca-image-proselint-rules-native_1.0.bb | 19 --- .../files/fatal | 0 .../files/suppress | 0 .../sca-recipe-proselint-rules-native_1.0.bb | 19 --- .../files/proselint.sca.description | 30 ----- .../python3-proselint-native_0.10.2.bb | 25 ---- test/lang_standard_02.txt | 1 - 20 files changed, 313 deletions(-) delete mode 100755 classes/sca-proselint-core.bbclass delete mode 100755 classes/sca-proselint-image.bbclass delete mode 100755 classes/sca-proselint-recipe.bbclass delete mode 100644 docs/conf/module/proselint.md delete mode 100755 recipes-sca-rules/sca-image-proselint-rules-native/files/fatal delete mode 100755 recipes-sca-rules/sca-image-proselint-rules-native/files/suppress delete mode 100755 recipes-sca-rules/sca-image-proselint-rules-native/sca-image-proselint-rules-native_1.0.bb delete mode 100755 recipes-sca-rules/sca-recipe-proselint-rules-native/files/fatal delete mode 100755 recipes-sca-rules/sca-recipe-proselint-rules-native/files/suppress delete mode 100755 recipes-sca-rules/sca-recipe-proselint-rules-native/sca-recipe-proselint-rules-native_1.0.bb delete mode 100644 recipes-sca/python3-proselint-native/files/proselint.sca.description delete mode 100755 recipes-sca/python3-proselint-native/python3-proselint-native_0.10.2.bb diff --git a/README.md b/README.md index fc1a57d1dc..482d94d026 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,6 @@ The layer can check on a recipe-level or on an image-level. | perl | Perl warnings check | | | | | x | | | | | | | | | | | | | | x | | x | | | perlcritic | Perl linter | https://metacpan.org/pod/perlcritic | | | | x | | | | | | | | | | | | | | x | | x | | | pkgqaenc | Enhanced package QA | | | | | x | | | | | | | | | | | | | x | | x | | | -| proselint | Spelling and text linter | https://github.com/amperser/proselint/ | | | x | x | | | | | | | | | | x | | | | | | | x | | protolint | Lint protobuf files | https://github.com/yoheimuta/protolint | | | | x | | | | | | | | | | x | | | | x | | | x | | pscan | Find insecure printfs | http://deployingradius.com/pscan/ | | | | x | x | | | | | | | | | | | | | | | x | | | pyfindinjection | Find SQL injections in python code | https://github.com/uber/py-find-injection | | | x | x | | | x | | | | | | | | | | | | x | | | @@ -282,7 +281,6 @@ each tool does have it's own benefits and flaws so don't be mad if you have 10k+ - [perl](docs/conf/module/perl.md) - [perlcritic](docs/conf/module/perlcritic.md) - [pkgqaenc](docs/conf/module/pkgqaenc.md) - - [proselint](docs/conf/module/proselint.md) - [protolint](docs/conf/module/protolint.md) - [pscan](docs/conf/module/pscan.md) - [pyfindinjection](docs/conf/module/pyfindinjection.md) diff --git a/classes/sca-blacklist.bbclass b/classes/sca-blacklist.bbclass index 2f1acc27c7..768e967e51 100644 --- a/classes/sca-blacklist.bbclass +++ b/classes/sca-blacklist.bbclass @@ -38,7 +38,6 @@ SCA_BLACKLIST_mypy ?= "linux-.*" SCA_BLACKLIST_nixauditor ?= "" SCA_BLACKLIST_oclint ?= "linux-.*" SCA_BLACKLIST_oelint ?= "" -SCA_BLACKLIST_proselint ?= "" SCA_BLACKLIST_protolint ?= "" SCA_BLACKLIST_perl ?= "" SCA_BLACKLIST_perlcritic ?= "" diff --git a/classes/sca-global.bbclass b/classes/sca-global.bbclass index 8897861849..60b1d6b876 100644 --- a/classes/sca-global.bbclass +++ b/classes/sca-global.bbclass @@ -122,7 +122,6 @@ SCA_AVAILABLE_MODULES ?= "\ perl \ perlcritic \ pkgqaenc \ - proselint \ protolint \ pscan \ pyfindinjection \ diff --git a/classes/sca-on-image.bbclass b/classes/sca-on-image.bbclass index feadb79091..b7cc189dde 100755 --- a/classes/sca-on-image.bbclass +++ b/classes/sca-on-image.bbclass @@ -26,7 +26,6 @@ SCA_ENABLED_MODULES_IMAGE ?= "\ mypy \ nixauditor \ oelint \ - proselint \ pyfindinjection \ pylint \ reconbf \ diff --git a/classes/sca-on-recipe.bbclass b/classes/sca-on-recipe.bbclass index 4aa3184245..0295003d3c 100755 --- a/classes/sca-on-recipe.bbclass +++ b/classes/sca-on-recipe.bbclass @@ -43,7 +43,6 @@ SCA_ENABLED_MODULES_RECIPE ?= "\ perl \ perlcritic \ pkgqaenc \ - proselint \ protolint \ pscan \ pyfindinjection \ diff --git a/classes/sca-proselint-core.bbclass b/classes/sca-proselint-core.bbclass deleted file mode 100755 index 220c1d389e..0000000000 --- a/classes/sca-proselint-core.bbclass +++ /dev/null @@ -1,120 +0,0 @@ -## SPDX-License-Identifier: BSD-2-Clause -## Copyright (c) 2019, Konrad Weihmann - -SCA_PROSELINT_EXTRA_SUPPRESS ?= "" -SCA_PROSELINT_EXTRA_FATAL ?= "" -SCA_PROSELINT_FILE_FILTER ?= ".txt .md .rst .me" - -SCA_RAW_RESULT_FILE[proselint] = "json" - -inherit sca-conv-to-export -inherit sca-datamodel -inherit sca-global -inherit sca-helper -inherit sca-license-filter -inherit sca-suppress -inherit sca-image-backtrack - -inherit python3native - -DEPENDS += "python3-proselint-native" - -def do_sca_conv_proselint(d): - import os - import json - - package_name = d.getVar("PN") - buildpath = d.getVar("SCA_SOURCES_DIR") - - items = [] - - _suppress = sca_suppress_init(d, "SCA_PROSELINT_EXTRA_SUPPRESS", - d.expand("${STAGING_DATADIR_NATIVE}/proselint-${SCA_MODE}-suppress")) - _findings = [] - - if os.path.exists(sca_raw_result_file(d, "proselint")): - jobj = {} - try: - with open(sca_raw_result_file(d, "proselint")) as f: - jobj = json.load(f) - except Exception as e: - pass - for _file, _vals in jobj.items(): - if "data" in _vals.keys() and "errors" in _vals["data"].keys(): - for item in _vals["data"]["errors"]: - try: - g = sca_get_model_class(d, - PackageName=package_name, - Tool="proselint", - BuildPath=buildpath, - File=_file, - Column=str(item["column"]), - Line=str(item["line"]), - Message=item["message"], - ID=item["check"], - Severity=item["severity"]) - if _suppress.Suppressed(g): - continue - if g.Scope not in clean_split(d, "SCA_SCOPE_FILTER"): - continue - if g.Severity in sca_allowed_warning_level(d): - _findings += sca_backtrack_findings(d, g) - except Exception as exp: - sca_log_note(d, str(exp)) - - sca_add_model_class_list(d, _findings) - return sca_save_model_to_string(d) - -python do_sca_proselint_core() { - import os - import subprocess - import json - - _args = [os.path.join(d.getVar("STAGING_BINDIR_NATIVE"), "proselint")] - _args += ["-j"] - _files = get_files_by_extention(d, d.getVar("SCA_SOURCES_DIR"), d.getVar("SCA_PROSELINT_FILE_FILTER"), - sca_filter_files(d, d.getVar("SCA_SOURCES_DIR"), clean_split(d, "SCA_FILE_FILTER_EXTRA"))) - - json_output = {} - if any(_files): - try: - _ = subprocess.check_output(["proselint", "--clean"], universal_newlines=True) - except subprocess.CalledProcessError as e: - pass - - os.environ["XDG_CACHE_HOME"] = os.path.join(d.getVar("T"), "proselint") - - for _f in _files: - try: - cmd_output = subprocess.check_output(_args + [_f], universal_newlines=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as e: - cmd_output = e.stdout or "" - try: - if not cmd_output.startswith("{"): - cmd_output = cmd_output[cmd_output.find("{"):] - x = json.loads(cmd_output) - json_output[_f] = x - except Exception as e: - bb.note(cmd_output) - sca_log_note(d, str(e)) - - try: - _ = subprocess.check_output(["proselint", "--clean"], universal_newlines=True) - except subprocess.CalledProcessError as e: - pass - - with open(sca_raw_result_file(d, "proselint"), "w") as o: - json.dump(json_output, o) -} - -python do_sca_proselint_core_report() { - import os - ## Create data model - d.setVar("SCA_DATAMODEL_STORAGE", "{}/proselint.dm".format(d.getVar("T"))) - dm_output = do_sca_conv_proselint(d) - with open(d.getVar("SCA_DATAMODEL_STORAGE"), "w") as o: - o.write(dm_output) - - sca_task_aftermath(d, "proselint", get_fatal_entries(d, "SCA_PROSELINT_EXTRA_FATAL", - d.expand("${STAGING_DATADIR_NATIVE}/proselint-${SCA_MODE}-fatal"))) -} diff --git a/classes/sca-proselint-image.bbclass b/classes/sca-proselint-image.bbclass deleted file mode 100755 index 413e59dbec..0000000000 --- a/classes/sca-proselint-image.bbclass +++ /dev/null @@ -1,14 +0,0 @@ -## SPDX-License-Identifier: BSD-2-Clause -## Copyright (c) 2019, Konrad Weihmann - -inherit sca-helper -inherit sca-global -inherit sca-proselint-core -inherit sca-conv-to-export - -do_sca_proselint_core[doc] = "Lint text documents with proselint in image" -do_sca_deploy_proselint_image[doc] = "Deploy results of do_sca_proselint_core" -addtask do_sca_proselint_core before do_image_complete after do_image -addtask do_sca_proselint_core_report after do_sca_proselint_core before do_sca_deploy - -DEPENDS += "sca-image-proselint-rules-native" diff --git a/classes/sca-proselint-recipe.bbclass b/classes/sca-proselint-recipe.bbclass deleted file mode 100755 index 8e4f487df6..0000000000 --- a/classes/sca-proselint-recipe.bbclass +++ /dev/null @@ -1,15 +0,0 @@ -## SPDX-License-Identifier: BSD-2-Clause -## Copyright (c) 2019, Konrad Weihmann - -inherit sca-helper -inherit sca-global -inherit sca-proselint-core -inherit sca-conv-to-export -inherit sca-tracefiles - -do_sca_proselint_core[doc] = "Lint text documents with proselint" -do_sca_proselint_core_report[doc] = "Report findings from do_sca_proselint_core" -addtask do_sca_proselint_core after do_compile before do_sca_tracefiles -addtask do_sca_proselint_core_report after do_sca_tracefiles before do_sca_deploy - -DEPENDS += "sca-recipe-proselint-rules-native" diff --git a/docs/conf/module/proselint.md b/docs/conf/module/proselint.md deleted file mode 100644 index 0996b8128b..0000000000 --- a/docs/conf/module/proselint.md +++ /dev/null @@ -1,61 +0,0 @@ -# Configuration for proselint - -## Supported environments/languages - -* spelling - -## Configuration - -| var | purpose | type | default | -| ------------- |:-------------:| -----:| -----: -| SCA_BLACKLIST_proselint | Blacklist filter for this tool | space-separated-list | "" -| SCA_PROSELINT_EXTRA_FATAL | Extra error-IDs leading to build termination when found | space-separated-list | "" -| SCA_PROSELINT_EXTRA_SUPPRESS | Extra error-IDs to be suppressed | space-separated-list | "" -| SCA_PROSELINT_FILE_FILTER | List of file extensions to check | space-separated-list | ".txt .md .rst .me" - -## Supports - -* [x] suppression of IDs -* [x] terminate build on fatal -* [x] run on recipe -* [x] run on image -* [x] run with SCA-layer default settings (see SCA_AVAILABLE_MODULES) - -## Requires - -* [ ] requires online access - -## Known error-IDs - -__tbd__ - -## Checking scope - -* [ ] security -* [ ] functional defects -* [ ] compliance -* [x] style issues - -## Statistics - -* ⬛⬛⬜⬜⬜⬜⬜⬜⬜⬜ 02/10 Build Speed -* ⬛⬛⬛⬛⬛⬛⬜⬜⬜⬜ 06/10 Execution Speed -* ⬛⬛⬛⬛⬛⬛⬛⬛⬜⬜ 08/10 Quality - -## Score mapping - -### Error considered as security relevant - -* n.a. - -### Error considered as functional defect - -* n.a. - -### Error consired as compliance issue - -* n.a. - -### Error considered as style issue - -* proselint.proselint.* diff --git a/dynamic-distro/scatest/code-from-elsewhere/cspell_2.0.3.bb b/dynamic-distro/scatest/code-from-elsewhere/cspell_2.0.3.bb index 857b79e0e2..78396bab88 100644 --- a/dynamic-distro/scatest/code-from-elsewhere/cspell_2.0.3.bb +++ b/dynamic-distro/scatest/code-from-elsewhere/cspell_2.0.3.bb @@ -12,6 +12,4 @@ S = "${WORKDIR}/git" inherit sca -SCA_BLACKLIST_proselint += "${PN}" - SCA_ENABLED_MODULES = "bitbake" diff --git a/files/module_list.csv b/files/module_list.csv index 7dda4b2872..c70b345966 100644 --- a/files/module_list.csv +++ b/files/module_list.csv @@ -38,7 +38,6 @@ oelint,Bitbake recipe linter,https://github.com/priv-kweihmann/oelint-adv,,,x,x, perl,Perl warnings check,,,,,x,,,,,,,,,,,,,,x,,x, perlcritic,Perl linter,https://metacpan.org/pod/perlcritic,,,,x,,,,,,,,,,,,,,x,,x, pkgqaenc,Enhanced package QA,,,,,x,,,,,,,,,,,,,x,,x,, -proselint,Spelling and text linter,https://github.com/amperser/proselint/,,,x,x,,,,,,,,,,x,,,,,,,x protolint,Lint protobuf files,https://github.com/yoheimuta/protolint,,,,x,,,,,,,,,,x,,,,x,,,x pscan,Find insecure printfs,http://deployingradius.com/pscan/,,,,x,x,,,,,,,,,,,,,,,x, pyfindinjection,Find SQL injections in python code,https://github.com/uber/py-find-injection,,,x,x,,,x,,,,,,,,,,,,x,, diff --git a/recipes-sca-rules/sca-image-proselint-rules-native/files/fatal b/recipes-sca-rules/sca-image-proselint-rules-native/files/fatal deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/recipes-sca-rules/sca-image-proselint-rules-native/files/suppress b/recipes-sca-rules/sca-image-proselint-rules-native/files/suppress deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/recipes-sca-rules/sca-image-proselint-rules-native/sca-image-proselint-rules-native_1.0.bb b/recipes-sca-rules/sca-image-proselint-rules-native/sca-image-proselint-rules-native_1.0.bb deleted file mode 100755 index b13c0971ea..0000000000 --- a/recipes-sca-rules/sca-image-proselint-rules-native/sca-image-proselint-rules-native_1.0.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "SCA ruleset for proselint at images" -DESCRIPTION = "Rules to configure how proselint is affecting the build" - -DEFAULT_PREFERENCE = "${SCA_DEFAULT_PREFERENCE}" -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://${SCA_LAYERDIR}/LICENSE;md5=a4a2bbea1db029f21b3a328c7a059172" - -SRC_URI = "file://suppress \ - file://fatal" - -inherit native - -do_install() { - install -d "${D}${datadir}" - install "${WORKDIR}/suppress" "${D}${datadir}/proselint-image-suppress" - install "${WORKDIR}/fatal" "${D}${datadir}/proselint-image-fatal" -} - -FILES:${PN} = "${datadir}" diff --git a/recipes-sca-rules/sca-recipe-proselint-rules-native/files/fatal b/recipes-sca-rules/sca-recipe-proselint-rules-native/files/fatal deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/recipes-sca-rules/sca-recipe-proselint-rules-native/files/suppress b/recipes-sca-rules/sca-recipe-proselint-rules-native/files/suppress deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/recipes-sca-rules/sca-recipe-proselint-rules-native/sca-recipe-proselint-rules-native_1.0.bb b/recipes-sca-rules/sca-recipe-proselint-rules-native/sca-recipe-proselint-rules-native_1.0.bb deleted file mode 100755 index 3b292eb18c..0000000000 --- a/recipes-sca-rules/sca-recipe-proselint-rules-native/sca-recipe-proselint-rules-native_1.0.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "SCA ruleset for proselint at recipes" -DESCRIPTION = "Rules to configure how proselint is affecting the build" - -DEFAULT_PREFERENCE = "${SCA_DEFAULT_PREFERENCE}" -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://${SCA_LAYERDIR}/LICENSE;md5=a4a2bbea1db029f21b3a328c7a059172" - -SRC_URI = "file://suppress \ - file://fatal" - -inherit native - -do_install() { - install -d "${D}${datadir}" - install "${WORKDIR}/suppress" "${D}${datadir}/proselint-recipe-suppress" - install "${WORKDIR}/fatal" "${D}${datadir}/proselint-recipe-fatal" -} - -FILES:${PN} = "${datadir}" diff --git a/recipes-sca/python3-proselint-native/files/proselint.sca.description b/recipes-sca/python3-proselint-native/files/proselint.sca.description deleted file mode 100644 index eeb5a69d3d..0000000000 --- a/recipes-sca/python3-proselint-native/files/proselint.sca.description +++ /dev/null @@ -1,30 +0,0 @@ -{ - "buildspeed": 2, - "execspeed": 6, - "languages": [ - "spelling" - ], - "uses": [ - "@python" - ], - "quality": 8, - "scope": [ - "style" - ], - "score": { - "style": [ - "proselint.proselint..*" - ] - }, - "test": { - "integration": [ - {"cmd": ["proselint", "--help"], "returncode": 0} - ], - "findings": [ - "busybox" - ], - "no-findings": [ - "bad-bitbake" - ] - } -} \ No newline at end of file diff --git a/recipes-sca/python3-proselint-native/python3-proselint-native_0.10.2.bb b/recipes-sca/python3-proselint-native/python3-proselint-native_0.10.2.bb deleted file mode 100755 index 8104bad1a5..0000000000 --- a/recipes-sca/python3-proselint-native/python3-proselint-native_0.10.2.bb +++ /dev/null @@ -1,25 +0,0 @@ -SUMMARY = "A linter for prose" -HOMEPAGE = "https://github.com/amperser/proselint/" - -DEFAULT_PREFERENCE = "${SCA_DEFAULT_PREFERENCE}" -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://LICENSE.md;md5=64a578e1ca1f25248a8d50f32fdf14e7" - -DEPENDS += "\ - python3-click-native \ - python3-future-native \ - python3-native \ - python3-six-native \ - " - -SRC_URI[md5sum] = "68b800b5df2b98b2759087749eb88660" -SRC_URI[sha256sum] = "3a87eb393056d1bc77d898e4bcf8998f50e9ad84f7b9ff7cf2720509ac8ef904" - -PYPI_PACKAGE = "proselint" - -inherit pypi -inherit sca-description -inherit setuptools3 -inherit native - -SCA_TOOL_DESCRIPTION = "proselint" diff --git a/test/lang_standard_02.txt b/test/lang_standard_02.txt index fd45ede0ce..afebdf9b80 100644 --- a/test/lang_standard_02.txt +++ b/test/lang_standard_02.txt @@ -12,7 +12,6 @@ msgcheck multimetric mypy oelint -proselint pyfindinjection pylint pysymcheck