From b3ef6abfe8dbe8f07659b0ffef4b0f3018f1f3d8 Mon Sep 17 00:00:00 2001 From: nvuillam Date: Tue, 22 Nov 2022 00:29:52 +0100 Subject: [PATCH 1/6] Use relative file paths to call linters File filtering management with relative paths Fix workspace Manage relative paths of files in sub directories mypy fix Manage file_sub_directory with relative files [MegaLinter] Apply linters fixes Temporary increase timeout of build dev job Fix filter test classes Add test case file temp disable test sarif output quick build flake8 fix [MegaLinter] Apply linters fixes --- .automation/test/pre-post-test/README.md | 3 ++ .github/workflows/deploy-DEV.yml | 4 +-- CHANGELOG.md | 1 + megalinter/Linter.py | 14 ++++---- megalinter/MegaLinter.py | 12 ++++--- .../tests/test_megalinter/filters_test.py | 32 ++++++++----------- .../mega_linter_3_sarif_test.py | 1 + megalinter/utils.py | 31 +++++++++--------- 8 files changed, 51 insertions(+), 47 deletions(-) create mode 100644 .automation/test/pre-post-test/README.md diff --git a/.automation/test/pre-post-test/README.md b/.automation/test/pre-post-test/README.md new file mode 100644 index 00000000000..f15dcfcef4c --- /dev/null +++ b/.automation/test/pre-post-test/README.md @@ -0,0 +1,3 @@ +# Hello + +World diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 8e0576411d6..be9e44ce6c4 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -40,7 +40,7 @@ jobs: # Prevent duplicate run from happening when a forked push is committed if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, 'skip deploy') # Set max build time for the job - timeout-minutes: 90 + timeout-minutes: 120 ################## # Load all steps # ################## @@ -167,7 +167,7 @@ jobs: fi fi docker run $CI_ENV -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=text -e OUTPUT_FOLDER=${GITHUB_SHA} -e OUTPUT_DETAIL=detailed -e GITHUB_SHA=${GITHUB_SHA} -e PAT="${{secrets.PAT}}" -e TEST_KEYWORDS="${TEST_KEYWORDS_TO_USE}" -e MEGALINTER_VOLUME_ROOT="${GITHUB_WORKSPACE}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{steps.image_tag.outputs.tag}} - timeout-minutes: 60 + timeout-minutes: 90 ##################################### # Run Linter against ALL code base # diff --git a/CHANGELOG.md b/CHANGELOG.md index 757a666ddf8..d1c599ab2e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-linter.yml file, or with `oxsecurity/megalinter:beta` docker image +- Core: Use relative file paths to call linters ([#1875](https://github.com/oxsecurity/megalinter/issues/1875)) - Initial Drone CI documentation - Automatically generate "Used by" markdown documentation with [github-dependents-info](https://github.com/nvuillam/github-dependents-info) - Add Docker container documentation diff --git a/megalinter/Linter.py b/megalinter/Linter.py index e7d1cae0dc4..90b39378be1 100644 --- a/megalinter/Linter.py +++ b/megalinter/Linter.py @@ -481,6 +481,11 @@ def load_config_vars(self, params): self.config_file = ( self.default_rules_location + os.path.sep + self.config_file_name ) + # Make config file path absolute if not located in workspace + if self.config_file is not None and not os.path.isfile( + self.workspace + os.path.sep + self.config_file + ): + self.config_file = os.path.abspath(self.config_file) # Set config file label if not set by remote rule if self.config_file is not None and self.config_file_label is None: self.config_file_label = self.config_file.replace( @@ -783,7 +788,7 @@ def collect_files(self, all_files): file_contains_regex=self.file_contains_regex, files_sub_directory=self.files_sub_directory, lint_all_other_linters_files=self.lint_all_other_linters_files, - prefix=self.workspace, + workspace=self.workspace, ) self.files_number = len(self.files) logging.debug( @@ -810,12 +815,7 @@ def process_linter(self, file=None): # Execute a linting command . Can be overridden for special cases, like use of PowerShell script # noinspection PyMethodMayBeStatic def execute_lint_command(self, command): - cwd = ( - os.getcwd() - if self.cli_lint_mode in ["file", "list_of_files"] - else self.workspace - ) - cwd = os.path.abspath(cwd) + cwd = os.path.abspath(self.workspace) logging.debug(f"[{self.linter_name}] CWD: {cwd}") subprocess_env = {**os.environ, "FORCE_COLOR": "0"} if type(command) == str: diff --git a/megalinter/MegaLinter.py b/megalinter/MegaLinter.py index b07365b537c..bac6245dc0d 100644 --- a/megalinter/MegaLinter.py +++ b/megalinter/MegaLinter.py @@ -618,6 +618,7 @@ def collect_files(self): file_extensions=self.file_extensions, ignored_files=ignored_files, ignore_generated_files=self.ignore_generated_files, + workspace=self.workspace, ) logging.info( @@ -667,7 +668,7 @@ def list_files_git_diff(self): all_files = list() for diff_line in diff.splitlines(): if os.path.isfile(self.workspace + os.path.sep + diff_line): - all_files += [self.workspace + os.path.sep + diff_line] + all_files += [diff_line] return all_files def list_files_all(self): @@ -676,7 +677,7 @@ def list_files_all(self): "Listing all files in directory [" + self.workspace + "], then filter with:" ) all_files = [ - os.path.join(self.workspace, file) + file for file in sorted(os.listdir(self.workspace)) if os.path.isfile(os.path.join(self.workspace, file)) ] @@ -685,8 +686,11 @@ def list_files_all(self): excluded_directories = utils.get_excluded_directories() for (dirpath, dirnames, filenames) in os.walk(self.workspace, topdown=True): dirnames[:] = [d for d in dirnames if d not in excluded_directories] - all_files += [os.path.join(dirpath, file) for file in sorted(filenames)] - return all_files + all_files += [ + os.path.relpath(os.path.join(dirpath, file), self.workspace) + for file in sorted(filenames) + ] + return list(dict.fromkeys(all_files)) def list_git_ignored_files(self): dirpath = os.path.realpath(self.github_workspace) diff --git a/megalinter/tests/test_megalinter/filters_test.py b/megalinter/tests/test_megalinter/filters_test.py index 4e82761b4e4..6e2b349f0bb 100644 --- a/megalinter/tests/test_megalinter/filters_test.py +++ b/megalinter/tests/test_megalinter/filters_test.py @@ -7,7 +7,6 @@ import unittest from megalinter import utils -from megalinter.constants import DEFAULT_DOCKER_WORKSPACE_DIR class utilsTest(unittest.TestCase): @@ -50,22 +49,20 @@ def test_file_is_generated_false_2(self): ) def test_filter_files_with_ignored_files(self): - basedir = DEFAULT_DOCKER_WORKSPACE_DIR + "/" all_files = [ - f"{basedir}src/foo.ext", - f"{basedir}README.md", - f"{basedir}target/foo.ext", + "src/foo.ext", + "README.md", + "target/foo.ext", ] for (ignored_files, expected) in [ ([], all_files), (["hello"], all_files), - (["target/foo.ext"], all_files), + (["target/foo.ext2"], all_files), ( - [f"{basedir}target/foo.ext"], - [f"{basedir}src/foo.ext", f"{basedir}README.md"], + ["target/foo.ext"], + ["src/foo.ext", "README.md"], ), - (["target/**"], all_files), - ([f"{basedir}target/**"], [f"{basedir}src/foo.ext", f"{basedir}README.md"]), + (["target/**"], ["src/foo.ext", "README.md"]), (["foo.ext"], all_files), ]: filtered_files = utils.filter_files( @@ -82,19 +79,18 @@ def test_filter_files_with_ignored_files(self): ) def test_filter_files_with_file_extensions(self): - basedir = DEFAULT_DOCKER_WORKSPACE_DIR + "/" all_files = [ - f"{basedir}src/foo.ext", - f"{basedir}README.md", - f"{basedir}LICENSE", - f"{basedir}target/foo.ext", + "src/foo.ext", + "README.md", + "LICENSE", + "target/foo.ext", ] for (file_extensions, expected) in [ ([], []), - ([".md"], [f"{basedir}README.md"]), - ([""], [f"{basedir}LICENSE"]), - (["", ".md"], [f"{basedir}LICENSE", f"{basedir}README.md"]), + ([".md"], ["README.md"]), + ([""], ["LICENSE"]), + (["", ".md"], ["LICENSE", "README.md"]), ]: filtered_files = utils.filter_files( all_files=all_files, diff --git a/megalinter/tests/test_megalinter/mega_linter_3_sarif_test.py b/megalinter/tests/test_megalinter/mega_linter_3_sarif_test.py index 3d576c3029b..91ea678e5bd 100644 --- a/megalinter/tests/test_megalinter/mega_linter_3_sarif_test.py +++ b/megalinter/tests/test_megalinter/mega_linter_3_sarif_test.py @@ -34,6 +34,7 @@ def setUp(self): ) def test_sarif_output(self): + raise unittest.SkipTest("TODO: REACTIVATE TEST") mega_linter, output = utilstest.call_mega_linter( { "APPLY_FIXES": "false", diff --git a/megalinter/utils.py b/megalinter/utils.py index c25cf706c9d..299af0e2c40 100644 --- a/megalinter/utils.py +++ b/megalinter/utils.py @@ -72,7 +72,7 @@ def filter_files( file_contains_regex: Optional[Sequence[str]] = None, files_sub_directory: Optional[str] = None, lint_all_other_linters_files: bool = False, - prefix: Optional[str] = None, + workspace: str = "", ) -> Sequence[str]: file_extensions = frozenset(file_extensions) filter_regex_include_object = ( @@ -97,18 +97,13 @@ def filter_files( # Filter all files to keep only the ones matching with the current linter for file in all_files: - file_with_prefix_and_sub_dir = os.path.normpath(file) + file_with_prefix_and_sub_dir = os.path.normpath(file).replace(os.sep, "/") + file_with_workspace = os.path.join(workspace, file_with_prefix_and_sub_dir) file = file_with_prefix_and_sub_dir - if prefix or files_sub_directory: - prefix_and_sub_dir = os.path.normpath( - os.path.join(prefix or "", files_sub_directory or "") + os.path.sep - ) - - if file.startswith(prefix_and_sub_dir): - file = os.path.relpath(file_with_prefix_and_sub_dir, prefix_and_sub_dir) - else: - # Skip if file is not in defined files_sub_directory + # skip file if sub_directory necessary + if files_sub_directory is not None: + if not file.startswith(files_sub_directory): continue # Skip if file is in ignore list @@ -123,10 +118,14 @@ def filter_files( base_file_name = os.path.basename(file) _, file_extension = os.path.splitext(base_file_name) # Skip according to FILTER_REGEX_INCLUDE - if filter_regex_include_object and not filter_regex_include_object.search(file): + if filter_regex_include_object and not filter_regex_include_object.search( + file_with_workspace + ): continue # Skip according to FILTER_REGEX_EXCLUDE - if filter_regex_exclude_object and filter_regex_exclude_object.search(file): + if filter_regex_exclude_object and filter_regex_exclude_object.search( + file_with_workspace + ): continue # Skip according to file extension (only if lint_all_other_linter_files is false or file_extensions is defined) @@ -142,16 +141,16 @@ def filter_files( # Skip according to end of file name if file_names_not_ends_with and file.endswith(tuple(file_names_not_ends_with)): continue - # Skip according to file name regex + # Skip according to file content regex if file_contains_regex and not file_contains( - file_with_prefix_and_sub_dir, file_contains_regex_object + file_with_workspace, file_contains_regex_object ): continue # Skip according to IGNORE_GENERATED_FILES if ( ignore_generated_files is not None and ignore_generated_files is True - and file_is_generated(file_with_prefix_and_sub_dir) + and file_is_generated(file_with_workspace) ): continue From 97a167fe20e09d17593ad549296c02b779eadfb9 Mon Sep 17 00:00:00 2001 From: nvuillam Date: Tue, 20 Dec 2022 16:46:37 +0100 Subject: [PATCH 2/6] activate sarif tests --- megalinter/tests/test_megalinter/mega_linter_3_sarif_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/megalinter/tests/test_megalinter/mega_linter_3_sarif_test.py b/megalinter/tests/test_megalinter/mega_linter_3_sarif_test.py index 91ea678e5bd..3d576c3029b 100644 --- a/megalinter/tests/test_megalinter/mega_linter_3_sarif_test.py +++ b/megalinter/tests/test_megalinter/mega_linter_3_sarif_test.py @@ -34,7 +34,6 @@ def setUp(self): ) def test_sarif_output(self): - raise unittest.SkipTest("TODO: REACTIVATE TEST") mega_linter, output = utilstest.call_mega_linter( { "APPLY_FIXES": "false", From 49911077fd77d33aa6c8c972406ac95befba06b0 Mon Sep 17 00:00:00 2001 From: Nicolas Vuillamy Date: Thu, 22 Dec 2022 11:32:17 +0000 Subject: [PATCH 3/6] [automation] Auto-update linters version, help and documentation --- .automation/generated/flavors-stats.json | 56 ++++++------- .automation/generated/linter-helps.json | 4 +- .automation/generated/linter-versions.json | 2 +- .automation/generated/megalinter-users.json | 88 ++++++++++----------- CHANGELOG.md | 1 + README.md | 2 +- docs/all_linters.md | 2 +- docs/articles.md | 2 +- docs/descriptors/python_black.md | 4 +- docs/descriptors/ruby_rubocop.md | 2 +- docs/index.md | 4 +- docs/used-by-stats.md | 16 ++-- mkdocs.yml | 2 +- 13 files changed, 93 insertions(+), 92 deletions(-) diff --git a/.automation/generated/flavors-stats.json b/.automation/generated/flavors-stats.json index f81831cfbee..893318a50ed 100644 --- a/.automation/generated/flavors-stats.json +++ b/.automation/generated/flavors-stats.json @@ -1149,8 +1149,8 @@ 2711127 ], [ - "2022-12-22T08:54:54", - 2711499 + "2022-12-22T11:30:14", + 2711694 ] ], "ci_light": [ @@ -2303,8 +2303,8 @@ 39181 ], [ - "2022-12-22T08:54:54", - 39254 + "2022-12-22T11:30:14", + 39311 ] ], "cupcake": [ @@ -2437,7 +2437,7 @@ 1155 ], [ - "2022-12-22T08:54:54", + "2022-12-22T11:30:14", 1185 ] ], @@ -4501,8 +4501,8 @@ 97555 ], [ - "2022-12-22T08:54:54", - 97617 + "2022-12-22T11:30:14", + 97666 ] ], "dotnet": [ @@ -5655,8 +5655,8 @@ 333886 ], [ - "2022-12-22T08:54:54", - 333954 + "2022-12-22T11:30:14", + 334001 ] ], "go": [ @@ -6809,8 +6809,8 @@ 15791 ], [ - "2022-12-22T08:54:54", - 15800 + "2022-12-22T11:30:14", + 15807 ] ], "java": [ @@ -7963,8 +7963,8 @@ 103702 ], [ - "2022-12-22T08:54:54", - 103725 + "2022-12-22T11:30:14", + 103743 ] ], "javascript": [ @@ -9117,8 +9117,8 @@ 178906 ], [ - "2022-12-22T08:54:54", - 179006 + "2022-12-22T11:30:14", + 179041 ] ], "php": [ @@ -10271,8 +10271,8 @@ 32765 ], [ - "2022-12-22T08:54:54", - 32795 + "2022-12-22T11:30:14", + 32809 ] ], "python": [ @@ -11425,8 +11425,8 @@ 140102 ], [ - "2022-12-22T08:54:54", - 140221 + "2022-12-22T11:30:14", + 140286 ] ], "ruby": [ @@ -12575,7 +12575,7 @@ 2791 ], [ - "2022-12-22T08:54:54", + "2022-12-22T11:30:14", 2791 ] ], @@ -13725,7 +13725,7 @@ 4350 ], [ - "2022-12-22T08:54:54", + "2022-12-22T11:30:14", 4350 ] ], @@ -14879,8 +14879,8 @@ 15806 ], [ - "2022-12-22T08:54:54", - 15812 + "2022-12-22T11:30:14", + 15817 ] ], "scala": [ @@ -16031,8 +16031,8 @@ 1797 ], [ - "2022-12-22T08:54:54", - 1799 + "2022-12-22T11:30:14", + 1800 ] ], "swift": [ @@ -17181,7 +17181,7 @@ 2994 ], [ - "2022-12-22T08:54:54", + "2022-12-22T11:30:14", 2995 ] ], @@ -18335,8 +18335,8 @@ 150868 ], [ - "2022-12-22T08:54:54", - 150998 + "2022-12-22T11:30:14", + 151098 ] ] } \ No newline at end of file diff --git a/.automation/generated/linter-helps.json b/.automation/generated/linter-helps.json index 4e64d863d01..758b03bb1d3 100644 --- a/.automation/generated/linter-helps.json +++ b/.automation/generated/linter-helps.json @@ -483,8 +483,8 @@ " input).", " --python-cell-magics TEXT When processing Jupyter Notebooks, add the", " given magic to the list of known python-", - " magics (timeit, python3, time, prun, pypy,", - " python, capture). Useful for formatting", + " magics (python, python3, capture, pypy,", + " timeit, prun, time). Useful for formatting", " cells with custom python magics.", " -x, --skip-source-first-line Skip the first line of the source code.", " -S, --skip-string-normalization", diff --git a/.automation/generated/linter-versions.json b/.automation/generated/linter-versions.json index ce06bb2027f..641daece2a0 100644 --- a/.automation/generated/linter-versions.json +++ b/.automation/generated/linter-versions.json @@ -70,7 +70,7 @@ "rst-lint": "1.4.0", "rstcheck": "6.1.1", "rstfmt": "0.0.11", - "rubocop": "1.41.0", + "rubocop": "1.41.1", "scalafix": "0.10.4", "scss-lint": "0.59.0", "secretlint": "5.3.0", diff --git a/.automation/generated/megalinter-users.json b/.automation/generated/megalinter-users.json index 6ac12b20c0b..88cd207b066 100644 --- a/.automation/generated/megalinter-users.json +++ b/.automation/generated/megalinter-users.json @@ -23,8 +23,8 @@ "downloads_url": "https://api.github.com/repos/nektos/act/downloads", "events_url": "https://api.github.com/repos/nektos/act/events", "fork": false, - "forks": 834, - "forks_count": 834, + "forks": 835, + "forks_count": 835, "forks_url": "https://api.github.com/repos/nektos/act/forks", "full_name": "nektos/act", "git_commits_url": "https://api.github.com/repos/nektos/act/git/commits{/sha}", @@ -60,11 +60,11 @@ "milestones_url": "https://api.github.com/repos/nektos/act/milestones{/number}", "mirror_url": null, "name": "act", - "network_count": 834, + "network_count": 835, "node_id": "MDEwOlJlcG9zaXRvcnkxNjM4ODMyNzk=", "notifications_url": "https://api.github.com/repos/nektos/act/notifications{?since,all,participating}", - "open_issues": 89, - "open_issues_count": 89, + "open_issues": 90, + "open_issues_count": 90, "organization": { "avatar_url": "https://avatars.githubusercontent.com/u/3813618?v=4", "events_url": "https://api.github.com/users/nektos/events{/privacy}", @@ -111,7 +111,7 @@ "releases_url": "https://api.github.com/repos/nektos/act/releases{/id}", "size": 6481, "ssh_url": "git@github.com:nektos/act.git", - "stargazers_count": 33246, + "stargazers_count": 33252, "stargazers_url": "https://api.github.com/repos/nektos/act/stargazers", "statuses_url": "https://api.github.com/repos/nektos/act/statuses/{sha}", "subscribers_count": 140, @@ -128,15 +128,15 @@ "golang" ], "trees_url": "https://api.github.com/repos/nektos/act/git/trees{/sha}", - "updated_at": "2022-12-22T08:45:14Z", + "updated_at": "2022-12-22T11:11:15Z", "url": "https://api.github.com/repos/nektos/act", "visibility": "public", - "watchers": 33246, - "watchers_count": 33246, + "watchers": 33252, + "watchers_count": 33252, "web_commit_signoff_required": false }, "repo_url": "https://github.com/nektos/act", - "stargazers": 33246 + "stargazers": 33252 }, { "info": { @@ -346,7 +346,7 @@ "releases_url": "https://api.github.com/repos/IlanCosman/tide/releases{/id}", "size": 6421, "ssh_url": "git@github.com:IlanCosman/tide.git", - "stargazers_count": 1697, + "stargazers_count": 1698, "stargazers_url": "https://api.github.com/repos/IlanCosman/tide/stargazers", "statuses_url": "https://api.github.com/repos/IlanCosman/tide/statuses/{sha}", "subscribers_count": 11, @@ -363,15 +363,15 @@ "prompt" ], "trees_url": "https://api.github.com/repos/IlanCosman/tide/git/trees{/sha}", - "updated_at": "2022-12-22T00:36:03Z", + "updated_at": "2022-12-22T10:59:23Z", "url": "https://api.github.com/repos/IlanCosman/tide", "visibility": "public", - "watchers": 1697, - "watchers_count": 1697, + "watchers": 1698, + "watchers_count": 1698, "web_commit_signoff_required": false }, "repo_url": "https://github.com/IlanCosman/tide", - "stargazers": 1697 + "stargazers": 1698 }, { "info": { @@ -464,7 +464,7 @@ "releases_url": "https://api.github.com/repos/dorssel/usbipd-win/releases{/id}", "size": 1750, "ssh_url": "git@github.com:dorssel/usbipd-win.git", - "stargazers_count": 1507, + "stargazers_count": 1508, "stargazers_url": "https://api.github.com/repos/dorssel/usbipd-win/stargazers", "statuses_url": "https://api.github.com/repos/dorssel/usbipd-win/statuses/{sha}", "subscribers_count": 29, @@ -485,15 +485,15 @@ "wsl2" ], "trees_url": "https://api.github.com/repos/dorssel/usbipd-win/git/trees{/sha}", - "updated_at": "2022-12-21T13:27:12Z", + "updated_at": "2022-12-22T09:33:33Z", "url": "https://api.github.com/repos/dorssel/usbipd-win", "visibility": "public", - "watchers": 1507, - "watchers_count": 1507, + "watchers": 1508, + "watchers_count": 1508, "web_commit_signoff_required": false }, "repo_url": "https://github.com/dorssel/usbipd-win", - "stargazers": 1507 + "stargazers": 1508 }, { "info": { @@ -602,9 +602,9 @@ }, "private": false, "pulls_url": "https://api.github.com/repos/microsoft/code-with-engineering-playbook/pulls{/number}", - "pushed_at": "2022-12-22T08:52:52Z", + "pushed_at": "2022-12-22T11:29:56Z", "releases_url": "https://api.github.com/repos/microsoft/code-with-engineering-playbook/releases{/id}", - "size": 51185, + "size": 50813, "ssh_url": "git@github.com:microsoft/code-with-engineering-playbook.git", "stargazers_count": 1481, "stargazers_url": "https://api.github.com/repos/microsoft/code-with-engineering-playbook/stargazers", @@ -735,9 +735,9 @@ }, "private": false, "pulls_url": "https://api.github.com/repos/oxsecurity/megalinter/pulls{/number}", - "pushed_at": "2022-12-22T08:48:35Z", + "pushed_at": "2022-12-22T11:00:08Z", "releases_url": "https://api.github.com/repos/oxsecurity/megalinter/releases{/id}", - "size": 286115, + "size": 288368, "ssh_url": "git@github.com:oxsecurity/megalinter.git", "stargazers_count": 973, "stargazers_url": "https://api.github.com/repos/oxsecurity/megalinter/stargazers", @@ -1213,8 +1213,8 @@ "network_count": 114, "node_id": "MDEwOlJlcG9zaXRvcnkyMzA5OTk4MjY=", "notifications_url": "https://api.github.com/repos/onedr0p/home-ops/notifications{?since,all,participating}", - "open_issues": 7, - "open_issues_count": 7, + "open_issues": 8, + "open_issues_count": 8, "owner": { "avatar_url": "https://avatars.githubusercontent.com/u/213795?v=4", "events_url": "https://api.github.com/users/onedr0p/events{/privacy}", @@ -1237,11 +1237,11 @@ }, "private": false, "pulls_url": "https://api.github.com/repos/onedr0p/home-ops/pulls{/number}", - "pushed_at": "2022-12-22T01:33:55Z", + "pushed_at": "2022-12-22T10:07:00Z", "releases_url": "https://api.github.com/repos/onedr0p/home-ops/releases{/id}", - "size": 29899, + "size": 29900, "ssh_url": "git@github.com:onedr0p/home-ops.git", - "stargazers_count": 723, + "stargazers_count": 724, "stargazers_url": "https://api.github.com/repos/onedr0p/home-ops/stargazers", "statuses_url": "https://api.github.com/repos/onedr0p/home-ops/statuses/{sha}", "subscribers_count": 10, @@ -1263,15 +1263,15 @@ "terraform" ], "trees_url": "https://api.github.com/repos/onedr0p/home-ops/git/trees{/sha}", - "updated_at": "2022-12-22T00:02:47Z", + "updated_at": "2022-12-22T10:27:24Z", "url": "https://api.github.com/repos/onedr0p/home-ops", "visibility": "public", - "watchers": 723, - "watchers_count": 723, + "watchers": 724, + "watchers_count": 724, "web_commit_signoff_required": false }, "repo_url": "https://github.com/onedr0p/home-ops", - "stargazers": 723 + "stargazers": 724 }, { "info": { @@ -1657,7 +1657,7 @@ "releases_url": "https://api.github.com/repos/awslabs/aws-deployment-framework/releases{/id}", "size": 3683, "ssh_url": "git@github.com:awslabs/aws-deployment-framework.git", - "stargazers_count": 518, + "stargazers_count": 519, "stargazers_url": "https://api.github.com/repos/awslabs/aws-deployment-framework/stargazers", "statuses_url": "https://api.github.com/repos/awslabs/aws-deployment-framework/statuses/{sha}", "subscribers_count": 38, @@ -1674,15 +1674,15 @@ "multi-account" ], "trees_url": "https://api.github.com/repos/awslabs/aws-deployment-framework/git/trees{/sha}", - "updated_at": "2022-12-19T04:40:45Z", + "updated_at": "2022-12-22T10:40:11Z", "url": "https://api.github.com/repos/awslabs/aws-deployment-framework", "visibility": "public", - "watchers": 518, - "watchers_count": 518, + "watchers": 519, + "watchers_count": 519, "web_commit_signoff_required": false }, "repo_url": "https://github.com/awslabs/aws-deployment-framework", - "stargazers": 518 + "stargazers": 519 }, { "info": { @@ -2402,9 +2402,9 @@ }, "private": false, "pulls_url": "https://api.github.com/repos/xUnholy/k8s-gitops/pulls{/number}", - "pushed_at": "2022-12-22T07:38:48Z", + "pushed_at": "2022-12-22T09:57:49Z", "releases_url": "https://api.github.com/repos/xUnholy/k8s-gitops/releases{/id}", - "size": 7624, + "size": 7628, "ssh_url": "git@github.com:xUnholy/k8s-gitops.git", "stargazers_count": 269, "stargazers_url": "https://api.github.com/repos/xUnholy/k8s-gitops/stargazers", @@ -2640,9 +2640,9 @@ }, "private": false, "pulls_url": "https://api.github.com/repos/bjw-s/home-ops/pulls{/number}", - "pushed_at": "2022-12-22T08:30:51Z", + "pushed_at": "2022-12-22T11:06:03Z", "releases_url": "https://api.github.com/repos/bjw-s/home-ops/releases{/id}", - "size": 32097, + "size": 32106, "ssh_url": "git@github.com:bjw-s/home-ops.git", "stargazers_count": 217, "stargazers_url": "https://api.github.com/repos/bjw-s/home-ops/stargazers", @@ -2880,7 +2880,7 @@ }, "private": false, "pulls_url": "https://api.github.com/repos/toboshii/home-ops/pulls{/number}", - "pushed_at": "2022-12-21T21:15:47Z", + "pushed_at": "2022-12-22T10:17:55Z", "releases_url": "https://api.github.com/repos/toboshii/home-ops/releases{/id}", "size": 2804, "ssh_url": "git@github.com:toboshii/home-ops.git", @@ -3377,7 +3377,7 @@ }, "private": false, "pulls_url": "https://api.github.com/repos/carpenike/k8s-gitops/pulls{/number}", - "pushed_at": "2022-12-22T08:21:32Z", + "pushed_at": "2022-12-22T11:17:58Z", "releases_url": "https://api.github.com/repos/carpenike/k8s-gitops/releases{/id}", "size": 124536, "ssh_url": "git@github.com:carpenike/k8s-gitops.git", diff --git a/CHANGELOG.md b/CHANGELOG.md index c1dd233aa1d..44ff8cf7b24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l - [cspell](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell) from 6.17.0 to **6.18.0** on 2022-12-21 - [isort](https://pycqa.github.io/isort/) from 5.11.3 to **5.11.4** on 2022-12-21 - [perlcritic](https://metacpan.org/pod/Perl::Critic) from 1.144 to **1.146** on 2022-12-22 + - [rubocop](https://rubocop.org/) from 1.41.0 to **1.41.1** on 2022-12-22 ## [v6.15.0] - 2022-11-23 diff --git a/README.md b/README.md index eaeee454984..01308441d5d 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ [![MegaLinter](https://github.com/oxsecurity/megalinter/workflows/MegaLinter/badge.svg?branch=main)](https://github.com/oxsecurity/megalinter/actions?query=workflow%3AMegaLinter+branch%3Amain) [![codecov](https://codecov.io/gh/oxsecurity/megalinter/branch/main/graph/badge.svg)](https://codecov.io/gh/oxsecurity/megalinter) -[![](https://img.shields.io/static/v1?label=Used%20by&message=1871&color=informational&logo=slickpic)](https://github.com/oxsecurity/megalinter/network/dependents) +[![](https://img.shields.io/static/v1?label=Used%20by&message=1872&color=informational&logo=slickpic)](https://github.com/oxsecurity/megalinter/network/dependents) [![Secured with Trivy](https://img.shields.io/badge/Trivy-secured-green?logo=docker)](https://github.com/aquasecurity/trivy) [![GitHub contributors](https://img.shields.io/github/contributors/oxsecurity/megalinter.svg)](https://github.com/oxsecurity/megalinter/graphs/contributors/) [![GitHub Sponsors](https://img.shields.io/github/sponsors/nvuillam)](https://github.com/sponsors/nvuillam) diff --git a/docs/all_linters.md b/docs/all_linters.md index 684cfb937f7..4d9f3ae4b0a 100644 --- a/docs/all_linters.md +++ b/docs/all_linters.md @@ -74,7 +74,7 @@ | [**rst-lint**](https://github.com/twolfson/restructuredtext-lint){target=_blank} | 1.4.0 | | [![GitHub stars](https://img.shields.io/github/stars/twolfson/restructuredtext-lint?cacheSeconds=3600)](https://github.com/twolfson/restructuredtext-lint){target=_blank} | [RST](descriptors/rst_rst_lint.md) | :heart: | [MegaLinter reference](https://github.com/twolfson/restructuredtext-lint/wiki/Integration-in-other-tools#integration-in-other-tools){target=_blank} | | [**rstcheck**](https://github.com/myint/rstcheck){target=_blank} | 6.1.1 | | [![GitHub stars](https://img.shields.io/github/stars/myint/rstcheck?cacheSeconds=3600)](https://github.com/myint/rstcheck){target=_blank} | [RST](descriptors/rst_rstcheck.md) | :heart: | [MegaLinter reference](https://rstcheck.readthedocs.io/en/latest/usage/integration/#use-with-mega-linter){target=_blank} | | [**rstfmt**](https://github.com/dzhu/rstfmt){target=_blank} | 0.0.11 | | | [RST](descriptors/rst_rstfmt.md) | :hammer_and_wrench: | [Pull Request](https://github.com/dzhu/rstfmt/pull/1){target=_blank} | -| [**rubocop**](https://github.com/rubocop-hq/rubocop){target=_blank} | 1.41.0 | [MIT](licenses/rubocop.md) | [![GitHub stars](https://img.shields.io/github/stars/rubocop-hq/rubocop?cacheSeconds=3600)](https://github.com/rubocop-hq/rubocop){target=_blank} | [RUBY](descriptors/ruby_rubocop.md) | :heart: | [MegaLinter reference](https://docs.rubocop.org/rubocop/integration_with_other_tools.html#mega-linter-integration){target=_blank} | +| [**rubocop**](https://github.com/rubocop-hq/rubocop){target=_blank} | 1.41.1 | [MIT](licenses/rubocop.md) | [![GitHub stars](https://img.shields.io/github/stars/rubocop-hq/rubocop?cacheSeconds=3600)](https://github.com/rubocop-hq/rubocop){target=_blank} | [RUBY](descriptors/ruby_rubocop.md) | :heart: | [MegaLinter reference](https://docs.rubocop.org/rubocop/integration_with_other_tools.html#mega-linter-integration){target=_blank} | | [**scalafix**](https://github.com/scalacenter/scalafix){target=_blank} | 0.10.4 | [Other](licenses/scalafix.md) | [![GitHub stars](https://img.shields.io/github/stars/scalacenter/scalafix?cacheSeconds=3600)](https://github.com/scalacenter/scalafix){target=_blank} | [SCALA](descriptors/scala_scalafix.md) | :heart: | [MegaLinter reference](https://scalacenter.github.io/scalafix/docs/users/installation.html#plugins-for-other-build-tools){target=_blank} | | [**scss-lint**](https://github.com/sds/scss-lint){target=_blank} | 0.59.0 | | [![GitHub stars](https://img.shields.io/github/stars/sds/scss-lint?cacheSeconds=3600)](https://github.com/sds/scss-lint){target=_blank} | [CSS](descriptors/css_scss_lint.md) | :white_circle: | [Repository](https://github.com/sds/scss-lint){target=_blank} | | [**secretlint**](https://github.com/secretlint/secretlint){target=_blank} | 5.3.0 | [MIT](licenses/secretlint.md) | [![GitHub stars](https://img.shields.io/github/stars/secretlint/secretlint?cacheSeconds=3600)](https://github.com/secretlint/secretlint){target=_blank} | [REPOSITORY](descriptors/repository_secretlint.md) | :heart: | [MegaLinter reference](https://github.com/secretlint/secretlint#mega-linter){target=_blank} | diff --git a/docs/articles.md b/docs/articles.md index 0e646cec541..2a34a105f34 100644 --- a/docs/articles.md +++ b/docs/articles.md @@ -5,7 +5,7 @@ # Articles - [Limit your technical debt and secure your code base using MegaLinter](https://nicolas.vuillamy.fr/improve-uniformize-and-secure-your-code-base-with-megalinter-62ebab422c1){target=_blank}, by [Nicolas Vuillamy](https://nvuillam.github.io){target=_blank} -- [MegaLinter sells his soul and joins Ox Security](https://nicolas.vuillamy.fr/megalinter-sells-his-soul-and-joins-ox-security-2a91a0027628){target=_blank}, by [Nicolas Vuillamy](https://nvuillam.github.io){target=_blank} +- [MegaLinter sells his soul and joins OX Security](https://nicolas.vuillamy.fr/megalinter-sells-his-soul-and-joins-ox-security-2a91a0027628){target=_blank}, by [Nicolas Vuillamy](https://nvuillam.github.io){target=_blank} - [Linting a Jekyll blog with MegaLinter](https://www.ayyjohn.com/posts/linting-a-jekyll-blog-with-mega-linter){target=_blank}, by [Alec Johnson](https://www.linkedin.com/in/ayyjohn/){target=_blank} - [Node.js Coding Standard Tools with MegaLinter on Gitlab CI](https://javascript.plainenglish.io/node-js-coding-standard-tools-with-megalinter-on-gitlab-ci-a43b55915811){target=_blank}, by [Albion Bame](https://www.linkedin.com/in/albion-bame/){target=_blank} - [Open-source linters landscape in 2021](https://promyze.com/open-source-linters-2021/){target=_blank}, by [Cédric Teyton](https://www.linkedin.com/in/cedricteyton/){target=_blank} diff --git a/docs/descriptors/python_black.md b/docs/descriptors/python_black.md index 7772ab99949..9c1fc59114f 100644 --- a/docs/descriptors/python_black.md +++ b/docs/descriptors/python_black.md @@ -115,8 +115,8 @@ Options: input). --python-cell-magics TEXT When processing Jupyter Notebooks, add the given magic to the list of known python- - magics (timeit, python3, time, prun, pypy, - python, capture). Useful for formatting + magics (python, python3, capture, pypy, + timeit, prun, time). Useful for formatting cells with custom python magics. -x, --skip-source-first-line Skip the first line of the source code. -S, --skip-string-normalization diff --git a/docs/descriptors/ruby_rubocop.md b/docs/descriptors/ruby_rubocop.md index c7ae9b9dcf6..abe8bbad206 100644 --- a/docs/descriptors/ruby_rubocop.md +++ b/docs/descriptors/ruby_rubocop.md @@ -11,7 +11,7 @@ ## rubocop documentation -- Version in MegaLinter: **1.41.0** +- Version in MegaLinter: **1.41.1** - Visit [Official Web Site](https://rubocop.org/){target=_blank} - See [How to configure rubocop rules](https://docs.rubocop.org/rubocop/0.92/configuration.html){target=_blank} - If custom `.ruby-lint.yml` config file is not found, [.ruby-lint.yml](https://github.com/oxsecurity/megalinter/tree/main/TEMPLATES/.ruby-lint.yml){target=_blank} will be used diff --git a/docs/index.md b/docs/index.md index 2e82994d7b9..7bd8dc4f4f5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,7 @@ -

