From 3cdb5207c53bb70724ba63552b1be3a0c9d2a624 Mon Sep 17 00:00:00 2001 From: Konrad Weihmann Date: Mon, 25 Apr 2022 18:25:36 +0200 Subject: [PATCH] remove goconsistent module Relates to #8749 Signed-off-by: Konrad Weihmann --- README.md | 2 - classes/sca-blacklist.bbclass | 1 - classes/sca-global.bbclass | 1 - classes/sca-goconsistent.bbclass | 98 ------------------- classes/sca-on-recipe.bbclass | 1 - docs/conf/module/goconsistent.md | 61 ------------ files/module_list.csv | 1 - .../files/fatal | 0 .../files/suppress | 0 ...ca-recipe-goconsistent-rules-native_1.0.bb | 19 ---- .../files/goconsistent.sca.description | 33 ------- .../goconsistent-sca-native_1.0.bb | 12 --- test/lang_standard_01.txt | 1 - 13 files changed, 230 deletions(-) delete mode 100755 classes/sca-goconsistent.bbclass delete mode 100644 docs/conf/module/goconsistent.md delete mode 100755 recipes-sca-rules/sca-recipe-goconsistent-rules-native/files/fatal delete mode 100755 recipes-sca-rules/sca-recipe-goconsistent-rules-native/files/suppress delete mode 100755 recipes-sca-rules/sca-recipe-goconsistent-rules-native/sca-recipe-goconsistent-rules-native_1.0.bb delete mode 100644 recipes-sca/goconsistent-sca-native/files/goconsistent.sca.description delete mode 100755 recipes-sca/goconsistent-sca-native/goconsistent-sca-native_1.0.bb diff --git a/README.md b/README.md index 2e29c2223b..f191fead58 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,6 @@ The layer can check on a recipe-level or on an image-level. | flawfinder | C/C++ security linter | https://github.com/david-a-wheeler/flawfinder | | | | x | x | x | | | | | | | | | | | | | x | | | | flint | C/C++ linter | https://github.com/JossWhittle/FlintPlusPlus | | | | x | x | x | | | | | | | | | | | | | | x | | | gcc | GCC compiler issues and hardening | | | | | x | x | x | | | | | | | | | | | | | x | x | | -| goconsistent | make your Go programs more consistent | https://github.com/quasilyte/go-consistent | | | | x | | | | | | | x | | | | | | | | | | x | | golicensecheck | Scan code for license information | https://github.com/go-enry/go-license-detector | | | | x | | | | | | | | | | | | | | x | x | | | | golint | GO linter | https://github.com/golang/lint | | | | x | | | | | | | x | | | | | | | | | | x | | image-summary | Aggregate all findings for package in an image | | | | x | | | | | | | | | | | | | | x | | x | x | x | @@ -259,7 +258,6 @@ each tool does have it's own benefits and flaws so don't be mad if you have 10k+ - [flawfinder](docs/conf/module/flawfinder.md) - [flint++](docs/conf/module/flint++.md) - [gcc](docs/conf/module/gcc.md) - - [goconsistent](docs/conf/module/goconsistent.md) - [golicensecheck](docs/conf/module/golicensecheck.md) - [golint](docs/conf/module/golint.md) - [it](docs/conf/module/it.md) diff --git a/classes/sca-blacklist.bbclass b/classes/sca-blacklist.bbclass index 9983670bde..69e1dc430a 100644 --- a/classes/sca-blacklist.bbclass +++ b/classes/sca-blacklist.bbclass @@ -20,7 +20,6 @@ SCA_BLACKLIST_flake8 ?= "" SCA_BLACKLIST_flawfinder ?= "" SCA_BLACKLIST_flint ?= "linux-.*" SCA_BLACKLIST_gcc ?= "" -SCA_BLACKLIST_goconsistent ?= "openssh" SCA_BLACKLIST_golicensecheck ?= "" SCA_BLACKLIST_golint ?= "openssh" SCA_BLACKLIST_it ?= "" diff --git a/classes/sca-global.bbclass b/classes/sca-global.bbclass index d46c824311..7ce4f09c17 100644 --- a/classes/sca-global.bbclass +++ b/classes/sca-global.bbclass @@ -104,7 +104,6 @@ SCA_AVAILABLE_MODULES ?= "\ flawfinder \ flint \ gcc \ - goconsistent \ golicensecheck \ golint \ it \ diff --git a/classes/sca-goconsistent.bbclass b/classes/sca-goconsistent.bbclass deleted file mode 100755 index 4007d04829..0000000000 --- a/classes/sca-goconsistent.bbclass +++ /dev/null @@ -1,98 +0,0 @@ -## SPDX-License-Identifier: BSD-2-Clause -## Copyright (c) 2021, Konrad Weihmann - -## Add ids to suppress on a recipe level -SCA_GOCONSISTENT_EXTRA_SUPPRESS ?= "" -## Add ids to lead to a fatal on a recipe level -SCA_GOCONSISTENT_EXTRA_FATAL ?= "" - -SCA_RAW_RESULT_FILE[goconsistent] = "txt" - -inherit sca-conv-to-export -inherit sca-datamodel -inherit sca-global -inherit sca-helper -inherit sca-suppress -inherit sca-image-backtrack -inherit sca-tracefiles - -def do_sca_conv_goconsistent(d): - import os - import re - import hashlib - - package_name = d.getVar("PN") - buildpath = d.getVar("SCA_SOURCES_DIR") - - items = [] - pattern = r"^(?P.*):(?P\d+):(?P\d+):\s*(?P.*)" - - _excludes = sca_filter_files(d, d.getVar("SCA_SOURCES_DIR"), clean_split(d, "SCA_FILE_FILTER_EXTRA")) - - _suppress = sca_suppress_init(d, "SCA_GOCONSISTENT_EXTRA_SUPPRESS", - d.expand("${STAGING_DATADIR_NATIVE}/goconsistent-${SCA_MODE}-suppress")) - _findings = [] - - if os.path.exists(sca_raw_result_file(d, "goconsistent")): - with open(sca_raw_result_file(d, "goconsistent"), "r") as f: - content = f.read() - for m in re.finditer(pattern, content, re.MULTILINE): - if m.group("file") in _excludes or not m.group("file").startswith(buildpath): - continue - try: - g = sca_get_model_class(d, - PackageName=package_name, - Tool="goconsistent", - BuildPath=buildpath, - File=m.group("file"), - Column=m.group("col"), - Line=m.group("line"), - Message=m.group("msg"), - ID=hashlib.md5(str.encode(m.group("msg"))).hexdigest(), - Severity="warning") - 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 e: - sca_log_note(d, str(e)) - sca_add_model_class_list(d, _findings) - return sca_save_model_to_string(d) - -python do_sca_goconsistent() { - import os - import subprocess - - _args = ["go-consistent", "-pedantic"] - - _files = get_files_by_extention(d, - d.getVar("SCA_SOURCES_DIR"), - clean_split(d, "SCA_GOCONSISTENT_FILE_FILTER"), - sca_filter_files(d, d.getVar("SCA_SOURCES_DIR"), clean_split(d, "SCA_FILE_FILTER_EXTRA"))) - - cmd_output = exec_wrap_check_output(d, _args, _files) - - with open(sca_raw_result_file(d, "goconsistent"), "w") as o: - o.write(cmd_output) -} - -python do_sca_goconsistent_report() { - import os - ## Create data model - d.setVar("SCA_DATAMODEL_STORAGE", "{}/goconsistent.dm".format(d.getVar("T"))) - dm_output = do_sca_conv_goconsistent(d) - with open(d.getVar("SCA_DATAMODEL_STORAGE"), "w") as o: - o.write(dm_output) - - sca_task_aftermath(d, "goconsistent", get_fatal_entries(d, "SCA_GOCONSISTENT_EXTRA_FATAL", - d.expand("${STAGING_DATADIR_NATIVE}/goconsistent-${SCA_MODE}-fatal"))) -} - -do_sca_goconsistent[doc] = "Lint go files with goconsistent" -do_sca_goconsistent_report[doc] = "Report findings of do_sca_goconsistent" -addtask do_sca_goconsistent after do_configure before do_sca_tracefiles -addtask do_sca_goconsistent_report after do_sca_tracefiles before do_sca_deploy - -DEPENDS += "goconsistent-sca-native sca-recipe-goconsistent-rules-native" diff --git a/classes/sca-on-recipe.bbclass b/classes/sca-on-recipe.bbclass index d0be46df15..af2d34a44d 100755 --- a/classes/sca-on-recipe.bbclass +++ b/classes/sca-on-recipe.bbclass @@ -26,7 +26,6 @@ SCA_ENABLED_MODULES_RECIPE ?= "\ flawfinder \ flint \ gcc \ - goconsistent \ golicensecheck \ golint \ it \ diff --git a/docs/conf/module/goconsistent.md b/docs/conf/module/goconsistent.md deleted file mode 100644 index 7c76ed9a6f..0000000000 --- a/docs/conf/module/goconsistent.md +++ /dev/null @@ -1,61 +0,0 @@ -# Configuration for goconsistent - -## Supported environments/languages - -* GO - -## Configuration - -| var | purpose | type | default | -| ------------- |:-------------:| -----:| -----: -| SCA_BLACKLIST_goconsistent | Blacklist filter for this tool | space-separated-list | "linux-*" -| SCA_GOCONSISTENT_EXTRA_FATAL | Extra error-IDs leading to build termination when found | space-separated-list | "" -| SCA_GOCONSISTENT_EXTRA_SUPPRESS | Extra error-IDs to be suppressed | space-separated-list | "" -| SCA_GOCONSISTENT_EXTRA_ARGS | Additional arguments for goconsistent | space-separated-list | "-numbers" - -## Supports - -* [x] suppression of IDs -* [x] terminate build on fatal -* [x] run on recipe -* [ ] 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 - -* ⬛⬛⬛⬛⬛⬛⬛⬛⬜⬜ 08/10 Build Speed -* ⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛ 10/10 Execution Speed -* ⬛⬛⬛⬛⬛⬛⬛⬛⬛⬜ 09/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 - -* goconsistent.goconsistent.* diff --git a/files/module_list.csv b/files/module_list.csv index 73a532dc64..37c89ea6e1 100644 --- a/files/module_list.csv +++ b/files/module_list.csv @@ -17,7 +17,6 @@ flake8,Python linter,http://flake8.pycqa.org/en/latest/,,,x,x,,,x,,,,,,,,,,,,,x, flawfinder,C/C++ security linter,https://github.com/david-a-wheeler/flawfinder,,,,x,x,x,,,,,,,,,,,,,x,, flint,C/C++ linter,https://github.com/JossWhittle/FlintPlusPlus,,,,x,x,x,,,,,,,,,,,,,,x, gcc,GCC compiler issues and hardening,,,,,x,x,x,,,,,,,,,,,,,x,x, -goconsistent,Source code analyzer that helps you to make your Go programs more consistent,https://github.com/quasilyte/go-consistent,,,,x,,,,,,,x,,,,,,,,,,x golicensecheck,Scan code for license information,https://github.com/go-enry/go-license-detector,,,,x,,,,,,,,,,,,,,x,x,, golint,GO linter,https://github.com/golang/lint,,,,x,,,,,,,x,,,,,,,,,,x image-summary,Aggregate all findings for package in an image,,,,x,,,,,,,,,,,,,,x,,x,x,x diff --git a/recipes-sca-rules/sca-recipe-goconsistent-rules-native/files/fatal b/recipes-sca-rules/sca-recipe-goconsistent-rules-native/files/fatal deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/recipes-sca-rules/sca-recipe-goconsistent-rules-native/files/suppress b/recipes-sca-rules/sca-recipe-goconsistent-rules-native/files/suppress deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/recipes-sca-rules/sca-recipe-goconsistent-rules-native/sca-recipe-goconsistent-rules-native_1.0.bb b/recipes-sca-rules/sca-recipe-goconsistent-rules-native/sca-recipe-goconsistent-rules-native_1.0.bb deleted file mode 100755 index 97d19f72ef..0000000000 --- a/recipes-sca-rules/sca-recipe-goconsistent-rules-native/sca-recipe-goconsistent-rules-native_1.0.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "SCA ruleset for goconsistent at recipes" -DESCRIPTION = "Rules to configure how goconsistent 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}/fatal" "${D}${datadir}/goconsistent-recipe-fatal" - install "${WORKDIR}/suppress" "${D}${datadir}/goconsistent-recipe-suppress" -} - -FILES:${PN} = "${datadir}" diff --git a/recipes-sca/goconsistent-sca-native/files/goconsistent.sca.description b/recipes-sca/goconsistent-sca-native/files/goconsistent.sca.description deleted file mode 100644 index 0bb87c6a26..0000000000 --- a/recipes-sca/goconsistent-sca-native/files/goconsistent.sca.description +++ /dev/null @@ -1,33 +0,0 @@ -{ - "buildspeed": 8, - "execspeed": 10, - "languages": [ - "go" - ], - "uses": [ - "@go" - ], - "quality": 9, - "scope": [ - "style" - ], - "score": { - "style": [ - "goconsistent.goconsistent..*" - ] - }, - "test": { - "integration": [ - {"cmd": ["go-consistent", "--help"], "returncode": 2} - ], - "findings": [ - "bad-go" - ], - "no-findings": [ - "busybox" - ], - "additional-targets": [ - "github.com-quasilyte-go-consistent-native" - ] - } -} \ No newline at end of file diff --git a/recipes-sca/goconsistent-sca-native/goconsistent-sca-native_1.0.bb b/recipes-sca/goconsistent-sca-native/goconsistent-sca-native_1.0.bb deleted file mode 100755 index ccf34c3616..0000000000 --- a/recipes-sca/goconsistent-sca-native/goconsistent-sca-native_1.0.bb +++ /dev/null @@ -1,12 +0,0 @@ -SUMMARY = "SCA description for goconsistent" - -DEFAULT_PREFERENCE = "${SCA_DEFAULT_PREFERENCE}" -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://${SCA_LAYERDIR}/LICENSE;md5=a4a2bbea1db029f21b3a328c7a059172" - -DEPENDS += "github.com-quasilyte-go-consistent-native" - -inherit sca-description -inherit native - -SCA_TOOL_DESCRIPTION = "goconsistent" diff --git a/test/lang_standard_01.txt b/test/lang_standard_01.txt index 833e528023..7dbc264efc 100644 --- a/test/lang_standard_01.txt +++ b/test/lang_standard_01.txt @@ -7,7 +7,6 @@ cpplint flawfinder flint gcc -goconsistent golicensecheck golint kconfighard