diff --git a/README.md b/README.md index 254edfcd88..e68e4f300a 100644 --- a/README.md +++ b/README.md @@ -232,7 +232,6 @@ The layer can check on a recipe-level or on an image-level. | slick | Shell script linter | https://github.com/mcandre/slick | | | x | x | | | | x | | | | | | | | | | | | x | | | sparse | C linter | https://sparse.wiki.kernel.org/index.php/Main_Page | | | | x | x | | | | | | | | | | | | | | | x | | | stank | Shell script linter | https://github.com/mcandre/stank | | | x | x | | | | x | | | | | | | | | | | | x | x | -| stylelint | CSS/SCSS linter | https://github.com/stylelint/stylelint | meta-oe, manual enable | | x | x | | | | | | | | | | | | | | x | | | x | | sudokiller | check on sudo | https://github.com/TH3xACE/SUDO_KILLER | | | x | | | | | | | | | x | | | | | | | x | | | | systemdlint | Systemd unit linter | https://github.com/priv-kweihmann/systemdlint | | | x | x | | | | | | | | | | | | | | x | x | x | x | | textlint | Spelling and text linter | https://github.com/textlint/textlint | meta-oe, manual enable | x | | x | | | | | | | | | | x | | | | | | | x | @@ -319,7 +318,6 @@ each tool does have it's own benefits and flaws so don't be mad if you have 10k+ - [slick](docs/conf/module/slick.md) - [sparse](docs/conf/module/sparse.md) - [stank](docs/conf/module/stank.md) - - [stylelint](docs/conf/module/stylelint.md) - [sudokiller](docs/conf/module/sudokiller.md) - [systemdlint](docs/conf/module/systemdlint.md) - [textlint](docs/conf/module/textlint.md) diff --git a/classes/sca-blacklist.bbclass b/classes/sca-blacklist.bbclass index dc21bff694..fd9f1d6680 100644 --- a/classes/sca-blacklist.bbclass +++ b/classes/sca-blacklist.bbclass @@ -60,7 +60,6 @@ SCA_BLACKLIST_shellcheck ?= "" SCA_BLACKLIST_slick ?= "openssh" SCA_BLACKLIST_sparse ?= "" SCA_BLACKLIST_stank ?= "openssh" -SCA_BLACKLIST_stylelint ?= "linux-.*" SCA_BLACKLIST_sudokiller ?= "" SCA_BLACKLIST_systemdlint ?= "" SCA_BLACKLIST_textlint ?= "busybox.*" diff --git a/classes/sca-global.bbclass b/classes/sca-global.bbclass index d2df19e1fb..87ac1ea500 100644 --- a/classes/sca-global.bbclass +++ b/classes/sca-global.bbclass @@ -151,7 +151,6 @@ SCA_AVAILABLE_MODULES ?= "\ " # additional layer requirements SCA_AVAILABLE_MODULES[inspec] = "openembedded-layer rubygems" -SCA_AVAILABLE_MODULES[stylelint] = "openembedded-layer" SCA_AVAILABLE_MODULES[textlint] = "openembedded-layer" SCA_AVAILABLE_MODULES[wotan] = "openembedded-layer" diff --git a/classes/sca-on-image.bbclass b/classes/sca-on-image.bbclass index 915c7d2253..aa1caf507a 100755 --- a/classes/sca-on-image.bbclass +++ b/classes/sca-on-image.bbclass @@ -34,7 +34,6 @@ SCA_ENABLED_MODULES_IMAGE ?= "\ shellcheck \ slick \ stank \ - stylelint \ sudokiller \ systemdlint \ tiger \ diff --git a/classes/sca-on-recipe.bbclass b/classes/sca-on-recipe.bbclass index ab77dfe91d..679d20faa0 100755 --- a/classes/sca-on-recipe.bbclass +++ b/classes/sca-on-recipe.bbclass @@ -60,7 +60,6 @@ SCA_ENABLED_MODULES_RECIPE ?= "\ slick \ sparse \ stank \ - stylelint \ systemdlint \ textlint \ tlv \ diff --git a/classes/sca-stylelint-core.bbclass b/classes/sca-stylelint-core.bbclass deleted file mode 100755 index 5a6af3d3a7..0000000000 --- a/classes/sca-stylelint-core.bbclass +++ /dev/null @@ -1,104 +0,0 @@ -## SPDX-License-Identifier: BSD-2-Clause -## Copyright (c) 2019, Konrad Weihmann - -## Set the config file to be used - the files must be placed at ${STAGING_DATADIR_NATIVE}/stylelint/configs -## See stylelint-native recipe for details -SCA_STYLELINT_EXTRA_SUPPRESS ?= "" -SCA_STYLELINT_EXTRA_FATAL ?= "" -SCA_STYLELINT_CONFIG ?= "stylelint-config-standard" -SCA_STYLELINT_FILE_FILTER ?= ".css .scss .html .htm" - -SCA_RAW_RESULT_FILE[stylelint] = "txt" - -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 - -DEPENDS += "stylelint-native" - -def do_sca_conv_stylelint(d): - import os - import re - - package_name = d.getVar("PN") - buildpath = d.getVar("SCA_SOURCES_DIR") - - pattern = r"^(?P.*):(?P\d+):(?P\d+):\s+(?P.*)\s+\((?P.*)\)\s+\[(?P.*)\]" - - severity_map = { - "error" : "error", - "warning" : "warning", - "info": "info" - } - - _suppress = sca_suppress_init(d, "SCA_STYLELINT_EXTRA_SUPPRESS", - d.expand("${STAGING_DATADIR_NATIVE}/stylelint-${SCA_MODE}-suppress")) - _findings = [] - - if os.path.exists(sca_raw_result_file(d, "stylelint")): - with open(sca_raw_result_file(d, "stylelint"), "r") as f: - for m in re.finditer(pattern, f.read(), re.MULTILINE): - try: - g = sca_get_model_class(d, - PackageName=package_name, - Tool="stylelint", - BuildPath=buildpath, - File=m.group("file"), - Column=m.group("col"), - Line=m.group("line"), - Message=m.group("msg"), - ID=m.group("id"), - Severity=severity_map[m.group("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_stylelint_core() { - import os - import subprocess - import json - - _config = { - "extends": os.path.join(d.getVar("STAGING_LIBDIR_NATIVE"), "node_modules", d.getVar("SCA_STYLELINT_CONFIG")) - } - - with open(os.path.join(d.getVar("T"), "stylelintrc"), "w") as o: - json.dump(_config, o) - - _args = ["stylelint"] - _args += ["-f", "unix"] - _args += ["--quiet"] - _args += ["--config", os.path.join(d.getVar("T"), "stylelintrc")] - _args += ["--no-color"] - - _files = get_files_by_extention(d, d.getVar("SCA_SOURCES_DIR"), d.getVar("SCA_STYLELINT_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, "stylelint"), "w") as o: - o.write(cmd_output) -} - -python do_sca_stylelint_core_report() { - import os - ## Create data model - d.setVar("SCA_DATAMODEL_STORAGE", "{}/stylelint.dm".format(d.getVar("T"))) - dm_output = do_sca_conv_stylelint(d) - with open(d.getVar("SCA_DATAMODEL_STORAGE"), "w") as o: - o.write(dm_output) - - sca_task_aftermath(d, "stylelint", get_fatal_entries(d, "SCA_STYLELINT_EXTRA_FATAL", - d.expand("${STAGING_DATADIR_NATIVE}/stylelint-${SCA_MODE}-fatal"))) -} diff --git a/classes/sca-stylelint-image.bbclass b/classes/sca-stylelint-image.bbclass deleted file mode 100755 index 4216676bd8..0000000000 --- a/classes/sca-stylelint-image.bbclass +++ /dev/null @@ -1,13 +0,0 @@ -## SPDX-License-Identifier: BSD-2-Clause -## Copyright (c) 2019, Konrad Weihmann - -inherit sca-helper -inherit sca-global -inherit sca-stylelint-core - -do_sca_stylelint_core[doc] = "Lint s/css files with stylelint in image" -do_sca_stylelint_core_report[doc] = "Report findings from do_sca_stylelint_core" -addtask do_sca_stylelint_core before do_image_complete after do_image -addtask do_sca_stylelint_core_report after do_sca_stylelint_core before do_sca_deploy - -DEPENDS += "sca-image-stylelint-rules-native" diff --git a/classes/sca-stylelint-recipe.bbclass b/classes/sca-stylelint-recipe.bbclass deleted file mode 100755 index f14d5d7677..0000000000 --- a/classes/sca-stylelint-recipe.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-stylelint-core -inherit sca-tracefiles - -do_sca_stylelint_core[doc] = "Lint s/css files with stylelint" -do_sca_stylelint_core_report[doc] = "Report findings from do_sca_stylelint_core" -addtask do_sca_stylelint_core after do_compile before do_sca_tracefiles -addtask do_sca_stylelint_core_report after do_sca_tracefiles before do_sca_deploy - -DEPENDS += "sca-recipe-stylelint-rules-native" diff --git a/docs/conf/examples/img_complete.md b/docs/conf/examples/img_complete.md index 237960dad6..e94036c185 100644 --- a/docs/conf/examples/img_complete.md +++ b/docs/conf/examples/img_complete.md @@ -36,7 +36,6 @@ SCA_ENABLED_MODULES_IMAGE = "\ pyfindinjection \ pylint \ shellcheck \ - stylelint \ systemdlint \ tiger \ upc \ @@ -71,7 +70,6 @@ SCA_ENABLED_MODULES_RECIPE = "\ safety \ shellcheck \ sparse \ - stylelint \ tscancode \ vulture \ xmllint \ diff --git a/docs/conf/examples/web_inflight.md b/docs/conf/examples/web_inflight.md index c7e5216708..768720b5d6 100644 --- a/docs/conf/examples/web_inflight.md +++ b/docs/conf/examples/web_inflight.md @@ -25,7 +25,6 @@ SCA_SCOPE_FILTER = "security functional style" SCA_ENABLED_MODULES_RECIPE = "\ flake8 \ jsonlint \ - stylelint \ " ``` diff --git a/docs/conf/module/stylelint.md b/docs/conf/module/stylelint.md deleted file mode 100644 index 9a5fcb6fb2..0000000000 --- a/docs/conf/module/stylelint.md +++ /dev/null @@ -1,63 +0,0 @@ -# Configuration for stylelint - -## Supported environments/languages - -* CSS -* SCSS - -## Configuration - -| var | purpose | type | default | -| ------------- |:-------------:| -----:| -----: -| SCA_BLACKLIST_stylelint | Blacklist filter for this tool | space-separated-list | "" -| SCA_STYLELINT_CONFIG | Config to use | 'stylelint-config-standard' or 'stylelint-config-recommended' | "stylelint-config-standard" -| SCA_STYLELINT_EXTRA_FATAL | Extra error-IDs leading to build termination when found | space-separated-list | "": -| SCA_STYLELINT_EXTRA_SUPPRESS | Extra error-IDs to be suppressed | space-separated-list | "" -| SCA_STYLELINT_FILE_FILTER | Files to scan | space-separated-list | ".css .scss .html .htm" - -## Supports - -* [x] suppression of IDs -* [x] terminate build on fatal -* [x] run on recipe -* [x] run on image -* [ ] 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 - -* ⬛⬛⬛⬛⬜⬜⬜⬜⬜⬜ 04/10 Build Speed -* ⬛⬛⬛⬛⬛⬛⬛⬛⬛⬛ 10/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 - -* stylelint.stylelint.* diff --git a/dynamic-distro/scatest/code-from-elsewhere/bad-css.bb b/dynamic-distro/scatest/code-from-elsewhere/bad-css.bb deleted file mode 100644 index 020c33ac20..0000000000 --- a/dynamic-distro/scatest/code-from-elsewhere/bad-css.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "Bad css testcode" -DEFAULT_PREFERENCE = "${SCA_DEFAULT_PREFERENCE}" -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://${SCA_LAYERDIR}/LICENSE;md5=a4a2bbea1db029f21b3a328c7a059172" - -SRC_URI = "file://1.css;subdir=source" - -S = "${WORKDIR}/source" -B = "${WORKDIR}/source" - -SCA_SCORE_SECURITY_ERROR = "0" -SCA_SCORE_FUNCTIONAL_ERROR = "0" -SCA_SCORE_STYLE_ERROR = "0" -inherit sca diff --git a/dynamic-distro/scatest/code-from-elsewhere/bad-css/1.css b/dynamic-distro/scatest/code-from-elsewhere/bad-css/1.css deleted file mode 100644 index ed913e55dd..0000000000 --- a/dynamic-distro/scatest/code-from-elsewhere/bad-css/1.css +++ /dev/null @@ -1,17 +0,0 @@ -a { @extend placeholder; } -a {} @media {} -@Charset 'UTF-8'; -a { color: #000; } -a {} -/* comment */ -/**/ -/*comment*/ -/* TODO: */ -@custom-media --bar (min-width: 30em); -a { - & .foo { /* 1 */ - &__foo { /* 2 */ - & > .bar {} /* 3 */ - } - } -} \ No newline at end of file diff --git a/dynamic-distro/scatest/code-from-elsewhere/bad-css/ORIGIN.txt b/dynamic-distro/scatest/code-from-elsewhere/bad-css/ORIGIN.txt deleted file mode 100644 index d8674da712..0000000000 --- a/dynamic-distro/scatest/code-from-elsewhere/bad-css/ORIGIN.txt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/stylelint/stylelint/blob/master/system-tests/fix/stylesheet.css \ No newline at end of file diff --git a/files/module_list.csv b/files/module_list.csv index 5b222fdde0..0123b5ceb3 100644 --- a/files/module_list.csv +++ b/files/module_list.csv @@ -57,7 +57,6 @@ shellcheck,Shell script linter,https://github.com/koalaman/shellcheck,,,x,x,,,,x slick,Shell script linter,https://github.com/mcandre/slick,,,x,x,,,,x,,,,,,,,,,,,x, sparse,C linter,https://sparse.wiki.kernel.org/index.php/Main_Page,,,,x,x,,,,,,,,,,,,,,,x, stank,Shell script linter,https://github.com/mcandre/stank,,,x,x,,,,x,,,,,,,,,,,,x,x -stylelint,CSS/SCSS linter,https://github.com/stylelint/stylelint,"meta-oe, manual enable",,x,x,,,,,,,,,,,,,,x,,,x sudokiller,check on sudo,https://github.com/TH3xACE/SUDO_KILLER,,,x,,,,,,,,,x,,,,,,,x,, systemdlint,Systemd unit linter,https://github.com/priv-kweihmann/systemdlint,,,x,x,,,,,,,,,,,,,,x,x,x,x textlint,Spelling and text linter,https://github.com/textlint/textlint,"meta-oe, manual enable",x,,x,,,,,,,,,,x,,,,,,,x diff --git a/recipes-sca-rules/sca-image-stylelint-rules-native/files/fatal b/recipes-sca-rules/sca-image-stylelint-rules-native/files/fatal deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/recipes-sca-rules/sca-image-stylelint-rules-native/files/suppress b/recipes-sca-rules/sca-image-stylelint-rules-native/files/suppress deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/recipes-sca-rules/sca-image-stylelint-rules-native/sca-image-stylelint-rules-native_1.0.bb b/recipes-sca-rules/sca-image-stylelint-rules-native/sca-image-stylelint-rules-native_1.0.bb deleted file mode 100755 index c2a29243d0..0000000000 --- a/recipes-sca-rules/sca-image-stylelint-rules-native/sca-image-stylelint-rules-native_1.0.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "SCA ruleset for stylelint at images" -DESCRIPTION = "Rules to configure how stylelint 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}/stylelint-image-suppress" - install "${WORKDIR}/fatal" "${D}${datadir}/stylelint-image-fatal" -} - -FILES:${PN} = "${datadir}" diff --git a/recipes-sca-rules/sca-recipe-stylelint-rules-native/files/fatal b/recipes-sca-rules/sca-recipe-stylelint-rules-native/files/fatal deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/recipes-sca-rules/sca-recipe-stylelint-rules-native/files/suppress b/recipes-sca-rules/sca-recipe-stylelint-rules-native/files/suppress deleted file mode 100755 index e69de29bb2..0000000000 diff --git a/recipes-sca-rules/sca-recipe-stylelint-rules-native/sca-recipe-stylelint-rules-native_1.0.bb b/recipes-sca-rules/sca-recipe-stylelint-rules-native/sca-recipe-stylelint-rules-native_1.0.bb deleted file mode 100755 index 3028dcd251..0000000000 --- a/recipes-sca-rules/sca-recipe-stylelint-rules-native/sca-recipe-stylelint-rules-native_1.0.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "SCA ruleset for stylelint at recipes" -DESCRIPTION = "Rules to configure how stylelint 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}/stylelint-recipe-suppress" - install "${WORKDIR}/fatal" "${D}${datadir}/stylelint-recipe-fatal" -} - -FILES:${PN} = "${datadir}" diff --git a/recipes-sca/stylelint-native/files/stylelint.sca.description b/recipes-sca/stylelint-native/files/stylelint.sca.description deleted file mode 100644 index 717ed724ab..0000000000 --- a/recipes-sca/stylelint-native/files/stylelint.sca.description +++ /dev/null @@ -1,31 +0,0 @@ -{ - "buildspeed": 4, - "execspeed": 10, - "languages": [ - "css", - "scss" - ], - "uses": [ - "@npm" - ], - "quality": 8, - "scope": [ - "style" - ], - "score": { - "style": [ - "stylelint.stylelint..*" - ] - }, - "test": { - "integration": [ - {"cmd": ["stylelint", "--help"], "returncode": 0} - ], - "findings": [ - "bad-css" - ], - "no-findings": [ - "bad-go" - ] - } -} \ No newline at end of file diff --git a/recipes-sca/stylelint-native/stylelint-native_1.0.bb b/recipes-sca/stylelint-native/stylelint-native_1.0.bb deleted file mode 100644 index 0f0db9dcd8..0000000000 --- a/recipes-sca/stylelint-native/stylelint-native_1.0.bb +++ /dev/null @@ -1,15 +0,0 @@ -SUMMARY = "sca definition for stylelint" - -DEFAULT_PREFERENCE = "${SCA_DEFAULT_PREFERENCE}" -LICENSE = "BSD-2-Clause" -LIC_FILES_CHKSUM = "file://${SCA_LAYERDIR}/LICENSE;md5=a4a2bbea1db029f21b3a328c7a059172" - -DEPENDS += "\ - npm-stylelint-native \ - npm-stylelint-config-standard-native \ - " - -inherit sca-description -inherit native - -SCA_TOOL_DESCRIPTION = "stylelint" diff --git a/test/lang_metaoe.txt b/test/lang_metaoe.txt index f792cacbc6..4da6f85201 100644 --- a/test/lang_metaoe.txt +++ b/test/lang_metaoe.txt @@ -1,3 +1,2 @@ -stylelint textlint wotan \ No newline at end of file