Verify your code consistency with an open-source tool.
Powered by Ox Security.

+

Verify your code consistency with an open-source tool.
Powered by OX Security.

@@ -26,7 +26,7 @@ -MegaLinter is an **Open-Source** tool for **CI/CD workflows** that analyzes the **consistency of your code**, **IAC**, **configuration**, and **scripts** in your repository sources, to **ensure all your projects sources are clean and formatted** whatever IDE/toolbox is used by their developers, powered by [**Ox Security**](https://www.ox.security/?ref=megalinter). +MegaLinter is an **Open-Source** tool for **CI/CD workflows** that analyzes the **consistency of your code**, **IAC**, **configuration**, and **scripts** in your repository sources, to **ensure all your projects sources are clean and formatted** whatever IDE/toolbox is used by their developers, powered by [**OX Security**](https://www.ox.security/?ref=megalinter). Supporting [**51** languages](supported-linters.md#languages), [**23** formats](supported-linters.md#formats), [**21** tooling formats](supported-linters.md#tooling-formats) and **ready to use out of the box**, as a GitHub action or any CI system **highly configurable** and **free for all uses**. diff --git a/docs/used-by-stats.md b/docs/used-by-stats.md index 9b6ae82947a..33ce08221e4 100644 --- a/docs/used-by-stats.md +++ b/docs/used-by-stats.md @@ -1,23 +1,23 @@ # Dependents stats for oxsecurity/megalinter -[![](https://img.shields.io/static/v1?label=Used%20by&message=1871&color=informational&logo=slickpic)](https://github.com/oxsecurity/megalinter/network/dependents) +[![](https://img.shields.io/static/v1?label=Used%20by&message=1872&color=informational&logo=slickpic)](https://github.com/oxsecurity/megalinter/network/dependents) [![](https://img.shields.io/static/v1?label=Used%20by%20(public)&message=1310&color=informational&logo=slickpic)](https://github.com/oxsecurity/megalinter/network/dependents) -[![](https://img.shields.io/static/v1?label=Used%20by%20(private)&message=561&color=informational&logo=slickpic)](https://github.com/oxsecurity/megalinter/network/dependents) -[![](https://img.shields.io/static/v1?label=Used%20by%20(stars)&message=50349&color=informational&logo=slickpic)](https://github.com/oxsecurity/megalinter/network/dependents) +[![](https://img.shields.io/static/v1?label=Used%20by%20(private)&message=562&color=informational&logo=slickpic)](https://github.com/oxsecurity/megalinter/network/dependents) +[![](https://img.shields.io/static/v1?label=Used%20by%20(stars)&message=50359&color=informational&logo=slickpic)](https://github.com/oxsecurity/megalinter/network/dependents) | Repository | Stars | |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------:| -| [nektos/act](https://github.com/nektos/act) | 33246 | +| [nektos/act](https://github.com/nektos/act) | 33252 | | [stepancheg/rust-protobuf](https://github.com/stepancheg/rust-protobuf) | 2281 | -| [IlanCosman/tide](https://github.com/IlanCosman/tide) | 1697 | -| [dorssel/usbipd-win](https://github.com/dorssel/usbipd-win) | 1507 | +| [IlanCosman/tide](https://github.com/IlanCosman/tide) | 1698 | +| [dorssel/usbipd-win](https://github.com/dorssel/usbipd-win) | 1508 | | [microsoft/code-with-engineering-playbook](https://github.com/microsoft/code-with-engineering-playbook) | 1481 | | [oxsecurity/megalinter](https://github.com/oxsecurity/megalinter) | 973 | | [flosse/sloc](https://github.com/flosse/sloc) | 917 | | [unixorn/git-extra-commands](https://github.com/unixorn/git-extra-commands) | 837 | | [unixorn/zsh-quickstart-kit](https://github.com/unixorn/zsh-quickstart-kit) | 600 | | [secureCodeBox/secureCodeBox](https://github.com/secureCodeBox/secureCodeBox) | 547 | -| [awslabs/aws-deployment-framework](https://github.com/awslabs/aws-deployment-framework) | 518 | +| [awslabs/aws-deployment-framework](https://github.com/awslabs/aws-deployment-framework) | 519 | | [practicalli/clojure-deps-edn](https://github.com/practicalli/clojure-deps-edn) | 435 | | [llaville/php-compatinfo](https://github.com/llaville/php-compatinfo) | 357 | | [ruzickap/packer-templates](https://github.com/ruzickap/packer-templates) | 348 | @@ -33,7 +33,7 @@ | [unixorn/tumult.plugin.zsh](https://github.com/unixorn/tumult.plugin.zsh) | 144 | | [nvuillam/npm-groovy-lint](https://github.com/nvuillam/npm-groovy-lint) | 128 | | [carpenike/k8s-gitops](https://github.com/carpenike/k8s-gitops) | 125 | -| [unixorn/fzf-zsh-plugin](https://github.com/unixorn/fzf-zsh-plugin) | 123 | +| [unixorn/fzf-zsh-plugin](https://github.com/unixorn/fzf-zsh-plugin) | 124 | | [newrelic/newrelic-python-agent](https://github.com/newrelic/newrelic-python-agent) | 122 | | [apigee/devrel](https://github.com/apigee/devrel) | 122 | | [T145/black-mirror](https://github.com/T145/black-mirror) | 111 | diff --git a/mkdocs.yml b/mkdocs.yml index 77f06fd31aa..341cb53f49c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -5,7 +5,7 @@ repo_url: https://github.com/oxsecurity/megalinter edit_uri: tree/main/docs site_author: Nicolas Vuillamy # site_description-start -site_description: MegaLinter is an Open-Source tool for CI/CD workflows that analyzes the consistency of your code, IAC, configuration, and scripts in your repository sources, to ensure all your projects sources are clean and formatted whatever IDE/toolbox is used by their developers, powered by OX Security. Supporting 51 languages, 23 formats, 21 tooling formats and ready to use out of the box, as a GitHub action or any CI system highly configurable and free for all uses.Upgrade to MegaLinter v6 ! +site_description: MegaLinter is an Open-Source tool for CI/CD workflows that analyzes the consistency of your code, IAC, configuration, and scripts in your repository sources, to ensure all your projects sources are clean and formatted whatever IDE/toolbox is used by their developers, powered by OX Security.Supporting 51 languages, 23 formats, 21 tooling formats and ready to use out of the box, as a GitHub action or any CI system highly configurable and free for all uses.Upgrade to MegaLinter v6 ! # site_description-end copyright: Copyright © 2022 OX Security & Nicolas Vuillamy theme: From 39420e4c1ecc802f61807450b641efe3a51549d6 Mon Sep 17 00:00:00 2001 From: nvuillam Date: Wed, 19 Apr 2023 21:53:27 +0200 Subject: [PATCH 4/6] Fix filtering of linters checking file content --- megalinter/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megalinter/utils.py b/megalinter/utils.py index 0b92b257543..01dfd7e6adc 100644 --- a/megalinter/utils.py +++ b/megalinter/utils.py @@ -160,7 +160,7 @@ def filter_files( ) ) and not file_contains( - file_with_prefix_and_sub_dir, file_contains_regex_object + file_with_workspace, file_contains_regex_object ) ): continue From 90cdb3ee9955969754c11c681108d10f1a2b3d6c Mon Sep 17 00:00:00 2001 From: nvuillam Date: Wed, 19 Apr 2023 19:59:04 +0000 Subject: [PATCH 5/6] [MegaLinter] Apply linters fixes --- megalinter/utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/megalinter/utils.py b/megalinter/utils.py index 01dfd7e6adc..f743cb38f10 100644 --- a/megalinter/utils.py +++ b/megalinter/utils.py @@ -159,9 +159,7 @@ def filter_files( in file_contains_regex_extensions ) ) - and not file_contains( - file_with_workspace, file_contains_regex_object - ) + and not file_contains(file_with_workspace, file_contains_regex_object) ): continue # Skip according to IGNORE_GENERATED_FILES From d5079a6dc4e5568639494609a089fd3cac1a14cd Mon Sep 17 00:00:00 2001 From: nvuillam Date: Wed, 19 Apr 2023 22:23:53 +0200 Subject: [PATCH 6/6] Downgrade Azure DevOps pipy package --- megalinter/setup.py | 2 +- requirements.dev.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/megalinter/setup.py b/megalinter/setup.py index 120a8068c34..b1ecb6618d1 100644 --- a/megalinter/setup.py +++ b/megalinter/setup.py @@ -21,7 +21,7 @@ "pychalk", "pygithub", "python-gitlab", - "azure-devops", + "azure-devops==6.0.0b4", "commentjson", "pytablewriter", "pyyaml", diff --git a/requirements.dev.txt b/requirements.dev.txt index e92670ae7dc..ee0b09cb79a 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -6,7 +6,7 @@ multiprocessing_logging pychalk pygithub python-gitlab -azure-devops +azure-devops==6.0.0b4 commentjson pytablewriter pytest-cov